diff --git a/src/nf_modules/bedtools/main.nf b/src/nf_modules/bedtools/main.nf index 4d3e4e1f99fa58aaab58ee9fdec0d6caf4aa30f8..bd4a1890040e57fb996c3c6ffbd45f7a3f9d5d70 100644 --- a/src/nf_modules/bedtools/main.nf +++ b/src/nf_modules/bedtools/main.nf @@ -12,7 +12,7 @@ process fasta_from_bed { path bed output: - path "*_extracted.fasta", emit: fasta + tuple val(bed.baseName), path("*_extracted.fasta"), emit: fasta script: """ @@ -50,7 +50,7 @@ process bam_to_fastq_pairedend { tuple val(bam_id), path(bam) output: - tuple val(bam.baseName), path("*.fastq"), emit: fastq + tuple val(bam_id), path("*.fastq"), emit: fastq script: """ diff --git a/src/nf_modules/bowtie2/main.nf b/src/nf_modules/bowtie2/main.nf index e17e7f2448e1c15271fad4aa9f1e954eae2498bc..22465baef0cf8fa73cccff0a431afc93f1956c79 100644 --- a/src/nf_modules/bowtie2/main.nf +++ b/src/nf_modules/bowtie2/main.nf @@ -78,8 +78,8 @@ process mapping_fastq_singleend { tuple val(file_id), path(reads) output: - set file_id, "*.bam", emit: bam - file "*_report.txt", emit: report + tuple val(file_id), path("*.bam"), emit: bam + path "*_report.txt", emit: report script: index_id = index[0] @@ -93,13 +93,13 @@ bowtie2 --very-sensitive \ -p ${task.cpus} \ -x ${index_id} \ -U ${reads} 2> \ - ${file_id}_bowtie2_mapping_report_tmp.txt | \ - samtools view -Sb - > ${file_id}.bam + ${reads.baseName}_bowtie2_mapping_report_tmp.txt | \ + samtools view -Sb - > ${reads.baseName}.bam -if grep -q "Error" ${file_id}_bowtie2_mapping_report_tmp.txt; then +if grep -q "Error" ${reads.baseName}_bowtie2_mapping_report_tmp.txt; then exit 1 fi -tail -n 19 ${file_id}_bowtie2_mapping_report_tmp.txt > \ - ${file_id}_bowtie2_mapping_report.txt +tail -n 19 ${reads.baseName}_bowtie2_mapping_report_tmp.txt > \ + ${reads.baseName}_bowtie2_mapping_report.txt """ } diff --git a/src/nf_modules/deeptools/main.nf b/src/nf_modules/deeptools/main.nf index ba2be7c5dc08bfc4b6d2b9342e21e116cc1c2eed..3d0127967d6dfdb17f31f79602eb2133a09e3fd9 100644 --- a/src/nf_modules/deeptools/main.nf +++ b/src/nf_modules/deeptools/main.nf @@ -33,7 +33,8 @@ process bam_to_bigwig { script: """ -bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} -o ${file_id}.bw +bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} \ + -o ${bam.simpleName}.bw """ } @@ -57,7 +58,7 @@ computeMatrix scale-regions -S ${bw} \ -R ${bed} \ --beforeRegionStartLength 100 \ --afterRegionStartLength 100 \ - -o ${bed_file_id}.mat.gz + -o ${bed.simpleName}.mat.gz """ } @@ -81,7 +82,7 @@ https://deeptools.readthedocs.io/en/develop/content/tools/plotProfile.html """ plotProfile -m ${matrix} \ --plotFileFormat=pdf \ - -out ${file_id}.pdf \ + -out ${matrix.simpleName}.pdf \ --plotType=fill \ --perGroup \ --plotTitle "${params.title}" diff --git a/src/nf_modules/kallisto/main.nf b/src/nf_modules/kallisto/main.nf index 5b0a150f210fb4d8451eaf7715bb14779ea2c277..0517a1b54f2106c1ce64bfcb805b368d0424db67 100644 --- a/src/nf_modules/kallisto/main.nf +++ b/src/nf_modules/kallisto/main.nf @@ -57,7 +57,7 @@ process mapping_fastq_singleend { tuple val(file_id), path(reads) output: - path "${pair_id}", emit: counts + tuple val(file_id), path("${pair_id}"), emit: counts path "*_report.txt", emit: report script: @@ -66,6 +66,6 @@ mkdir ${file_id} kallisto quant -i ${index} -t ${task.cpus} --single \ --bias --bootstrap-samples 100 -o ${file_id} \ -l ${params.mean} -s ${params.sd} \ -${reads} &> ${file_id}_kallisto_mapping_report.txt +${reads} &> ${reads.simpleName}_kallisto_mapping_report.txt """ } diff --git a/src/nf_modules/macs2/main.nf b/src/nf_modules/macs2/main.nf index 9748cdc643b31e8207e579ff8e84353b3724aaba..e30e0ee241640abc357d716ec5288ba0eba1a934 100644 --- a/src/nf_modules/macs2/main.nf +++ b/src/nf_modules/macs2/main.nf @@ -22,11 +22,11 @@ macs2 callpeak \ --call-summits "True"\ --control ${file_control} \ --keep-dup "auto" \ - --name ${file_id} \ + --name ${bam_ip.simpleName} \ --gsize ${params.genome_size} 2> \ - ${file_ip}_macs2_report.txt + ${bam_ip.simpleName}_macs2_report.txt -if grep -q "ERROR" ${file_ip}_macs2_report.txt; then +if grep -q "ERROR" ${bam_ip.simpleName}_macs2_report.txt; then echo "MACS2 error" exit 1 fi diff --git a/src/nf_modules/sambamba/main.nf b/src/nf_modules/sambamba/main.nf index eb9bbb462fe6048e9aa52b4f1615d624e505d41a..e07210bb98312e6ac52db4d8a59462df7bf5b738 100644 --- a/src/nf_modules/sambamba/main.nf +++ b/src/nf_modules/sambamba/main.nf @@ -31,7 +31,7 @@ process sort_bam { script: """ -sambamba sort -t ${task.cpus} -o ${file_id}_sorted.bam ${bam} +sambamba sort -t ${task.cpus} -o ${bam.baseName}_sorted.bam ${bam} """ } @@ -49,7 +49,9 @@ process split_bam { tuple val(file_id), path("*_reverse.bam*"), emit: bam_reverse script: """ -sambamba view -t ${task.cpus} -h -F "strand == '+'" ${bam} > ${file_id}_forward.bam -sambamba view -t ${task.cpus} -h -F "strand == '-'" ${bam} > ${file_id}_reverse.bam +sambamba view -t ${task.cpus} -h -F "strand == '+'" ${bam} > \ + ${bam.baseName}_forward.bam +sambamba view -t ${task.cpus} -h -F "strand == '-'" ${bam} > \ + ${bam.baseName}_reverse.bam """ }