Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Rscript in Nextflow pipeline

Tags:

r

nextflow

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

    """
}
like image 391
Shikan Avatar asked Dec 20 '25 08:12

Shikan


1 Answers

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

process fingerprint_plot {
    conda 'r-ggplot2'
    // ...
like image 57
Timur Shtatland Avatar answered Dec 22 '25 22:12

Timur Shtatland



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!