UCSF-Costello-Lab / LG3_Pipeline

The original LG3 pipeline
https://github.com/UCSF-Costello-Lab/LG3_Pipeline
0 stars 0 forks source link

lg3 run Recall: Rscript sources user's ~/.Rprofile, if it exists #165

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 2 years ago

Issue

If user's ~/.Rprofile outputs a message, e.g.

tryCatch(startup::startup(), error = function(ex) {
  message(sprintf(".Rprofile error [%s: %s]: %s", getwd(),
          paste(commandArgs(), collapse=" "), conditionMessage(ex)))
})

then the lg3 run Recal step may produce ERROR messages like:

[QC] Collect multiple QC metrics...
ERROR   2021-10-10 15:31:31     ProcessExecutor .Rprofile error [/scratch/henrik/272904/Patient157t10: /software/c4/cbi/software/R-3.2.0/lib64/R/bin/exec/R --slave --no-restore --file=/scratch/henrik/272904/Patient157t10_tmp/script950017900911081024.R --args /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.quality_distribution_metrics /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.quality_distribution.pdf Z00599t10.bwa.realigned.rmDups.recal.bam]: there is no package called ‘startup’
ERROR   2021-10-10 15:31:31     ProcessExecutor .Rprofile error [/scratch/henrik/272904/Patient157t10: /software/c4/cbi/software/R-3.2.0/lib64/R/bin/exec/R --slave --no-restore --file=/scratch/henrik/272904/Patient157t10_tmp/script5599902869699947779.R --args /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.insert_size_metrics /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.insert_size_histogram.pdf Z00599t10.bwa.realigned.rmDups.recal.bam 1123]: there is no package called ‘startup’
ERROR   2021-10-10 15:31:31     ProcessExecutor .Rprofile error [/scratch/henrik/272904/Patient157t10: /software/c4/cbi/software/R-3.2.0/lib64/R/bin/exec/R --slave --no-restore --file=/scratch/henrik/272904/Patient157t10_tmp/script693414331316107328.R --args /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.quality_by_cycle_metrics /scratch/henrik/272904/Patient157t10/Z00599t10.bwa.realigned.rmDups.recal.quality_by_cycle.pdf Z00599t10.bwa.realigned.rmDups.recal.bam]: there is no package called ‘startup’

Troubleshooting

This is outputted by:

https://github.com/UCSF-Costello-Lab/LG3_Pipeline/blob/5458c612d696ff7a46ef6abca750d822f01a5c4b/scripts/Recal.sh#L289-L302

where PICARD_MULTIMETRICS=${PICARD_HOME}/CollectMultipleMetrics.jar. In other words, we don't have control of the Rscript ... system calls, so we cannot rewrite it to use Rscript --vanilla ....

Suggestion

An alternative might be to set environment R_PROFILE_USER=NULL before the above call to Picard. That should tell R to skip any .Rprofile files. Alternatively, we could create an empty ./.Rprofile file, which then should trump ~/.Rprofile.

HenrikBengtsson commented 2 years ago

Fixed.