Supplementary alignments in BAM-file
3
0
Entering edit mode
5 weeks ago
mokbel73 • 0

Dear all,

I have a bamfile which contains some reads that have supplementary alignments within them, as shown in the screenshot. i tried to filter the bamfile with samtools using flag 2048. Luckily the supplementary alignments belonging to a specific read were gone. However, i want the whole read to be filtered out whenever it contains supplementary alignments from the bamfile and not only its supplementary alignments. is there a possible way to do this?

best,

reads Supplementary galaxy Samtools bamfiles • 384 views
0
Entering edit mode

0
Entering edit mode

for what it's worth, "supplementary alignments" can be quite interesting. they often indicate things like SVs

0
Entering edit mode
5 weeks ago

add -e '![SA]' to your samtools view command ( http://www.htslib.org/doc/samtools.html#FILTER_EXPRESSIONS )

0
Entering edit mode

i want the whole read to be filtered out whenever it contains supplementary alignments from the bamfile and not only its supplementary alignments.

0
Entering edit mode
5 weeks ago

It might take two steps: 1) using samtools to identify the read names which have supplementary alignments, then 2) filter away all lines in the bam with those read names.

0
Entering edit mode
5 weeks ago

In one step, you could remove every alignments with a mapping quality of 0. With most aligners, this corresponds to the reads for which there is ambiguous mapping. Note that this will also remove secondary alignments and the primary alignments from reads that also have secondary/supplementary alignments.

samtools view -q 1 -b input.bam -o output.bam