gt1 / biobambam2

Tools for early stage alignment file processing
Other
93 stars 17 forks source link

bammaskflags - add condition option? #63

Closed keiranmraine closed 6 years ago

keiranmraine commented 6 years ago

Would it be possible to add a condition for masking a flag?

I'd like to be able to do something like:

bammaskflag maskneg=512 auxexists='mm'

or

bammaskflag maskneg=512 auxmatch='mm:A:Y'

The output would be the complete input BAM but with all reads having mm:A:Y having the flag 512 (QCFAIL) reset. Assuming the aux tag test is only applied to reads matching the flags being reset it should be reasonably efficient (for the volume of reads we are looking at anyway).

I don't actually care about the value but others may for their use cases.

gt1 commented 6 years ago

I have added the first version (without checking the content of the aux field) in bammaskflags. Please let me know whether this works for you.

keiranmraine commented 6 years ago

Thanks, works as expected.