AnalyzeCovariates fails with error message "RScript exited with 1"
When you run AnalyzeCovariates to analyze your BQSR outputs, you may encounter an error starting with this line:
org.broadinstitute.sting.utils.R.RScriptExecutorException: RScript exited with 1. Run with -l DEBUG for more info.
The main reason why this error often occurs is simple, and so is the solution. The script depends on some external R libraries, so if you don't have them installed, the script fails. To find out what libraries are necessary and how to install them, you can refer to this tutorial.
One other common issue is that the version of ggplot2 you have installed is very recent and is not compatible with the BQSR script. If so, download this Rscript file and use it to generate the plots manually according to the instructions below.
If you have already checked that you have all the necessary libraries installed, you'll need to run the script manually in order to find out what is wrong. To new users, this can seem complicated, but it only takes these 3 simple steps to do it!
1. Re-run AnalyzeCovariates with these additional parameters:
-l DEBUG(that's a lowercase L, not an uppercase i, to be clear) and
-csv my-report.csv(where you can call the .csv file anything; this is so the intermediate csv file will be saved).
2. Identify the lines in the log output that says what parameters the RScript is given.
The snippet below shows you the components of the R script command line that AnalyzeCovariates uses.
INFO 18:04:55,355 AnalyzeCovariates - Generating plots file 'RTest.pdf' DEBUG 18:04:55,672 RecalUtils - R command line: Rscript (resource)org/broadinstitute/gatk/utils/recalibration/BQSR.R /Users/schandra/BQSR_Testing/RTest.csv /Users/schandra/BQSR_Testing/RTest.recal /Users/schandra/BQSR_Testing/RTest.pdf DEBUG 18:04:55,687 RScriptExecutor - Executing: DEBUG 18:04:55,688 RScriptExecutor - Rscript DEBUG 18:04:55,688 RScriptExecutor - -e DEBUG 18:04:55,688 RScriptExecutor - tempLibDir = '/var/folders/j9/5qgr3mvj0590pd2yb9hwc15454pxz0/T/Rlib.2085451458391709180';source('/var/folders/j9/5qgr3mvj0590pd2yb9hwc15454pxz0/T/BQSR.761775214345441497.R'); DEBUG 18:04:55,689 RScriptExecutor - /Users/schandra/BQSR_Testing/RTest.csv DEBUG 18:04:55,689 RScriptExecutor - /Users/schandra/BQSR_Testing/RTest.recal DEBUG 18:04:55,689 RScriptExecutor - /Users/schandra/BQSR_Testing/RTest.pdf
So, your full command line will be:
RScript BQSR.R RTest.csv RTest.recal RTest.pdf
- BQSR.R is the name of the script you want to run. It can be found here
- RTest.csv is the name of the original csv file output from AnalyzeCovariates.
- RTest.recal is your original recalibration file.
- RTest.pdf is the output pdf file; you can name it whatever you want.
3. Run the script manually with the above arguments.
For new users, the easiest way to do this is to do it from within an IDE program like RStudio. Or, you can start up R at the command line and run it that way, whatever you are comfortable with.