Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • danielsbrewer
    Member
    • Feb 2009
    • 35

    #1

    Filtering a BAM by chastity flag using samtools

    Dear all

    I have a BAM file from Illumina whole genome data and I would like to filter out all the reads that fail Illumina's chastity filtering. From my understanding that is the flag 0x0200 (please correct me if you know differently). So to remove those reads and retain all other information in the BAM file can I just use samtools like this:
    Code:
    samtools view -h -b -F 0x0200 input.bam > output.bam
    Many thanks
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #2
    The flag will only be thrown if the software that made the sam knows somehow that the read is poor quality. For Illumina reads, the data on passing filters is in the name of the read in the original fastqs (separated by a space from the rest of the name). If you just take those reads, and align them with, say, bwa, bwa won't read the name and figure out that the read didn't pass filters. (in fact, it might truncate after the space, which will erase the information from the name).

    So don't blindly trust the flag. You have to understand how the flagging was made, and if the software that made the flag is even paying attention to that particular characteristic. So if you try the above command, and nothing gets filtered out, you can't assume from that that 100% of your reads passed filters, beucase its more blikely that you sam-making software wasn't trying to track that at all.

    Comment

    • danielsbrewer
      Member
      • Feb 2009
      • 35

      #3
      Many thanks for the reply. There are definitely reads that have the flag 0x200. I have contacted Illumina (they generated the data) to ensure that I have got the right flag etc.
      Thanks

      Comment

      • syedsaid
        Junior Member
        • Sep 2011
        • 3

        #4
        Question about samtools view -r

        Hi,
        I met a problem when using samtools command view -r.
        -r STR Only output reads in read group STR [null]

        Could any one tell me how to use -r in samtools view? I think it would be better have an example to illustrate that.

        Thanks a lot!

        Comment

        Latest Articles

        Collapse

        • kinpict.com
          Reply to 16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
          by kinpict.com
          The part about this topic feels surprisingly grounded, and the details on the page is the bit that made me slow down. I’d keep <a href="https://kinpict.com/">ai family photo generator</a> bookmarked for later.
          Today, 06:37 PM
        • SEQadmin2
          16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
          by SEQadmin2





          NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
          10-30-2026, 06:46 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 11-12-2026, 07:59 AM
        0 responses
        27 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 11-05-2026, 09:25 AM
        0 responses
        35 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 11-03-2026, 11:54 AM
        2 responses
        56 views
        0 reactions
        Last Post kinpict.com  
        Started by SEQadmin2, 10-28-2026, 09:57 AM
        0 responses
        175 views
        0 reactions
        Last Post SEQadmin2  
        Working...