Question: Remove supplementary alignments from a bam file
0
gravatar for jeni
10 months ago by
jeni40
jeni40 wrote:

Hi!

Do you know how can I filter out supplementary alignments from a bam file? I was reviewing http://broadinstitute.github.io/picard/explain-flags.html and I am aware that the flag for this kind of alignments is "2048". However, depending on another features (ex: paired read, second in pair, etc), the flag can vary.

So, I am not sure about how can I filter out this kind of alignments.

alignment • 831 views
ADD COMMENTlink modified 10 months ago by Pierre Lindenbaum134k • written 10 months ago by jeni40
3
gravatar for Devon Ryan
10 months ago by
Devon Ryan98k
Freiburg, Germany
Devon Ryan98k wrote:

samtools view -F 2048 -bo filtered.bam original.bam

You don't have to care about what other flags are set, the -F option will filter any entry with bit 2048.

ADD COMMENTlink modified 10 months ago • written 10 months ago by Devon Ryan98k
2
gravatar for Pierre Lindenbaum
10 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum134k wrote:

the SAM flag is a bit array https://en.wikipedia.org/wiki/Bit_array . Filtering with samtools view -F or samtools view -f uses Bit Wise operations https://en.wikipedia.org/wiki/Bitwise_operation so the other bits don't have any consequence on the filtering.

ADD COMMENTlink modified 10 months ago • written 10 months ago by Pierre Lindenbaum134k
1

Beat you by 3 minutes :)

ADD REPLYlink written 10 months ago by Devon Ryan98k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1996 users visited in the last hour
_