created by Sheila
on 2014-06-12
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!
-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).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
Please note:
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.
Updated on 2015-04-26
From ritamichelle on 2014-09-01
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!
From ritamichelle on 2014-09-02
Nevermind, link at the top of the page DOES work, I’ll try with this script…
From Geraldine_VdAuwera on 2014-09-02
OK – note that the BQSR script is fixed in the latest version, so you may want to simply upgrade your GATK version…
From vifehe on 2014-11-06
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 stack trace
org.broadinstitute.gatk.utils.R.RScriptExecutorException: RScript exited with 1 at org.broadinstitute.gatk.utils.R.RScriptExecutor.exec(RScriptExecutor.java:174) at org.broadinstitute.gatk.utils.recalibration.RecalUtils.generatePlots(RecalUtils.java:581) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.generatePlots(AnalyzeCovariates.java:386) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.initialize(AnalyzeCovariates.java:400) at org.broadinstitute.gatk.engine.executive.LinearMicroScheduler.execute(LinearMicroScheduler.java:83) at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:319) at org.broadinstitute.gatk.engine.CommandLineExecutable.execute(CommandLineExecutable.java:121) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:248) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:155) at org.broadinstitute.gatk.engine.CommandLineGATK.main(CommandLineGATK.java:107)
ERROR ------------------------------------------------------------------------------------------
ERROR A GATK RUNTIME ERROR has occurred (version 3.3-0-g37228af):
ERROR
ERROR This might be a bug. Please check the documentation guide to see if this is a known problem.
ERROR If not, please post the error message, with stack trace, to the GATK forum.
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR MESSAGE: RScript exited with 1
ERROR ------------------------------------------------------------------------------------------`
Could you provide me with some indications on how to preoceed to debug it?
Thanks
Victoria
From vifehe on 2014-11-06
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
From gwilymh on 2014-12-10
What exactly is the “original recalibration file” file?
From gwilymh on 2014-12-11
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?
From Geraldine_VdAuwera on 2014-12-12
The original recalibration file is the recal file produced in the very first pass of BaseRecalibrator.
From pkuyh on 2015-03-24
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 ------------------------------------------------------------------------------------------
ERROR stack trace
org.broadinstitute.gatk.utils.R.RScriptExecutorException: RScript exited with 1 at org.broadinstitute.gatk.utils.R.RScriptExecutor.exec(RScriptExecutor.java:174) at org.broadinstitute.gatk.utils.recalibration.RecalUtils.generatePlots(RecalUtils.java:581) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.generatePlots(AnalyzeCovariates.java:386) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.initialize(AnalyzeCovariates.java:400) at org.broadinstitute.gatk.engine.executive.LinearMicroScheduler.execute(LinearMicroScheduler.java:83) at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:319) at org.broadinstitute.gatk.engine.CommandLineExecutable.execute(CommandLineExecutable.java:121) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:248) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:155) at org.broadinstitute.gatk.engine.CommandLineGATK.main(CommandLineGATK.java:107)
ERROR ------------------------------------------------------------------------------------------
ERROR A GATK RUNTIME ERROR has occurred (version 3.3-0-g37228af):
ERROR
ERROR This might be a bug. Please check the documentation guide to see if this is a known problem.
ERROR If not, please post the error message, with stack trace, to the GATK forum.
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR MESSAGE: RScript exited with 1
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!
From pkuyh on 2015-03-24
@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 ------------------------------------------------------------------------------------------
ERROR stack trace
org.broadinstitute.gatk.utils.R.RScriptExecutorException: RScript exited with 1 at org.broadinstitute.gatk.utils.R.RScriptExecutor.exec(RScriptExecutor.java:174) at org.broadinstitute.gatk.utils.recalibration.RecalUtils.generatePlots(RecalUtils.java:581) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.generatePlots(AnalyzeCovariates.java:386) at org.broadinstitute.gatk.tools.walkers.bqsr.AnalyzeCovariates.initialize(AnalyzeCovariates.java:400) at org.broadinstitute.gatk.engine.executive.LinearMicroScheduler.execute(LinearMicroScheduler.java:83) at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:319) at org.broadinstitute.gatk.engine.CommandLineExecutable.execute(CommandLineExecutable.java:121) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:248) at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:155) at org.broadinstitute.gatk.engine.CommandLineGATK.main(CommandLineGATK.java:107)
ERROR ------------------------------------------------------------------------------------------
ERROR A GATK RUNTIME ERROR has occurred (version 3.3-0-g37228af):
ERROR
ERROR This might be a bug. Please check the documentation guide to see if this is a known problem.
ERROR If not, please post the error message, with stack trace, to the GATK forum.
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR MESSAGE: RScript exited with 1
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
From Sheila on 2015-03-24
@pkuyh
Hi,
Instructions for how to handle incompatibility are above (in this article).
-Sheila
From pkuyh on 2015-03-25
> @Sheila said:
> pkuyh
> Hi,
>
> Instructions for how to handle incompatibility are above (in this article).
>
> -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!
From Geraldine_VdAuwera on 2015-03-25
@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.
From alexey_larionov on 2015-03-29
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.
From aneek on 2015-06-17
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/recaldata.table\ -after H:/Documents/GenomeAnalysisTK-3.4-0/afterrecal.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:
ERROR MESSAGE: Unable to execute RScript command: Please add the Rscript directory to your environment ${PATH}
Since I have a very limited programming experience I am unable to solve the error. Can you suggest me how to do this?
From aneek on 2015-06-19
Any help to solve my problem mentioned above?
From Sheila on 2015-06-19
@aneek
Hi,
You need to add the directory where your RScript is stored to your path. You can google how to add something to a path.
-Sheila
From zweiwei on 2016-04-19
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
From Sheila on 2016-04-20
@zweiwei
Hi Weiwei,
Can you please post the exact commands you ran for each of the steps? Also, please confirm you are using the latest version of GATK.
Thanks,
Sheila
From saikat10MAy1995 on 2017-04-28
hello everyone I am facing the problem of R.RScriptExecutor
After reading about the error i have installed all the mentioned packages in the tutorial using sudo apt-get install r-cran-‘package-name’.
even after that I am getting the same error. any suggestion will be greatly appreciated. Thanks in advance.
From Sheila on 2017-05-04
@saikat10MAy1995
Hi,
Can you please post the exact command you are running and the version of GATK you are using? Please also post the entire log output with error message you get.
Thanks,
Sheila
From juancgvazquez on 2017-09-26
Hi, I’m having some trouble running this script. I generated recal_data.table and post_recal_data.table
Then, i ran GATK command: java -jar GenomeAnalysisTK.jar -T AnalyzeCovariates -R ref -before recal_data.table -after post_recal_data.table -plots recalibration_plots.pdf
But it ends with error code 1. I used -l and -csv, and tried using BQSR.R Rscript… in both cases (in gatk and in the Rscript), the error I get is the following one
>>>Rscript BQSR.R my-report.csv recal_data.table post_recal_data.table rtest.pdf
Attaching package: ‘gplots’
The following object is masked from ‘package:stats’:
lowess
Error in sort.list(y) : ‘x’ must be atomic for ‘sort.list‘
Have you called ‘sort’ on a list?
Calls: as.factor -> factor -> sort.list
Ejecución interrumpida
I have all packages installed… I’m a little newbie in this, in fact, i’ve just recently started to work in bioinformatics. I’m running this on a sample from a workshop from the University of Colorado, so maybe it’s an issue with the sample… but my guess is that the script should work even is the sample is not perfect… (I’m from Argentina so I don’t have real contact with the managers of the workshop, since it’s an on-site course)
From Sheila on 2017-09-28
@juancgvazquez
Hi,
Which versions of GATK and R are you using?
If you search the forum for “The following object is masked from ‘package:stats’:” you may find some helpful threads.
-Sheila