Skip to content
Snippets Groups Projects
Unverified Commit 28a831bf authored by Laurent Modolo's avatar Laurent Modolo
Browse files

nf_modules: update output tuple to handle list as file_id

parent 0dff7e33
Branches
Tags
No related merge requests found
...@@ -12,7 +12,7 @@ process fasta_from_bed { ...@@ -12,7 +12,7 @@ process fasta_from_bed {
path bed path bed
output: output:
path "*_extracted.fasta", emit: fasta tuple val(bed.baseName), path("*_extracted.fasta"), emit: fasta
script: script:
""" """
...@@ -50,7 +50,7 @@ process bam_to_fastq_pairedend { ...@@ -50,7 +50,7 @@ process bam_to_fastq_pairedend {
tuple val(bam_id), path(bam) tuple val(bam_id), path(bam)
output: output:
tuple val(bam.baseName), path("*.fastq"), emit: fastq tuple val(bam_id), path("*.fastq"), emit: fastq
script: script:
""" """
......
...@@ -78,8 +78,8 @@ process mapping_fastq_singleend { ...@@ -78,8 +78,8 @@ process mapping_fastq_singleend {
tuple val(file_id), path(reads) tuple val(file_id), path(reads)
output: output:
set file_id, "*.bam", emit: bam tuple val(file_id), path("*.bam"), emit: bam
file "*_report.txt", emit: report path "*_report.txt", emit: report
script: script:
index_id = index[0] index_id = index[0]
...@@ -93,13 +93,13 @@ bowtie2 --very-sensitive \ ...@@ -93,13 +93,13 @@ bowtie2 --very-sensitive \
-p ${task.cpus} \ -p ${task.cpus} \
-x ${index_id} \ -x ${index_id} \
-U ${reads} 2> \ -U ${reads} 2> \
${file_id}_bowtie2_mapping_report_tmp.txt | \ ${reads.baseName}_bowtie2_mapping_report_tmp.txt | \
samtools view -Sb - > ${file_id}.bam 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 exit 1
fi fi
tail -n 19 ${file_id}_bowtie2_mapping_report_tmp.txt > \ tail -n 19 ${reads.baseName}_bowtie2_mapping_report_tmp.txt > \
${file_id}_bowtie2_mapping_report.txt ${reads.baseName}_bowtie2_mapping_report.txt
""" """
} }
...@@ -33,7 +33,8 @@ process bam_to_bigwig { ...@@ -33,7 +33,8 @@ process bam_to_bigwig {
script: 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} \ ...@@ -57,7 +58,7 @@ computeMatrix scale-regions -S ${bw} \
-R ${bed} \ -R ${bed} \
--beforeRegionStartLength 100 \ --beforeRegionStartLength 100 \
--afterRegionStartLength 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 ...@@ -81,7 +82,7 @@ https://deeptools.readthedocs.io/en/develop/content/tools/plotProfile.html
""" """
plotProfile -m ${matrix} \ plotProfile -m ${matrix} \
--plotFileFormat=pdf \ --plotFileFormat=pdf \
-out ${file_id}.pdf \ -out ${matrix.simpleName}.pdf \
--plotType=fill \ --plotType=fill \
--perGroup \ --perGroup \
--plotTitle "${params.title}" --plotTitle "${params.title}"
......
...@@ -57,7 +57,7 @@ process mapping_fastq_singleend { ...@@ -57,7 +57,7 @@ process mapping_fastq_singleend {
tuple val(file_id), path(reads) tuple val(file_id), path(reads)
output: output:
path "${pair_id}", emit: counts tuple val(file_id), path("${pair_id}"), emit: counts
path "*_report.txt", emit: report path "*_report.txt", emit: report
script: script:
...@@ -66,6 +66,6 @@ mkdir ${file_id} ...@@ -66,6 +66,6 @@ mkdir ${file_id}
kallisto quant -i ${index} -t ${task.cpus} --single \ kallisto quant -i ${index} -t ${task.cpus} --single \
--bias --bootstrap-samples 100 -o ${file_id} \ --bias --bootstrap-samples 100 -o ${file_id} \
-l ${params.mean} -s ${params.sd} \ -l ${params.mean} -s ${params.sd} \
${reads} &> ${file_id}_kallisto_mapping_report.txt ${reads} &> ${reads.simpleName}_kallisto_mapping_report.txt
""" """
} }
...@@ -22,11 +22,11 @@ macs2 callpeak \ ...@@ -22,11 +22,11 @@ macs2 callpeak \
--call-summits "True"\ --call-summits "True"\
--control ${file_control} \ --control ${file_control} \
--keep-dup "auto" \ --keep-dup "auto" \
--name ${file_id} \ --name ${bam_ip.simpleName} \
--gsize ${params.genome_size} 2> \ --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" echo "MACS2 error"
exit 1 exit 1
fi fi
......
...@@ -31,7 +31,7 @@ process sort_bam { ...@@ -31,7 +31,7 @@ process sort_bam {
script: 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 { ...@@ -49,7 +49,9 @@ process split_bam {
tuple val(file_id), path("*_reverse.bam*"), emit: bam_reverse tuple val(file_id), path("*_reverse.bam*"), emit: bam_reverse
script: script:
""" """
sambamba view -t ${task.cpus} -h -F "strand == '+'" ${bam} > ${file_id}_forward.bam sambamba view -t ${task.cpus} -h -F "strand == '+'" ${bam} > \
sambamba view -t ${task.cpus} -h -F "strand == '-'" ${bam} > ${file_id}_reverse.bam ${bam.baseName}_forward.bam
sambamba view -t ${task.cpus} -h -F "strand == '-'" ${bam} > \
${bam.baseName}_reverse.bam
""" """
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment