The current GATK version is 3.7-0
Examples: Monday, today, last week, Mar 26, 3/26/04

Howdy, Stranger!

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

Get notifications!


You can opt in to receive email notifications, for example when your questions get answered or when there are new announcements, by following the instructions given here.

Formatting tip!


Wrap blocks of code, error messages and BAM/VCF snippets--especially content with hashes (#)--with lines with three backticks ( ``` ) each to make a code block as demonstrated here.

Jump to another community
Picard 2.10.2 is now available at https://github.com/broadinstitute/picard/releases.
GATK version 4.beta.2 (i.e. the second beta release) is out. See the GATK4 BETA page for download and details.

AnalyzeCovariates fails with error message "RScript exited with 1"

SheilaSheila Broad InstituteMember, Broadie, Moderator
edited April 2015 in Solutions to Problems

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

Please note:

  • 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

Comments

  • 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!

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

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie

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

  • vifehevifehe SpainMember

    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

  • vifehevifehe SpainMember

    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

  • What exactly is the "original recalibration file" file?

  • 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?

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie

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

  • pkuyhpkuyh pkuMember

    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!

  • pkuyhpkuyh pkuMember

    @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

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @pkuyh
    Hi,

    Instructions for how to handle incompatibility are above (in this article).

    -Sheila

  • pkuyhpkuyh pkuMember

    @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!

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie

    @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.

  • 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.

  • aneekaneek Member

    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:

    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?

  • aneekaneek Member

    Any help to solve my problem mentioned above?

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @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

  • 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

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @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

  • 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.

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @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

Sign In or Register to comment.