Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VariantRecalibrator R-script fails if scales v1.3.0 is installed #8664

Open
1 of 2 tasks
MikkelSchubert opened this issue Jan 23, 2024 · 6 comments
Open
1 of 2 tasks
Labels

Comments

@MikkelSchubert
Copy link

Bug Report

Affected tool(s) or class(es)

VariantRecalibrator

Affected version(s)

  • Latest public release version [4.5.0.0]
  • Latest master branch as of [date of test?]

Description

As of v1.3.0 the scales R package turns the use of deprecated values for the space parameter into a hard error, resulting in the VariantRecalibrator R-script terminating with the following message:

The space argument of pal_gradient_n() only supports be "Lab" as of scales 0.3.0.

This parameter is used repeatedly in the generated R-script via

scale_fill_gradient(high="green", low="red", space="rgb")

Steps to reproduce

$ R --version
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
$ rm -rf ~/R
$ R
> install.packages("ggplot2", repos="https://cloud.r-project.org/")
> packageVersion("scales")
[1] ‘1.3.0’
> quit()
$ gatk --version
The Genome Analysis Toolkit (GATK) v4.5.0.0
HTSJDK Version: 4.1.0
Picard Version: 3.1.1
$ gatk VariantRecalibrator  [arguments omitted for brevity]
org.broadinstitute.hellbender.utils.R.RScriptExecutorException: 
Rscript exited with 1
Command Line: Rscript -e tempLibDir = '/tmp/Rlib.9339186078473502558';source('/path/to/rscript.r');
Stdout: 
Stderr: Error:
! The `space` argument of `pal_gradient_n()` only supports be "Lab" as
  of scales 0.3.0.
Backtrace:

  1. ├─base::source("/path/to/rscript.r")
  2. │ ├─base::withVisible(eval(ei, envir))
  3. │ └─base::eval(ei, envir)
  4. │   └─base::eval(ei, envir)
  5. └─ggplot2::scale_fill_gradient(high = "green", low = "red", space = "rgb")
  6.   ├─ggplot2::continuous_scale(...)
  7.   │ └─ggplot2::ggproto(...)
  8.   │   └─rlang::list2(...)
  9.   └─scales::seq_gradient_pal(low, high, space)
 10.     └─scales::pal_gradient_n(c(low, high), space = space)
 11.       └─lifecycle::deprecate_stop("0.3.0", "pal_gradient_n(space = 'only supports be \"Lab\"')")
 12.         └─lifecycle:::deprecate_stop0(msg)
 13.           └─rlang::cnd_signal(...)
Execution halted
$ R
> install.packages("remotes", repos="https://cloud.r-project.org/")
> library(remotes)
> install_version("scales", version="1.2.1", repos="https://cloud.r-project.org/")
> packageVersion("scales")
[1] ‘1.2.1’
> quit()
$ gatk VariantRecalibrator [arguments omitted for brevity]
$

Expected behavior

The output rscript file is used to generate a PDF.

Actual behavior

Generation of the PDF fails due to an deprecation in the scales library causing the Rscript command to abort.

@lbergelson lbergelson added the bug label Feb 8, 2024
@lbergelson
Copy link
Member

Looks like we need to update our Rscripts... thanks for the report!

@wanqiangdehuoguo
Copy link

Hi, i face the same bug.

Could you tell me which version ggplot2 can be used or how many times you can fix this problem?

tahanks!

@gokalpcelik
Copy link
Contributor

R version 3.6 and compatible ggplot2 is needed. Compatible versions are listed in the gatkcondaenv.yml

# core R dependencies; these should only be used for plotting and do not take precedence over core python dependencies!
- r-base=3.6.2
- r-data.table=1.12.8
- r-dplyr=0.8.5
- r-getopt=1.20.3
- r-ggplot2=3.3.0
- r-gplots=3.0.3
- r-gsalib=2.1
- r-optparse=1.6.4
- r-backports=1.1.10

@Lotteaveline
Copy link

Lotteaveline commented Apr 10, 2024

Hi, I also face this problem:

Runtime.totalMemory()=8598323200`
org.broadinstitute.hellbender.utils.R.RScriptExecutorException: 
Rscript exited with 1
Command Line: Rscript -e tempLibDir = '/tmp/Rlib.3561179774649616878';source('/mnt/filename.snps.plots.R');
Stdout: 
Stderr: Error:
! The `space` argument of `pal_gradient_n()` only supports be "Lab" as
  of scales 0.3.0.
Backtrace:
     ▆
  1. ├─base::source("/mnt/filename.snps.plots.R")
  2. │ ├─base::withVisible(eval(ei, envir))
  3. │ └─base::eval(ei, envir)
  4. │   └─base::eval(ei, envir)
  5. └─ggplot2::scale_fill_gradient(high = "green", low = "red", space = "rgb")
  6.   ├─ggplot2::continuous_scale(...)
  7.   │ └─ggplot2::ggproto(...)
  8.   │   └─rlang::list2(...)
  9.   └─scales::pal_seq_gradient(low, high, space)
 10.     └─scales::pal_gradient_n(c(low, high), space = space)
 11.       └─lifecycle::deprecate_stop("0.3.0", "pal_gradient_n(space = 'only supports be \"Lab\"')")
 12.         └─lifecycle:::deprecate_stop0(msg)
 13.           └─rlang::cnd_signal(...)
Execution halted

My versions of R and packages are
R = 4.2.3
ggplot2 = 3.5.0

Did you already find a solution to this problem?

Thanks!

@gokalpcelik
Copy link
Contributor

Hi @Lotteaveline
Recent versions of R and libraries are known to have issues therefore our suggestion is to stick with the versions recommended in the list above.

@Lotteaveline
Copy link

Okay thank you for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants