Unconfigured Ad

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

    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

        • SEQadmin2
          Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
          by SEQadmin2


          Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

          The systematic characterization of the human proteome has
          ...
          07-20-2026, 11:48 AM
        • SEQadmin2
          Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
          by SEQadmin2



          Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
          ...
          07-09-2026, 11:10 AM
        • SEQadmin2
          Cancer Drug Resistance: The Lingering Barrier to Rising Survival
          by SEQadmin2



          Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

          There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
          07-08-2026, 05:17 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, Today, 11:41 AM
        0 responses
        8 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-20-2026, 11:10 AM
        0 responses
        21 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-13-2026, 10:26 AM
        0 responses
        34 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-09-2026, 10:04 AM
        0 responses
        44 views
        0 reactions
        Last Post SEQadmin2  
        Working...