Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jyu429
    Junior Member
    • Oct 2014
    • 6

    #1

    Counting number of reads mapped to an allele

    Hi,

    I have a sam file and I want to count how many queries mapped to a specific reference in the reference file. Is there a simple way to do this? Thanks!
  • blancha
    Senior Member
    • May 2013
    • 367

    #2
    One way would be with bedtools multicov.

    You'll need to convert your SAM file to a BAM file, sort the BAM file and index it.
    If you put your reference in the form of a BED file, you can then easily count the number of alignments for each interval defined in the BED file with bedtools multicov.

    Comment

    • jyu429
      Junior Member
      • Oct 2014
      • 6

      #3
      So if I want to count the number of alignments to the reference with rname "IGHV01-02" how would I define this in the BED file?

      Comment

      • blancha
        Senior Member
        • May 2013
        • 367

        #4
        Sorry, I misunderstood your question.
        I thought reference meant a chromosomal position.
        BED files work with chromosomal positions.
        You could still answer your question with bedtools multicov though, if you defined the start as 0 and the end as a position larger than the largest position in IGHV01-02.
        E. g.
        IGHV01-02 0 10000000

        However, if your question is that simple, you could just use grep.
        grep -c IGHV01-02 yoursamfile

        Comment

        • jyu429
          Junior Member
          • Oct 2014
          • 6

          #5
          Hi,

          Yes, I did try grep but when I do grep -c "IGHV7-81*01" myfile.sam the count is 0 and when I grep for "IGHV7-81*" the count is 119, but I'm very sure there is at least one IGHV7-81*01.

          Comment

          • blancha
            Senior Member
            • May 2013
            • 367

            #6
            I don't know.

            If your SAM file has a header, you could check the reference names in the header.
            You could also check the reference names in the reference genome, as well as test the grep syntax on the reference genome.

            You could also convert the SAM file to a BAM file, sort it and index it.
            You could then load the BAM file and the reference genome in IGV to visualize the alignments.

            Comment

            Latest Articles

            Collapse

            • 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, detection...
              Today, 06:46 AM
            • 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

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 10-28-2026, 09:57 AM
            0 responses
            22 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-28-2026, 09:51 AM
            0 responses
            14 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 11:13 AM
            0 responses
            67 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 10:48 AM
            0 responses
            47 views
            0 reactions
            Last Post SEQadmin2  
            Working...