Hello,

On Thu, Mar 03, 2016 at 05:04:05PM -0500, Andrew Bjonnes wrote:
> An example is a record with FLAG = 153 = 0b000010011001. This corresponds
> to the following flags set:
>  0x1  = 0b000000000001: template having multiple segments in sequencing
>  0x8  = 0b000000001000: next segment in the template unmapped
>  0x10 = 0b000000010000: SEQ being reverse complemented
>  0x80 = 0b000010000000: the last segment in the template
> 
> So, as a contrived example, if you wanted to view only records where SEQ is
> reverse complemented (16 = 0x10 = 0b000000010000) and the read is marked as
> an optical or PCR duplicate (1024 = 0x400 = 0b010000000000), you would
> simply add these together (1040 = 0b010000010000) and use this value: samtools
> view -f 1040 ...

For ease of use note that samtools has a flags sub-command.  With no
other arguments it lists the flags.  Given arguments it does the
conversions for you.  Eg:

[nfs_j/jkb]; samtools flags 

About: Convert between textual and numeric flag representation
Usage: samtools flags INT|STR[,...]

Flags:
        0x1     PAIRED        .. paired-end (or multiple-segment) sequencing 
technology
        0x2     PROPER_PAIR   .. each segment properly aligned according to the 
aligner
        0x4     UNMAP         .. segment unmapped
        0x8     MUNMAP        .. next segment in the template unmapped
        0x10    REVERSE       .. SEQ is reverse complemented
        0x20    MREVERSE      .. SEQ of the next segment in the template is 
reversed
        0x40    READ1         .. the first segment in the template
        0x80    READ2         .. the last segment in the template
        0x100   SECONDARY     .. secondary alignment
        0x200   QCFAIL        .. not passing quality controls
        0x400   DUP           .. PCR or optical duplicate
        0x800   SUPPLEMENTARY .. supplementary alignment

[nfs_j/jkb]; samtools flags REVERSE,DUP
0x410                    1040     REVERSE,DUP
[nfs_j/jkb]; samtools flags 1040
0x410                    1040     REVERSE,DUP


-- 
James Bonfield ([email protected]) | Hora aderat briligi. Nunc et Slythia Tova
                                  | Plurima gyrabant gymbolitare vabo;
  A Staden Package developer:     | Et Borogovorum mimzebant undique formae,
https://sf.net/projects/staden/   | Momiferique omnes exgrabure Rathi. 


-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to