Skip to content
Snippets Groups Projects
Verified Commit 654fe7ec authored by Laurent Modolo's avatar Laurent Modolo
Browse files

Bowtie2: fix bug on nf files

parent 5c25d638
No related branches found
No related tags found
No related merge requests found
...@@ -57,16 +57,17 @@ Channel ...@@ -57,16 +57,17 @@ Channel
.set { index_files } .set { index_files }
process mapping_fastq { process mapping_fastq {
tag "$reads.baseName" tag "$pair_id"
cpus 4 cpus 4
publishDir "results/mapping/bams/", mode: 'copy' publishDir "results/mapping/bams/", mode: 'copy'
input: input:
file reads from fastq_files set pair_id, file(reads) from fastq_files
file index from index_files.toList() file index from index_files.toList()
output: output:
file "*.bam" into bam_files set pair_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script: script:
index_id = index[0] index_id = index[0]
...@@ -76,12 +77,12 @@ process mapping_fastq { ...@@ -76,12 +77,12 @@ process mapping_fastq {
} }
} }
""" """
bowtie2 --very_sensitive -p ${task.cpus} -x ${index_id} \ bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \
-U ${reads} 2> \ -1 ${reads[0]} -2 ${reads[1]} 2> \
${reads.baseName}_bowtie2_report.txt | \ ${pair_id}_bowtie2_report.txt | \
samtools view -Sb - > ${reads.baseName}.bam samtools view -Sb - > ${pair_id}.bam
if grep -q "Error" ${reads.baseName}_bowtie2_report.txt; then if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
exit 1 exit 1
fi fi
""" """
...@@ -116,15 +117,22 @@ process mapping_fastq { ...@@ -116,15 +117,22 @@ process mapping_fastq {
output: output:
file "*.bam" into bam_files file "*.bam" into bam_files
file "*_report.txt" into mapping_report
script: script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.bt2/) {
index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
}
}
""" """
bowtie2 --very_sensitive -p ${task.cpus} -x ${index[0].baseName} \ bowtie2 --very_sensitive -p ${task.cpus} -x ${index_id} \
-U ${reads} 2> \ -U ${reads} 2> \
${reads.baseName}_bowtie2_report.txt | \ ${reads.baseName}_bowtie2_report.txt | \
samtools view -Sb - > ${reads.baseName}.bam samtools view -Sb - > ${reads.baseName}.bam
if grep -q "Error" ${fasta.baseName}_bowtie2_report.txt; then if grep -q "Error" ${reads.baseName}_bowtie2_report.txt; then
exit 1 exit 1
fi fi
""" """
......
...@@ -24,6 +24,7 @@ process mapping_fastq { ...@@ -24,6 +24,7 @@ process mapping_fastq {
output: output:
set pair_id, "*.bam" into bam_files set pair_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script: script:
index_id = index[0] index_id = index[0]
......
...@@ -23,6 +23,7 @@ process mapping_fastq { ...@@ -23,6 +23,7 @@ process mapping_fastq {
output: output:
file "*.bam" into bam_files file "*.bam" into bam_files
file "*_report.txt" into mapping_report
script: script:
index_id = index[0] index_id = index[0]
......
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