Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aiden
    Junior Member
    • May 2010
    • 3

    #1

    SAM flag field and removing unmapped reads from BFAST output

    Hi there,

    I'm using BFAST to align Solexa reads to a very small portion of a genome (~3kb), and have been considering the best way to remove unmapped reads from the output since these unnecessarily bulk up the output .sam file. I know that samtools can filter an incoming .sam file using the -F command. However, I've read some documentation on the SAM flag format and must admit I find it pretty confusing. Within the flag field I know there are fields for both "the mate is unmapped" and "the query sequence itself is unmapped", but for non-paired-end Solexa reads can either of these be used for removing unmapped reads? Furthermore, what would be the integer or string used in the -F command?

    Alternatively, there is the option in samtools view to filter by map quality (MAPQ). Would setting map quality filter to e.g. 1 remove all unmapped reads without affecting the filtered alignment from BFAST postprocess?

    Alternatively again, dbamfilter within the DNAA package has the capacity to remove unmapped reads, but if samtools can do the job I'd like to minimise the number of apps employed.

    What are thoughts on the best strategy?
    Aiden
  • Bruins
    Member
    • Feb 2010
    • 78

    #2
    Hi Aiden,

    I hope I'm not staing the obvious here, but are you familiar with Picard? They are some Java-based commandline tools to manipulate sam files and one of those may help you: ViewSam.jar. It basically prints a sam or bam file to the screen but you can set a flag to report all reads, just the aligned reads or just the unaligned reads.
    Take a look: http://picard.sourceforge.net/

    Cheers,
    Wil

    Comment

    • drio
      Senior Member
      • Oct 2008
      • 323

      #3
      Originally posted by aiden View Post
      Hi there,

      I'm using BFAST to align Solexa reads to a very small portion of a genome
      (~3kb), and have been considering the best way to remove unmapped reads from
      the output since these unnecessarily bulk up the output .sam file. I know that
      samtools can filter an incoming .sam file using the -F command. However, I've
      read some documentation on the SAM flag format and must admit I find it pretty
      confusing. Within the flag field I know there are fields for both "the mate is
      unmapped" and "the query sequence itself is unmapped", but for non-paired-end
      Solexa reads can either of these be used for removing unmapped reads?
      Look at the BAM spec 2.2.2 (Notes):

      Code:
      1. Flag 0x02, 0x08, 0x20, 0x40 and 0x80 are only meaningful when flag 0x01 is present.
      Assuming you are using Fragment data, you want to filter using the 0x0004 flag.

      Furthermore, what would be the integer or string used in the -F command?
      Code:
      $ samtools view -F 4 ./foo.bam # display mapped reads only
      $ samtools view -f 4 ./foo.bam # display unmapped reads only
      Alternatively, there is the option in samtools view to filter by map quality
      (MAPQ). Would setting map quality filter to e.g. 1 remove all unmapped reads
      without affecting the filtered alignment from BFAST postprocess?
      Go for samtools as suggested.
      You need to do the postprocessing prior to be able to filter your reads anyway.

      Alternatively again, dbamfilter within the DNAA package has the capacity to
      remove unmapped reads, but if samtools can do the job I'd like to minimise the number of apps employed.
      samtools can do the job. But give dnaa a try too.
      -drd

      Comment

      • aiden
        Junior Member
        • May 2010
        • 3

        #4
        Thanks for the very helpful replies, much appreciated.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
          by SEQadmin2



          Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

          Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
          ...
          10-14-2026, 09:55 AM
        • SEQadmin2
          New Genomics Technologies Take Aim at Long-Standing Limits
          by SEQadmin2


          Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

          We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
          ...
          09-28-2026, 10:25 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        54 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        40 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-15-2026, 10:52 AM
        0 responses
        46 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-14-2026, 05:39 AM
        0 responses
        46 views
        0 reactions
        Last Post SEQadmin2  
        Working...