Question: Is There A Tool To Combine Samtools / Sam File Bitwise Flags?
0
gravatar for Kevin
7.1 years ago by
Kevin610
Kevin610 wrote:

I am trying to do this

samtools view -f 0x2 -b XX.bam | samtools view -b -F 0x200 - | samtools view -b -F 0x400 - |genomeCoverageBed

as I am not sure of how to combine bitwise flag.

Unfortunately this 'lazy' way consumes 2 extra threads.

There's a python script here http://biostar.stackexchange.com/questions/13079/flag-in-sam-format

But I am not sure how to change it so that I might be able to filter in one samtools step? (or two?)

samtools • 2.7k views
ADD COMMENTlink written 7.1 years ago by Kevin610
0
gravatar for Kevin
7.1 years ago by
Kevin610
Kevin610 wrote:

Seems a bit silly to answer my own question but can anyone verify if what I can do is

samtools view -f 0x2 -b XX.bam | samtools view -b -F 1536|genomeCoverageBed

combined the last two commands bit flag here http://picard.sourceforge.net/explain-flags.html

ADD COMMENTlink written 7.1 years ago by Kevin610
0
gravatar for Christof Winter
7.1 years ago by
Lund, Sweden
Christof Winter980 wrote:

Hi Kevin,

That looks right to me. 0x200 = 2^9 = 512, 0x400 = 2^10 = 1024, 512 + 1024 = 1536.

ADD COMMENTlink written 7.1 years ago by Christof Winter980
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: 779 users visited in the last hour