Verified Commit a6ae64ae authored by Laurent Modolo's avatar Laurent Modolo
Browse files

cutadapt: nf file add file_id var for single-end like for paired

parent f9a6c22f
......@@ -41,33 +41,32 @@ process adaptor_removal {
* 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}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process adaptor_removal {
tag "$reads.baseName"
publishDir "results/fastq/adaptor_removal/", mode: 'copy'
tag "$file_id"
input:
file reads from fastq_files
set file_id, file(reads) from fastq_files
output:
file "*_cut.fastq.gz" into fastq_files_cut
set file_id, "*_cut.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
-o ${reads.baseName}_cut.fastq.gz \
${reads} > ${reads.baseName}_report.txt
-o ${file_id}_cut.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
/* quality trimming */
/*
......@@ -105,30 +104,28 @@ process trimming {
* 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}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process trimming {
tag "$reads.baseName"
publishDir "results/fastq/trimming/", mode: 'copy'
tag "$file_id"
input:
file reads from fastq_files
set file_id, file(reads) from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_trim
set file_id, "*_trim.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -q 20,20 \
-o ${reads.baseName}_trim.fastq.gz \
${reads} > ${reads.baseName}_report.txt
-o ${file_id}_trim.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
......@@ -3,22 +3,23 @@ log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process adaptor_removal {
tag "$reads.baseName"
tag "$file_id"
input:
file reads from fastq_files
set file_id, file(reads) from fastq_files
output:
file "*_cut.fastq.gz" into fastq_files_cut
set file_id, "*_cut.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
-o ${reads.baseName}_cut.fastq.gz \
${reads} > ${reads.baseName}_report.txt
-o ${file_id}_cut.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
......@@ -6,7 +6,7 @@ nextflow src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf \
nextflow src/nf_modules/cutadapt/tests/adaptor_removal_single.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
--fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
nextflow src/nf_modules/cutadapt/tests/trimming_paired.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
......@@ -16,4 +16,4 @@ nextflow src/nf_modules/cutadapt/tests/trimming_paired.nf \
nextflow src/nf_modules/cutadapt/tests/trimming_single.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
--fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
......@@ -3,22 +3,23 @@ log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process trimming {
tag "$reads.baseName"
tag "$file_id"
input:
file reads from fastq_files
set file_id, file(reads) from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_cut
set file_id, "*_trim.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -q 20,20 \
-o ${reads.baseName}_trim.fastq.gz \
${reads} > ${reads.baseName}_report.txt
-o ${file_id}_trim.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment