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
              Recent Innovations in Spatial Biology
              by seqadmin


              Spatial biology is an exciting field that encompasses a wide range of techniques and technologies aimed at mapping the organization and interactions of various biomolecules in their native environments. As this area of research progresses, new tools and methodologies are being introduced, accompanied by efforts to establish benchmarking standards and drive technological innovation.

              3D Genomics
              While spatial biology often involves studying proteins and RNAs in their...
              Yesterday, 07:30 PM
            • seqadmin
              Advancing Precision Medicine for Rare Diseases in Children
              by seqadmin




              Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
              12-16-2024, 07:57 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 12-30-2024, 01:35 PM
            0 responses
            21 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-17-2024, 10:28 AM
            0 responses
            41 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-13-2024, 08:24 AM
            0 responses
            55 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-12-2024, 07:41 AM
            0 responses
            40 views
            0 likes
            Last Post seqadmin  
            Working...
            X