Skip to content

Commit

Permalink
Merge pull request #43 from menchelab/v1.1.1
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
koalive authored Nov 30, 2022
2 parents 9debe24 + 9863852 commit 88aaa77
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
- run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib" >> $GITHUB_ENV
- run: sudo R -e "install.packages('robustbase', repos='http://cran.rstudio.com/')"
- uses: julia-actions/setup-julia@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/NightlyCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
- run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib" >> $GITHUB_ENV
- run: sudo R -e "install.packages('robustbase', repos='http://cran.rstudio.com/')"
- uses: julia-actions/setup-julia@latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/Manifest.toml
/dev/
docs/build/
.julia
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## v1.1.1 - 2022-11-30
### Changed
- Change R repository for increased compatibility
- Update links in documentation

### Added
- Documentation on codespaces
- Tests for TIF-related methods

## v1.1.0 - 2021-09-23
### Added
- Option to remove R seed from distance computation
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ All tests should pass for the supported versions of Julia and the package's depe

## Development environment

BioProfiling.jl is intended to be compatible with a large set of environments as detailed in [Project.toml](Project.toml). If you need to setup a development environment, an easy solution is to start from the [latest Docker image designed to run the example notebooks](https://hub.docker.com/r/koalive/bioprofilingnotebooks), which comes with all dependencies installed. To avoid inteferences between the pre-installed version of BioProfiling.jl and your local version of the source code, you can remove the version installed in the container with the following lines:
BioProfiling.jl is intended to be compatible with a large set of environments as detailed in [Project.toml](Project.toml). If you need to setup a development environment, an easy solution is to **edit and run code directly in your browser thanks to GitHub codespaces**. Some instructions are available in [our documentation](https://menchelab.github.io/BioProfiling.jl/dev/).
Another option is to start from the [latest **Docker image** designed to run the example notebooks](https://hub.docker.com/r/koalive/bioprofilingnotebooks), which comes with all dependencies installed. To avoid inteferences between the pre-installed version of BioProfiling.jl and your local version of the source code, you can remove the version installed in the container with the following lines:

```julia
import Pkg
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BioProfiling"
uuid = "cef322dc-4d82-11ea-04a7-113231db804d"
authors = ["Loan Vulliard <lvulliard@cemm.oeaw.ac.at>"]
version = "1.1.0"
version = "1.1.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ using BioProfiling
* Have a look at the [documentation](https://menchelab.github.io/BioProfiling.jl/dev/)
* Run our [example analysis notebooks](https://github.com/menchelab/BioProfilingNotebooks)
* Check out the [JuliaCon 2021 poster](https://drive.google.com/file/d/1sjRONQ8dRJDGAiR-wBhC_rEBKiMIs5Rh/preview) presenting BioProfiling.jl
* Read our [preprint on BioRxiv](https://www.biorxiv.org/content/10.1101/2021.06.18.448961v1)
* Read our [article published in Bioinformatics](https://doi.org/10.1093/bioinformatics/btab853)

## Contribute

Expand All @@ -67,10 +67,10 @@ We welcome all sorts of contributions to this project! See our [contribution gui

This package was created by [Loan Vulliard](http://vulliard.loan) @ [Menche lab](https://menchelab.com/).
BioProfiling.jl relies on several amazing open-source Julia packages, listed in the requirement file (see [*Project.toml*](Project.toml)).
If you use this tool in your research work, please cite the [preprint](https://www.biorxiv.org/content/10.1101/2021.06.18.448961v1) in which we detail how this tool is implemented and can be used:
If you use this tool in your research work, please cite [the article](https://doi.org/10.1093/bioinformatics/btab853) in which we detail how this tool is implemented and can be used:

BioProfiling.jl: Profiling biological perturbations with high-content imaging in single cells and heterogeneous populations
Loan Vulliard, Joel Hancock, Anton Kamnev, Christopher W. Fell, Joana Ferreira da Silva, Joanna Loizou, Vanja Nagy, Loïc Dupré, Jörg Menche
bioRxiv 2021.06.18.448961; doi: https://doi.org/10.1101/2021.06.18.448961
BioProfiling.jl: profiling biological perturbations with high-content imaging in single cells and heterogeneous populations
Loan Vulliard, Joel Hancock, Anton Kamnev, Christopher W Fell, Joana Ferreira da Silva, Joanna I Loizou, Vanja Nagy, Loïc Dupré, Jörg Menche
Bioinformatics 2022; 38: 1692–9. DOI: https://doi.org/10.1093/bioinformatics/btab853

We also thank the reviewers of this manuscript whose suggestions contributed to improve the [example analyses](https://github.com/menchelab/BioProfilingNotebooks), their biological interpretation as well as the package in itself.
We also thank the reviewers whose suggestions contributed to improve the [example analyses](https://github.com/menchelab/BioProfilingNotebooks), their biological interpretation as well as the package in itself.
28 changes: 28 additions & 0 deletions docs/src/codespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# BioProfiling.jl examples

This section aim to describe how to develop and test the BioProfiling.jl package using a virtual machine hosted by GitHub and VS directly in your browser thanks to GitHub codespaces.
Please note that no paid account is typically needed, although you might have limited access to codespaces depending on which type of GitHub account you have (see [Pricing information](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)).

## Starting a codespace and setting up the environment

Go to the [repository](https://github.com/menchelab/BioProfiling.jl), on the branch you would like to edit. Click on "Code <>" > "Codespaces" > "+". This will open VS, where you can edit the files, run code, and contribute to the repository using all usual GitHub features.
First, you will need to start a Docker container to be able to run Julia code. In the terminal, run `docker run -it -v `pwd`:/home/jovyan jupyter/datascience-notebook:latest julia`. The environment should include both R and Julia, although you might want to use [another image](https://hub.docker.com/r/jupyter/datascience-notebook/tags) if you want a version in particular.

## Setting up Julia for package development

The terminal should display a Julia session. Now, set up the package as follows:
```julia
import Pkg
Pkg.activate(".") # Set up requirements for environment
Pkg.status() # This should display the dependencies of the package

Pkg.instantiate() # Actually prepare all packages
# You can now modify what you and test your new features!

# In the end, do not forget to test your code to make sure you did not break anything
Pkg.test()
```

## Opening a pull request

Once you are satisfied with your changes and made sure that are not breaking existing features, go to the "Source Control" tab to commit your changes. Typically you will want to create a pull request with your code. Please follow the [contribution guidelines](https://github.com/menchelab/BioProfiling.jl/blob/master/CONTRIBUTING.md) and [code of conduct](https://github.com/menchelab/BioProfiling.jl/blob/master/CODE_OF_CONDUCT.md). Thanks for taking the time to contribute to BioProfiling.jl!
8 changes: 4 additions & 4 deletions src/rmpv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function distance_robust_mahalanobis_median(data, indpert, indref; r_seed = true

R"""
if (!require("robustbase")) install.packages("robustbase",
repos = "https://cloud.r-project.org")
repos = "http://cloud.r-project.org")
library(robustbase)
if (r_seed){set.seed(777)}
Expand Down Expand Up @@ -161,7 +161,7 @@ function shuffled_distance_robust_mahalanobis_median(data, indpert, indref; nb_r

R"""
if (!require("robustbase")) install.packages("robustbase",
repos = "https://cloud.r-project.org")
repos = "http://cloud.r-project.org")
library(robustbase)
if (r_seed){set.seed(3895)}
Expand Down Expand Up @@ -202,7 +202,7 @@ function distance_robust_hellinger(data, indpert, indref; r_seed = true)

R"""
if (!require("robustbase")) install.packages("robustbase",
repos = "https://cloud.r-project.org")
repos = "http://cloud.r-project.org")
library(robustbase)
if (r_seed){set.seed(777)}
Expand Down Expand Up @@ -261,7 +261,7 @@ function shuffled_distance_robust_hellinger(data, indpert, indref; nb_rep = 250,

R"""
if (!require("robustbase")) install.packages("robustbase",
repos = "https://cloud.r-project.org")
repos = "http://cloud.r-project.org")
library(robustbase)
if (r_seed){set.seed(777)}
Expand Down
Binary file added test/example16b.tiff
Binary file not shown.
Binary file added test/example32b.tiff
Binary file not shown.
Binary file added test/example32b_bw.tiff
Binary file not shown.
Binary file added test/example8b.tiff
Binary file not shown.
47 changes: 41 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using Random
using RCall
using Distributed
using ParallelDataTransfer
using Images


@testset "freqtable" begin
d = DataFrame(Any[0.05131 0.32830 "Exp1"; 0.83296 0.97647 "Exp1"; 0.66463 0.66939 "Exp2";
Expand Down Expand Up @@ -278,12 +280,38 @@ end
@test diagnostic_images(e1, cf1, :Experiment, rgx = [r".*" => s"example.png"], saveimages = false)
# Additional checks that could be performed:
# Centers of diagnostic_path
# getColorImage [internal]
# colimgifrgb [internal]
# rgb parameters of diagnostic_images
# output of diagnostic_images
end

@testset "tiff" begin
# Test TIF images at 8, 16 or 32 bits, RGB or single channel
i8 = load("example8b.tiff")
i16 = load("example16b.tiff")
i32 = load("example32b.tiff")
pathbw = "example32b_bw.tiff"
i32bw = load(pathbw)

# Images are not empty
@test all([sum(channelview(x)) > 0 for x in [i8, i16, i32, i32bw] ])
# Black-and-white image should correspond to the second channel of i32
@test channelview(i32bw) == channelview(i32)[2,:,:]

i32_fakergb = BioProfiling.getColorImage(pathbw, pathbw, pathbw)
@test channelview(i32_fakergb)[1,:,:] == channelview(i32_fakergb)[2,:,:] == channelview(i32_fakergb)[3,:,:]
# All pixel intensities should be normalized by the same amount
ratio_intensity = float(channelview(i32_fakergb)[3,6,6]) ./ channelview(i32bw)[6,6]
@test all([isapprox(channelview(i32bw)[x,y] * ratio_intensity,
channelview(i32_fakergb)[3,x,y],
atol = 2/(2^32))
for x in 1:32 for y in 1:96])

@test_throws ArgumentError BioProfiling.colimgifrgb("not_a_path", nothing)
# Should load images as in getColorImage and support regex for RGB images
@test BioProfiling.colimgifrgb(pathbw, nothing) == i32bw
@test BioProfiling.colimgifrgb(pathbw, ["", "", ""]) == i32_fakergb
end

@testset "interpret" begin
# Define example dataset
d = DataFrame([[0,2,4,6,8,21],[0,1,2,3,4,0],[0,3,6,9,12,3],'A':'F'])
Expand Down Expand Up @@ -605,7 +633,7 @@ end
# Robustbase must be installed
R"""
if (!require("robustbase")) install.packages("robustbase",
repos = "https://cloud.r-project.org")
repos = "http://cloud.r-project.org")
library(robustbase)
"""
d = rand(100,5)
Expand Down Expand Up @@ -764,16 +792,23 @@ end
end

@testset "parallel_rmpv" begin
"""
Warning: this is resource intensive!
Running it on the default 2- or 4-core machines in Github
codespaces lead to an error (a KILL signal is sent).
This should work well with 8-core machines.
You might want to skip it in your routine checks.
It is best including it in the actual checks in CI anyway.
"""
d = DataFrame(rand(100,5))
d.Condition = sample('A':'D', 100);

e = Experiment(d)

addprocs(4)
addprocs(4, exeflags="--project=$(Base.active_project())")
pool = CachingPool(workers())
@everywhere using BioProfiling


slt = NameSelector(x -> x != "Condition")
select_features!(e, slt)
f = Filter('C', :Condition)
Expand All @@ -785,4 +820,4 @@ end

# 4 conditions, 3 columns
@test size(rmpv) == (4,3)
end
end

3 comments on commit 88aaa77

@koalive
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@koalive
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/73163

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.1 -m "<description of version>" 88aaa77a87b45d8d3ce02f7601b8e339a07130cb
git push origin v1.1.1

Please sign in to comment.