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
.set { index_files }
process mapping_fastq {
tag "$reads.baseName"
tag "$pair_id"
cpus 4
publishDir "results/mapping/bams/", mode: 'copy'
input:
file reads from fastq_files
set pair_id, file(reads) from fastq_files
file index from index_files.toList()
output:
file "*.bam" into bam_files
set pair_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
index_id = index[0]
......@@ -76,12 +77,12 @@ process mapping_fastq {
}
}
"""
bowtie2 --very_sensitive -p ${task.cpus} -x ${index_id} \
-U ${reads} 2> \
${reads.baseName}_bowtie2_report.txt | \
samtools view -Sb - > ${reads.baseName}.bam
bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \
-1 ${reads[0]} -2 ${reads[1]} 2> \
${pair_id}_bowtie2_report.txt | \
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
fi
"""
......@@ -116,15 +117,22 @@ process mapping_fastq {
output:
file "*.bam" into bam_files
file "*_report.txt" into mapping_report
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> \
${reads.baseName}_bowtie2_report.txt | \
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
fi
"""
......
......@@ -24,6 +24,7 @@ process mapping_fastq {
output:
set pair_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
index_id = index[0]
......
......@@ -23,6 +23,7 @@ process mapping_fastq {
output:
file "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
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