GATK licensing moves to direct-through-Broad model -- read about it on the GATK blog

AnalyzeCovariates fails with error message "RScript exited with 1"

SheilaSheila Broad InstitutePosts: 1,241Member, GATK Dev, Broadie, Moderator, DSDE Member admin
edited April 26 in Common 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

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

  • ritamichelleritamichelle IndianaPosts: 5Member

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

  • Geraldine_VdAuweraGeraldine_VdAuwera Posts: 7,781Administrator, GATK Dev admin

    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

  • vifehevifehe SpainPosts: 27Member

    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 SpainPosts: 27Member

    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

  • gwilymhgwilymh Posts: 20Member

    What exactly is the "original recalibration file" file?

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

  • Geraldine_VdAuweraGeraldine_VdAuwera Posts: 7,781Administrator, GATK Dev admin

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

    Geraldine Van der Auwera, PhD

  • pkuyhpkuyh 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 ------------------------------------------------------------------------------------------
    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 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 ------------------------------------------------------------------------------------------
    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 InstitutePosts: 1,241Member, GATK Dev, Broadie, Moderator, DSDE Member admin

    @pkuyh
    Hi,

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

    -Sheila

  • pkuyhpkuyh pkuPosts: 5Member

    @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 Posts: 7,781Administrator, GATK Dev admin

    @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

  • alexey_larionovalexey_larionov UKPosts: 4Member

    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.

Sign In or Register to comment.