2
$\begingroup$

This question has been asked and answered on Stack Overflow

I'm new to nextflow, channel, process. Kindly bear with me. I'd like to create a pipeline, pass paired reads from one to another process. I am unable to do it.

script1.nf

params.outdir = 'results'

params.reads1 = "/Users/user/Downloads/tiny/normal/*_R1_xxx.fastq.gz"

params.reads2 = "/Users/user/Downloads/tiny/normal/*_R2_xxx.fastq.gz"

println "reads: $params.reads1"

println "reads: $params.reads2"

Channel.fromPath(params.reads1,checkIfExists: true).view()

Channel.fromPath(params.reads2,checkIfExists: true).view()

include { fastp } from '/Users/name/Documents/name/nextflow_scripts/fastp.nf'


fqpairs_ch=channel.fromFilePairs('/Users/name/Downloads/tiny/normal/*_R{1,2}_xxx.fastq.gz')


process check {

    output: 
    stdout


    """ 
    echo "hello from command line \n"

    """

}

workflow {

    check().view(). /// this works

    fastp(fqpairs_ch).view() // it gives error

}
 

fastp.nf

params.outdir = "./results"

process fastp() {

tag "fastp on $sample_id"


input:
        tuple val(sample_id), file(x), file(x1) from fqpairs_ch


output:
println ("$sample_id")


    script:

    """ 

mkdir fastp_trimmed

        fastp \
        --correction \
    --cut_tail \
    --disable_trim_poly_g \
    --length_required 50 \
    --qualified_quality_phred 20 \
    --thread 12 \
    --trim_poly_x \
    --unqualified_percent_limit 20 \
        -i ${x[0]} -I ${x[1]} \
        -o fastp_trimmed/joinedfiles.dat_${x[0]} -O fastp_trimmed/joinedfiles.dat_${x[1]} 

    """

}

Error:

ERROR ~ No such variable: fqpairs_ch

-- Check script 'fastp.nf' at line: 13 or see '.nextflow.log' file for more details

I'm unable to wrap by head around tag, val. Also, it is difficult for me to understand how to pass variable from one script to another. I've watched Youtube tutorial but with limited success.

$\endgroup$
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.