Is There A Tool To Combine Samtools / Sam File Bitwise Flags?
2
0
Entering edit mode
10.6 years ago
Kevin ▴ 640

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 • 3.6k views
ADD COMMENT
0
Entering edit mode
10.6 years ago
Kevin ▴ 640

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 COMMENT
0
Entering edit mode
10.6 years ago
Christof Winter ★ 1.0k

Hi Kevin,

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

ADD COMMENT

Login before adding your answer.

Traffic: 1160 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