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

correction SAM tools

parent 82032aa9
No related branches found
No related tags found
No related merge requests found
...@@ -156,47 +156,81 @@ fi ...@@ -156,47 +156,81 @@ fi
""" """
} }
/* bams sorting */ /* bams spliting */
process sort_bam { process split_bam {
tag "$bam.baseName" tag "$pair_id"
cpus 4 cpus 2
input:
set pair_id, file(bam) from bam_files
output:
set pair_id, "*_forward.bam" into forward_bam_files
set pair_id, "*_reverse.bam" into reverse_bam_files
script:
""" """
samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam} samtools view -hb -F 0x10 ${bam} > ${pair_id}_forward.bam &
samtools view -hb -f 0x10 ${bam} > ${pair_id}_reverse.bam
""" """
} }
/* bams indexing */ /* bams sorting */
process index_bam { process sort_bam_forward {
tag "$bam.baseName" tag "$pair_id"
cpus 4
publishDir "results/mapping/bams/", mode: 'copy'
input: input:
file bam from sorted_bam_files set pair_id, file(bam) from forward_bam_files
output: output:
file "*bam*" into indexed_bam_file set pair_id, "*_sorted.bam" into forward_sorted_bam_files
script: script:
""" """
samtools index ${bam} samtools sort -@ ${task.cpus} -O BAM -o ${pair_id}_forward_sorted.bam ${bam}
""" """
} }
process sort_bam_reverse {
tag "$pair_id"
cpus 4
publishDir "results/mapping/bams/", mode: 'copy'
input:
set pair_id, file(bam) from reverse_bam_files
output:
set pair_id, "*_sorted.bam" into reverse_sorted_bam_files
/* bams spliting */ script:
"""
samtools sort -@ ${task.cpus} -O BAM -o ${pair_id}_reverse_sorted.bam ${bam}
"""
}
process split_bam { /* bams indexing */
tag "$bam.baseName"
cpus 2
process index_bam_forward {
tag "$pair_id"
publishDir "results/mapping/bams/", mode: 'copy'
input: input:
file bam from indexed_bam_file set pair_id, file(bam) from forward_sorted_bam_files
output:
set pair_id, "*bam*" into forward_indexed_bam_file
script:
"""
samtools index ${bam}
"""
}
process index_bam_reverse {
tag "$pair_id"
publishDir "results/mapping/bams/", mode: 'copy'
input:
set pair_id, file(bam) from reverse_sorted_bam_files
output: output:
file "*_forward.bam*" into forward_bam_files set pair_id, "*bam*" into reverse_indexed_bam_file
file "*_reverse.bam*" into reverse_bam_files
script: script:
""" """
samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam & samtools index ${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.
Please register or to comment