Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env nextflow
- nextflow.enable.dsl=2
- params.reads = "/mnt/scgc_nfs/lab/ggavelis/sandbox/sample_data/smallest_subset/*02_subseq_R{1,2}.fastq.gz"
- params.outdir = "results"
- Channel
- .fromFilePairs( params.reads, checkExists:true )
- .set{ read_ch }
- process fastqc {
- tag "FASTQC on $sample_id"
- publishDir params.outdir
- input:
- tuple val(sample_id), path(reads)
- output:
- val sample_id, emit: sample_id
- path reads, emit: reads
- shell:
- '''
- mkdir fastqc_!{sample_id}
- fastqc -o fastqc_!{sample_id} -f fastq -q !{reads}
- '''
- }
- process trimmomatic {
- tag "TRIMMOMATIC on $sample_id"
- publishDir params.outdir
- input:
- val(sample_id)
- path(reads)
- output:
- val sample_id, emit: sample_id
- path "${sample_id}_trimmed_R1.fastq.gz", emit: trimmed_R1_paired
- path "${sample_id}_trimmed_R2.fastq.gz", emit: trimmed_R2_paired
- shell:
- '''
- trimmomatic \
- PE \
- -phred33 \
- -threads !{task.cpus} \
- !{reads} \
- !{sample_id}_trimmed_R1.fastq.gz \
- !{sample_id}_orphan_R1.fastq.gz \
- !{sample_id}_trimmed_R2.fastq.gz \
- !{sample_id}_orphan_R2.fastq.gz \
- LEADING:0 TRAILING:5 SLIDINGWINDOW:4:15 MINLEN:36
- '''
- }
- process bbmerge {
- tag "MERGING on $sample_id"
- publishDir params.outdir
- module 'singularity/3.8.0'
- cache 'lenient'
- cpus 4
- input:
- val(sample_id)
- path(trimmed_R1_paired)
- path(trimmed_R2_paired)
- output:
- path "${sample_id}_merged.fastq", emit: merged
- shell:
- '''
- reformat.sh in1=!{trimmed_R1_paired} in2=!{trimmed_R2_paired} out=!{sample_id}_merged.fastq
- '''
- }
- workflow {
- fastqc(read_ch)
- trimmomatic(fastqc.output.sample_id, fastqc.output.reads)
- bbmerge(fastqc.output.sample_id, trimmomatic.output.trimmed_R1_paired, trimmomatic.output.trimmed_R2_paired)
- }
Advertisement
Add Comment
Please, Sign In to add comment