Dear all: Thanks very much for your clear explanation for samtools flag. Could you please explain the option -m and -B in samtools view as well? There are nine CIGAR operations, and the sum of lengths of these operations equal the length of query sequence. So no matter the value of option m, it will output all the alignments. So what is the meaning of option -m? Thanks very much for your time.
Best Jing On Fri, Mar 4, 2016 at 8:29 PM, James Bonfield <[email protected]> wrote: > 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. >
------------------------------------------------------------------------------
_______________________________________________ Samtools-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/samtools-help
