Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blaboon
    Bioinformatics Specialist
    • Nov 2014
    • 13

    #1

    In the SAM format, how the POS field affected by insertion and deletion

    Hi all,

    In the Sequence Alignment/Map Format Specification document, it says that the POS field is actually "1-based leftmost mapping POSition of the first matching base." So, based on my understanding, it is the first position in the reference on which the first alignment match (M, can be a sequence match or mismatch) occurs, am I right? If this is the case, I infer that (since I didn't find any such situation in my own data), if the CIGAR is like 10S1D139M, I mean if the first operator after the clip (H or S) is D (deletion), so the POS should be one after the position where the deletion happens?

    Actually, I am trying to develop a tool which can handle the read "overlap" in the pair-end data. As you know, the "overlap" will happen if our fragment is short and read length of the sequencer is long. In the "overlap" region, actually we can do more, for example, if the two of overlapped bases are not same, we think the mapping at this position is not good enough and will reduce the base quality or something similar.

    Now, the problem is I need to find that in the two reads (forward and backward), which two bases are actually from the same position in the reference sequence, this will be easy if all bases are alignment matches (M), no insertion (I) and deletion (D). But if it is not the case, I find that it is a little bit complicated to find the overlap bases, we need to consider the insertion and deletion, for example, if there is an insertion in one position of one read, to check the overlap, we need use the base after this position and the base at the insertion position on the other read in pair (assume that there is no insertion on the other read in pair) . This is just one simple case, I need to find all overlapped bases under this crazy condition and check whether they are equal or not.

    If anybody have better solution and willing to share, it will be appreciated very much. Thank you very much.

    bless~
  • lindenb
    Senior Member
    • Apr 2010
    • 143

    #2
    "I mean if the first operator after the clip (H or S) is D (deletion), so the POS should be one after the position where the deletion happens? "

    YES. The position starts at the first M/=.

    Comment

    • blaboon
      Bioinformatics Specialist
      • Nov 2014
      • 13

      #3
      Originally posted by lindenb View Post
      "I mean if the first operator after the clip (H or S) is D (deletion), so the POS should be one after the position where the deletion happens? "

      YES. The position starts at the first M/=.
      Hi, thanks for your quick reply.

      In my understanding of the SAM specification, M is equal to X/=, which means alignment match can be sequence match or mismatch , please suggest.

      bless~

      Comment

      • dpryan
        Devon Ryan
        • Jul 2011
        • 3478

        #4
        Correct, POS refers to the first of M=X, though you rarely see X or = in real life.

        Comment

        • maubp
          Peter (Biopython etc)
          • Jul 2009
          • 1544

          #5
          This came up in discussion on the samtools-dev mailing list, I think James Bonfield constructed some good examples... Evidently the spec needs a bit more clarification here?

          Comment

          • dpryan
            Devon Ryan
            • Jul 2011
            • 3478

            #6
            Do you remember when that came up? I thought I recalled that but couldn't find it with some quick searching.

            Comment

            • Brian Bushnell
              Super Moderator
              • Jan 2014
              • 2709

              #7
              Originally posted by dpryan View Post
              Correct, POS refers to the first of M=X, though you rarely see X or = in real life.
              I see it all the time, since BBMap outputs those by default

              "10S1D139M" is not a cigar string that should ever be produced. "D" should be internal to "M/X/=". If you see a read that violates this, just throw it away; it's nonsense.

              "I" is a bit more tricky; it can occur and be valid at the ends. In that case, those bases should be ignored with respect to the POS, just like "S" bases.

              Incidentally, I wrote another tool, BBMerge, which can merge paired reads, and adjusts the quality of overlapping bases to reflect whether or not they match. It's mainly used for merging reads by overlap, but it can merge based on mapping locations also, if you use it like this (the example assumes interleaved reads but they can be in two files also):

              bbmap.sh ref=reference.fasta in=reads.fastq outm=mapped.fastq pairedonly renamebymapping pairlen=800
              bbmerge.sh in=mapped.fq out=merged.fq usemapping parsecustom


              Sorry, bbmerge does not currently work with sam/bam files; it requires custom headers on reads to merge them based on mapping data. The first step maps the reads and adds custom headers. The "pairlen" flag when mapping restricts the maximum distance between paired reads - if the reads overlap this is negative, and if they don't it is positive; insert size = (pairlen + read1 length + read2 length).
              Last edited by Brian Bushnell; 01-09-2015, 11:10 AM.

              Comment

              • blaboon
                Bioinformatics Specialist
                • Nov 2014
                • 13

                #8
                Originally posted by dpryan View Post
                Correct, POS refers to the first of M=X, though you rarely see X or = in real life.
                Great, thanks, that really clear my confusion.

                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...