3

I'm trying to run a Rscript in Nextflow pipeline. This Rscript has a package "ggolot2".

I have this error:

Error in library(ggplot2): there is no package called "ggplot2", Execution halted.

Why do I get that error?

Here's the code:

process fingerprint_plot {

    publishDir "${params.outdir}/fingerprint_plot", mode: 'copy'

    input:
    set val(sample_id), file(samples) from sample_cov_ch
    set val(control_id), file(controls) from control_cov_ch.collect()

    output:
    file("${sample_id}.fingerprint.pdf") into fingerprint_plot_ch

    script:
    """

    Rscript /mnt/Data/cut_and_tag/cut_tag_fingerprint_cmd.R --args ${controls} ${control_id} ${samples} ${sample_id} ${sample_id}.fingerprint.pdf

    """
}
Stidgeon
  • 2,673
  • 8
  • 20
  • 28
Shikan
  • 93
  • 6
  • The library "ggplot2" is missing from your execution environment. Like @TimurShtatland suggested, you'll need to add `r-ggplot2` to your list of Conda dependencies: https://stackoverflow.com/a/66782501/751863 – Steve Mar 29 '21 at 00:41

1 Answers1

1

Possibly, ggplot2 is not installed. You can have Nextflow install it via conda like so:

process fingerprint_plot {
    conda 'r-ggplot2'
    // ...
Timur Shtatland
  • 12,024
  • 2
  • 30
  • 47