The current GATK version is 3.5-0

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

AnalyzeCovariates fails with error message "RScript exited with 1"

edited April 2015

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.

Post edited by Geraldine_VdAuwera on
Tagged:

• IndianaPosts: 5Member

Hi GATK! Would it be possible for you to post an updated link to the BQSR.R script? The link above is no longer working. I spent awhile poking around GitHub looking for it, but seemed to just be going in circles. Best wishes!

• IndianaPosts: 5Member

Nevermind, link at the top of the page DOES work, I'll try with this script...

OK - note that the BQSR script is fixed in the latest version, so you may want to simply upgrade your GATK version...

Geraldine Van der Auwera, PhD

• SpainPosts: 35Member

HI Geraldine!

I am having some issues with debugging AnalyzeCovariates.
here is my command line:
java -Xmx5g -jar /opt/exoma/bin//GATK-v3.3/GenomeAnalysisTK.jar -T AnalyzeCovariates -R reference_files/hg19/ucsc.hg19.fasta -before Bonn_recal_1/recal_1005.table -after Bonn_recal_1/post_recal_1005.table -plots Bonn_recal_1/recalibration_1005.pdf -l DEBUG -csv Bonn_recal_1/my_debug_report.csv

and this is the error I get:

##### ERROR ------------------------------------------------------------------------------------------

ERROR ------------------------------------------------------------------------------------------

Could you provide me with some indications on how to preoceed to debug it?

Thanks

Victoria

• SpainPosts: 35Member

So I figured out what was wrong while reading the log file, right after the R scipt command line that AnalyzeCovariates uses, I got:

Loading required package: methods
Error in library(gplots) : there is no package called \u2018gplots\u2019
Calls: source -> withVisible -> eval -> eval -> library

So I installed in R gplots.
Then I got again another R-related error in the same area:

Error in library("reshape") : there is no package called \u2018reshape\u2019
Calls: source -> withVisible -> eval -> eval -> library
Execution halted

and after installing in R reshape it now runs smoothly

Victoria

• Posts: 20Member

What exactly is the "original recalibration file" file?

• Posts: 20Member

Is it one or more graph files? Is it one of the table files? If you are comparing the results of three different recalibration runs, can you enter more than one file?

The original recalibration file is the recal file produced in the very first pass of BaseRecalibrator.

Geraldine Van der Auwera, PhD

• pkuPosts: 5Member

hi there!
i have met this error when i used AnalyzeCovariates to analyze the output.
so i re-run with the parameters "-l DEBUG" and "-csv my-report.csv " the feedback as below

ERROR ------------------------------------------------------------------------------------------

then i found out this info in the feedback "Error in library("ggplot2") : there is no package called ‘ggplot2’ Calls: source -> withVisible -> eval -> eval -> library"

i thought it might be something wrong in the installation， so i reinstalled the package.
then i ran with this command line"RScript BQSR.R RTest.csv RTest.recal RTest.pdf" (which the BQSR.R was offered by you)
it exited with "Error in library("ggplot2") : there is no package called ‘ggplot2’ Execution halted"

now i'am kind of confused. Is it still caused by the incompatibility of the version of ggplot2 and the BQSR script ?
And how can i fix this problem?

thx!

• pkuPosts: 5Member

@pkuyh said:
hi there!
i have met this error when i used AnalyzeCovariates to analyze the output.
so i re-run with the parameters "-l DEBUG" and "-csv my-report.csv " the feedback as below

ERROR ------------------------------------------------------------------------------------------

then i found out this info in the feedback "Error in library("ggplot2") : there is no package called ‘ggplot2’ Calls: source -> withVisible -> eval -> eval -> library"

i thought it might be something wrong in the installation， so i reinstalled the package.
then i ran with this command line"RScript BQSR.R RTest.csv RTest.recal RTest.pdf" (which the BQSR.R was offered by you)
it exited with "Error in library("ggplot2") : there is no package called ‘ggplot2’ Execution halted"

now i'am kind of confused. Is it still caused by the incompatibility of the version of ggplot2 and the BQSR script ?
And how can i fix this problem?

thx!

@Geraldine_VdAuwera

@pkuyh
Hi,

-Sheila

• pkuPosts: 5Member

@Sheila said:
pkuyh
Hi,

-Sheila

hi @Sheila

i have tried the 3 steps in this article, it didn't work out.
i used the BQSR.R you offered to run the Rscript command manually while it exited with "Error in library("ggplot2") : there is no package called ‘ggplot2’ Execution halted"

So can u plz point out what have I missed.
thx!

@pkuyh Anytime you get an error in R that says something like "there is no package called ‘ggplot2’", this tells you that you need to install the library. If you're not familiar with how to do this I recommend you look up some R tutorials, you will find it useful.

Geraldine Van der Auwera, PhD

• UKPosts: 18Member

The R script, which is used for graphs generation in AnalyzeCovariates requires 6 libraries:

library("ggplot2")
library("gplots")
library("reshape")
library("grid")
library("tools")
library("gsalib")

At least 4 of them (ggplot2, gplots, reshape and gsalib) are not included by default into current R distribution.
To install these libraries one can start R and type:

install.packages("ggplot2")
install.packages("gplots")
install.packages("reshape")
install.packages("gsalib")

However, depending on R configuration, this may require administrative privileges.

• Posts: 65Member

Hi, I have used the following commands to generate the recalibration plots:

java -jar H:/Documents/GenomeAnalysisTK-3.4-0/GenomeAnalysisTK.jar\
-T AnalyzeCovariates\
-R H:/Documents/GenomeAnalysisTK-3.4-0/hg19.fa\
-before H:/Documents/GenomeAnalysisTK-3.4-0/recal_data.table\
-after H:/Documents/GenomeAnalysisTK-3.4-0/after_recal.table\
-plots H:/Documents/GenomeAnalysisTK-3.4-0/recal_plots.pdf\
-l DEBUG\
-csv H:/Documents/GenomeAnalysisTK-3.4-0/my-report.csv

and I am getting error messages as follows:

Since I have a very limited programming experience I am unable to solve the error. Can you suggest me how to do this?

• Posts: 65Member

Any help to solve my problem mentioned above?

@aneek
Hi,

-Sheila

• Posts: 1Member

Hey,

I did
step1: I used BaseRecalibrator to create recal_data.1.table
step 2:I used PrintREads to crate recalibrated.bam. Confirmation question: this bam file is the recalibrated bam I will use for variant calling later, correct?
step 3:I used BaseRecalibrator and recal_data.1.table to make recal_data2.table
step 4:I used AnalyzeCovariates, recal_data.1.table and recal_data.2.table to generate BQSR.csv and BQSR.pdf.

Then I had the "RScript exited with 1" problem in step 4. I ran the script manually with the 3 arguments in BQSR.R by using recal_data1.table and I can create the pink and blue figures successfully. My question is what about recal_data2.table? Is it useless if I ran the scripts manually?

Thanks.

Weiwei