lh3 / bwa

Burrow-Wheeler Aligner for short-read alignment (see minimap2 for long-read alignment)
GNU General Public License v3.0
1.55k stars 556 forks source link

the flag of bam #298

Open tyyiyi opened 4 years ago

tyyiyi commented 4 years ago

Hello, I am currently doing structural mutation detection. One of the steps is to filter out discordant reads based on the flag value in the bam file. The script is as follows: samtools view -b -F 1294 sample.bam> sample.discordants.unsorted.bam

Here, 1294 refers to "read mapped in proper pair", I want to know how you define it? What is the distance between a pair of reads in bwa that you think is reasonable? Can I modify this value?

Thank you ! tang

ipstone commented 1 year ago

You may get the explanation from this webtool: https://broadinstitute.github.io/picard/explain-flags.html 1294 would mean the following:

Summary:
    read mapped in proper pair (0x2)*
    read unmapped (0x4)
    mate unmapped (0x8)*
    not primary alignment (0x100)
    read is PCR or optical duplicate (0x400)

Some other further details can be found at: https://www.samformat.info/sam-format-flag and https://ppotato.wordpress.com/2010/08/25/samtool-bitwise-flag-paired-reads/