Skip to content
Snippets Groups Projects
Commit 67666918 authored by vvanoost's avatar vvanoost
Browse files

Add Ban sorting from SAMtools

parent 7e0c13e2
No related branches found
No related tags found
No related merge requests found
......@@ -155,3 +155,54 @@ if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
fi
"""
}
/* bams sorting */
process sort_bam {
tag "$bam.baseName"
cpus 4
input:
file bam from bam_files
output:
file "*_sorted.bam" into sorted_bam_files
script:
"""
samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam}
"""
}
/* bams indexing */
process index_bam {
tag "$bam.baseName"
input:
file bam from sorted_bam_files
output:
file "*bam*" into indexed_bam_file
script:
"""
samtools index ${bam}
"""
}
/* bams spliting */
process split_bam {
tag "$bam.baseName"
cpus 2
input:
file bam from indexed_bam_files
output:
file "*_forward.bam*" into forward_bam_files
file "*_reverse.bam*" into reverse_bam_files
script:
"""
samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam &
samtools view -hb -f 0x10 ${bam} > ${bam}_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