Fastqc in nextflow run only one pair of fastq.gz file and not on all Fastq files
1
1
Entering edit mode
14 months ago

Hi Everyone!!

I a new to nextflow and was trying to make a FASTQC workflow script. The script run fine on a Pair of FASTQ files, however, it doesn't loop over all the FASTQ files. What could be possibly wrong.

## I ran using the following command
nextflow run 01_fastqc.nf --raw 'data/*R{1,2}_001.fastq.gz'

01_fastqc.nf contains

nextflow.enable.dsl=2
params.raw = "data/*{1,2}.fastq.gz"
params.outdir="results/01_rawfastqc"
process FASTQC {
    publishDir "$params.outdir"
    input:
    tuple val(sample_id), path(reads)
    output:
    tuple val(sample_id), path("fastqc_out")
    script:
    """
    mkdir fastqc_out
    fastqc -t 10 -o fastqc_out ${reads[0]} ${reads[1]}
    multiqc -f fastqc_out -o fastqc_out/
    """
}

reads_ch = Channel.fromFilePairs(params.raw, checkIfExists: true )

workflow {
  FASTQC(reads_ch)
}
nextflow fastqc • 1.6k views
ADD COMMENT
0
Entering edit mode
14 months ago
ATpoint 77k

Use:

output:
    path("fastqc_out/*")

I think the issue is that the declared output: is only the folder itself but not any files so the wildcard will add that the files get published, but don't ask me why without the wildcard one of two samples makes it into the output folder. The Nextflow gurus might know. Not sure if wildcard alone is bad practice as I did it. You could more strictly use fastqc_out/${sample_id}*, that works as well.

ADD COMMENT
1
Entering edit mode

I made some amends. I am still skeptical as to what changed but the following code works now. I think fastqc directory was getting overwrite again and again.

nextflow.enable.dsl=2
params.raw = "data/*{1,2}.fastq.gz"
params.outdir="results/01_rawfastqc"
process FASTQC {
        publishDir "$params.outdir"
        input:
        tuple val(sample_id), path(reads)
        output:
        file("*.{html,zip}")
        script:
        """
        fastqc -t 10 ${reads[0]} ${reads[1]}
        """
}


reads_ch = Channel.fromFilePairs(params.raw, checkIfExists: true )

workflow {
  FASTQC(reads_ch)
}
ADD REPLY
1
Entering edit mode

Ah, yes overwriting issue, good catch!

ADD REPLY

Login before adding your answer.

Traffic: 1143 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6