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

add paired_end and single_end switch version to all implementations

parent 720b1977
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,55 @@ fi
"""
}
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$pair_id"
input:
path index
tuple val(pair_id), path(reads)
output:
tuple val(pair_id), path("*.bam"), emit: bam
path "*_report.txt", emit: report
script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.bt2/ && !(index_file =~ /.*\.rev\.1\.bt2/)) {
index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
}
}
if (reads instanceof List)
"""
# -v specify the max number of missmatch, -k the number of match reported per
# reads
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
-1 ${reads[0]} -2 ${reads[1]} 2> \
${pair_id}_bowtie_report_tmp.txt | \
samtools view -Sb - > ${pair_id}.bam
if grep -q "Error" ${pair_id}_bowtie_report_tmp.txt; then
exit 1
fi
tail -n 19 ${pair_id}_bowtie_report_tmp.txt > \
${pair_id}_bowtie_mapping_report.txt
"""
else
"""
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
-q ${reads} 2> \
${file_id}_bowtie_report_tmp.txt | \
samtools view -Sb - > ${file_id}.bam
if grep -q "Error" ${file_id}_bowtie_report_tmp.txt; then
exit 1
fi
tail -n 19 ${file_id}_bowtie_report_tmp.txt > \
${file_id}_bowtie_mapping_report.txt
"""
}
process mapping_fastq_pairedend {
container = "${container_url}"
......
......@@ -27,6 +27,59 @@ fi
}
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$pair_id"
input:
path index
tuple val(pair_id), path(reads)
output:
tuple val(pair_id), path("*.bam"), emit: bam
path "*_report.txt", emit: report
script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.bt2/ && !(index_file =~ /.*\.rev\.1\.bt2/)) {
index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
}
}
if (reads instanceof List)
"""
bowtie2 --very-sensitive \
-p ${task.cpus} \
-x ${index_id} \
-1 ${reads[0]} \
-2 ${reads[1]} 2> \
${pair_id}_bowtie2_mapping_report_tmp.txt | \
samtools view -Sb - > ${pair_id}.bam
if grep -q "Error" ${pair_id}_bowtie2_mapping_report_tmp.txt; then
exit 1
fi
tail -n 19 ${pair_id}_bowtie2_mapping_report_tmp.txt > \
${pair_id}_bowtie2_mapping_report.txt
"""
else
"""
bowtie2 --very-sensitive \
-p ${task.cpus} \
-x ${index_id} \
-U ${reads} 2> \
${reads.baseName}_bowtie2_mapping_report_tmp.txt | \
samtools view -Sb - > ${reads.baseName}.bam
if grep -q "Error" ${reads.baseName}_bowtie2_mapping_report_tmp.txt; then
exit 1
fi
tail -n 19 ${reads.baseName}_bowtie2_mapping_report_tmp.txt > \
${reads.baseName}_bowtie2_mapping_report.txt
"""
}
process mapping_fastq_pairedend {
container = "${container_url}"
label "big_mem_multi_cpus"
......
......@@ -6,6 +6,33 @@ adapter_5_prim = "CTCTTCCGATCT"
trim_quality = "20"
process adaptor_removal {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$pair_id"
input:
tuple val(pair_id), path(reads)
output:
tuple val(pair_id), path("*_cut_R{1,2}.fastq.gz"), emit: fastq
path "*_report.txt", emit: report
script:
if (reads instanceof List)
"""
cutadapt -a ${adapter_3_prim} -g ${adapter_5_prim} -A ${adapter_3_prim} -G ${adapter_5_prim} \
-o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt
"""
else:
"""
cutadapt -a ${adapter_3_prim} -g ${adapter_5_prim} \
-o ${file_id}_cut.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
process adaptor_removal_pairedend {
container = "${container_url}"
label "big_mem_mono_cpus"
......@@ -46,6 +73,33 @@ process adaptor_removal_singleend {
"""
}
process trimming_pairedend {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$pair_id"
input:
tuple val(pair_id), path(reads)
output:
tuple val(pair_id), path("*_trim_R{1,2}.fastq.gz"), emit:fastq
path "*_report.txt", emit: report
script:
if (reads instanceof List)
"""
cutadapt -q ${trim_quality},${trim_quality} \
-o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt
"""
else
"""
cutadapt -q ${trim_quality},${trim_quality} \
-o ${file_id}_trim.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
process trimming_pairedend {
container = "${container_url}"
label "big_mem_mono_cpus"
......
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