Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mavishou
    Junior Member
    • Jun 2011
    • 1

    #1

    How to extract multi-mapped reads by samtools?

    Hi guys,
    I’m working with some RNA seq data and get some problems.

    I mapped the paired-end reads on tophat and got the result in sam/bam format. Now I’m using samtools to analyze the result.

    I want to extract the reads that map to more than one place in the genome, and this is my command line:
    Samtools view –h –f 0x100 in.bam > out.sam
    There are no output alignmens in the out.sam except the head, which means there are no multi-mapped reads

    However, I’ve run my own program in perl and find that there’re lots of reads whose IDs appear more than twice in the sam file, which means .these read mapped more than one place in the genome. (Two paired-end reads have the same ID, so most of the time, a certain ID appearing twice means it’s a unique mapping)

    I want to know whether my command line is right? I mean whether 0x100 is the right parameter to extract multi-mapped reads.
  • westerman
    Rick Westerman
    • Jun 2008
    • 1104

    #2
    Originally posted by mavishou View Post
    Hi guys,

    I want to know whether my command line is right? I mean whether 0x100 is the right parameter to extract multi-mapped reads.
    It could be. Depends on the program that created the BAM file. In other words perhaps the program thought that *all* matches were primary and thus never set the 0x100 ("the alignment is not primary") flag.

    I suggest that, since you know the names of some of the reads that have multiple mappings, you look through the BAM file for those reads and see what flags are being set for those reads.

    Comment

    • Marie_Noir
      Junior Member
      • Jul 2011
      • 8

      #3
      I have the same issue to work on. I know that there are multi-mapped reads in my alignment

      grep -i XA:Z:chr15 S1_unsorted.sam | wc -l
      118242
      but samtools view -f100 -c gives me 0

      Checking the lines with XA:Tag

      118242

      grep -i XA:Z:chr15 S1_unsorted.sam | head -n 10
      61WG6AAXX_1:1:1205:11675 0 chr15 28901805 23 76M * 0 0 GCCTCCTGAGTGGCTGGGATTACGGTGTGTGCCACCACGCCTGGCTACTTTTGTCTTTTTAGTAGAGCTGG
      GGGTT eeeceadd^deeceedd^T\\cc`ccddLTc\cTccTc\ceeec\baYYYbb^KKacYc[R^TTaL]L]Y```\Lc XT:A:U NM:i:3 X0:i:1 X1:i:1 XM:i:3 XO:i:0 XG:i:0 MD:Z:XA:Z:chr15,-20643137,76M,4
      ;
      shows that actually the FLAG is not set. Question is, why not??!

      Comment

      • wzchang
        Junior Member
        • Jun 2013
        • 1

        #4
        You need give the right FLAG number 0x100 or 256, Both should work.

        Originally posted by Marie_Noir View Post
        I have the same issue to work on. I know that there are multi-mapped reads in my alignment



        but samtools view -f100 -c gives me 0

        Checking the lines with XA:Tag

        118242



        shows that actually the FLAG is not set. Question is, why not??!

        Comment

        • ashmc
          Junior Member
          • Nov 2016
          • 1

          #5
          Hello,

          How would I get all the other locations in the genome where a particular read maps? If I use the 256 flag, it seems to only give a secondary alignment. I would like to rank the reads such that I can find the top 10 reads (top 10 that map to the most places in the genome).

          Thanks

          Comment

          • BnaT
            Member
            • Nov 2014
            • 10

            #6
            Originally posted by ashmc View Post
            Hello,

            How would I get all the other locations in the genome where a particular read maps? If I use the 256 flag, it seems to only give a secondary alignment. I would like to rank the reads such that I can find the top 10 reads (top 10 that map to the most places in the genome).

            Thanks
            If you only need to check a single read or a few, you could use BLAST. Otherwise, you could try bwa-mem with -a option to get the secondary alignments. Also you could try GEM-mapper which in default outputs all secondary alignments given a maximum threshold of mismatch (e.g 4% of the read length).

            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
            28 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 10:48 AM
            0 responses
            21 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-15-2026, 10:52 AM
            0 responses
            38 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            44 views
            0 reactions
            Last Post SEQadmin2  
            Working...