omnideconv / deconvBench

Comparison of 2nd generation deconvolution methods implemented in omnideconv
2 stars 0 forks source link

No more absolute links in R scripts #25

Closed alex-d13 closed 9 months ago

alex-d13 commented 9 months ago

Currently we have many cases, where hard links are written in the R scripts. This should be fixed with a parameter or with another solution.

For example here: https://github.com/omnideconv/deconvBench/blob/dfba28afae790f64cba1dc19edd453cd35899fe5/pipeline/bin/computeSignaturesNF.R#L123

grst commented 9 months ago

If you are using nextflow, you should always write to the current working directory, and use publishDir to copy the files to their final destination. Writing absolute paths from a nextflow pipeline as an anti-pattern.

alex-d13 commented 9 months ago

@grst You are right, we really did not follow the best practices well during the pipeline development :D

alex-d13 commented 9 months ago

We still have a related issue with external files that should be accessed in R scripts, such as utils.R and optimal_normalization.csv. At the moment we use absolute paths to these files, which is not ideal. A solution could be with a new parameter, but its also not really pretty..

https://github.com/omnideconv/deconvBench/blob/2289c4007bf2eb32bfc9cef66f956f8115ba5773/pipeline/bin/analysisNF_mixed_simulations_real_dataset.R#L9 https://github.com/omnideconv/deconvBench/blob/2289c4007bf2eb32bfc9cef66f956f8115ba5773/pipeline/bin/analysisNF_mixed_simulations_real_dataset.R#L41

grst commented 9 months ago

I think it's fine to pass these files as an additional input channel. Another common pattern is to use something like ${baseDir}/bin/utils.R to retrieve files relative to the workflow root.

The cleanest solution, of course, would be to make an R package with helper functions and install it into the container.

bernheder commented 9 months ago

Solved by using nextflow baseDir variable #29