Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pysam Fetching Incorrect Coordinates

    Hello everyone. I am using pysam to fetch the reads overlapping a given region, however, I am finding that pysam returns a list of reads whose positions do not correspond with the region coordinates that I input. The BAM file is indexed with samtools index 'file.bam'

    For example, I want to fetch this region: chr3:50617849-50618103

    I do so with the following code (inside python command line):
    Code:
    import pysam
    bam = pysam.AlignmentFile('file.bam')
    reads = bam.fetch('chr3',50617849,50618103)
    for read in reads:
        print read.pos
    The first coordinate printed is 50335428, which is outside the scope of my input region completely.

    Does anybody know why this is happening? The BAM file was created from a STAR alignment of paired-end reads against the hg19 human reference genome in case that matters.

  • #2
    Right, but does the read stretch into or span that region? You're not asking for reads starting in that interval, you're asking for those that intersect it in any way (including splicing over it).

    Comment


    • #3
      Well the distance from that read to the actual start location is ~280,000 nucleotides. I suppose then the read would have to be spliced? Here is one of the reads in question:

      Code:
      ABC-ST978_0126:2:1307:16045:21543#0     403     2       50335428 3
              91M317386N10M   2       50335207        101     GGGGTCTGTAACCACCAGGTCTATAAAACAGCCGACCCAATCTACTTGCTGGCCTTCTGTCTTCCAGTAGTCCTCCTAGTCCACCACTAGGAGGACTAGGA       array('B', [66, 66, 66, 64, 66, 66, 66, 65, 63, 64, 64, 66, 66, 66, 66, 65, 66, 66, 66, 66, 66, 67, 66, 65, 66, 66, 66, 66, 66, 66, 66, 68, 68, 70, 70, 72, 72, 71, 72, 71, 71, 71, 69, 70, 72, 71, 71, 72, 71, 70, 70, 71, 72, 72, 72, 72, 72, 71, 71, 71, 72, 71, 71, 72, 72, 72, 72, 71, 72, 71, 69, 72, 71, 69, 72, 71, 71, 72, 72, 72, 71, 70, 70, 72, 70, 69, 72, 72, 70, 70, 70, 70, 70, 68, 66, 68, 68, 68, 65, 64, 64])    [('NH', 2), ('HI', 2), ('AS', 189), ('nM', 0)]
      I suppose that 317386N region is the gap?

      Comment


      • #4
        Yup, it's a spliced read, which you can tell from the N cigar operator.

        Comment


        • #5
          Interesting, glad I know this now. Thanks!

          Comment


          • #6
            No problem, I've been tripped up by this as well. In case you ever use the pileup() functions, keep in mind that this will happen there as well.

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Essential Discoveries and Tools in Epitranscriptomics
              by seqadmin




              The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
              04-22-2024, 07:01 AM
            • seqadmin
              Current Approaches to Protein Sequencing
              by seqadmin


              Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
              04-04-2024, 04:25 PM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 04-25-2024, 11:49 AM
            0 responses
            19 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-24-2024, 08:47 AM
            0 responses
            19 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            62 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 10:19 PM
            0 responses
            60 views
            0 likes
            Last Post seqadmin  
            Working...
            X