Supplementary alignments in BAM-file
3
0
Entering edit mode
2.4 years 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

galaxy Samtools bam • 2.8k views
ADD COMMENT
0
Entering edit mode

enter image description here

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
2.4 years ago

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

ADD COMMENT
0
Entering edit mode

Does this address

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

ADD REPLY
0
Entering edit mode
2.4 years 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.

ADD COMMENT
0
Entering edit mode
2.4 years 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
ADD COMMENT

Login before adding your answer.

Traffic: 1846 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6