diff --git a/src/nf_modules/cutadapt/cutadapt.nf b/src/nf_modules/cutadapt/cutadapt.nf new file mode 100644 index 0000000000000000000000000000000000000000..7273441c34f925679120b908dfd7a73eec4b3ba6 --- /dev/null +++ b/src/nf_modules/cutadapt/cutadapt.nf @@ -0,0 +1,67 @@ +/* +* cutadapt : +* Imputs : fastq files +*/ + +/* Illumina adaptor removal + +/* +* for paired-end data +*/ + +params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" + +log.info "fastq files : ${params.fastq}" + +Channel + .fromFilePairs( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process adaptor_removal { + tag "$pair_id" + + input: + set pair_id, file(reads) from fastq_files + + output: + set "*_cut_R{1,2}.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \ + -o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \ + ${reads[0]} ${reads[1]} > ${pair_id}_report.txt + """ +} + +/* +* for single-end data +*/ + +params.fastq = "$baseDir/data/fastq/*.fastq" + +log.info "fastq files : ${params.fastq}" + +Channel + .fromPath( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process adaptor_removal { + tag "$reads.baseName" + + input: + file reads from fastq_files + + output: + file "*_cut.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\ + -o ${reads.baseName}_cut.fastq.gz \ + ${reads} > ${reads.baseName}_report.txt + """ +} +