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
No related branches found
No related tags found
No related merge requests found
......@@ -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:
"""
......
......@@ -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
"""
}
......@@ -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}"
......
......@@ -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
"""
}
......@@ -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
......
......@@ -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
"""
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment