Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Extract reads with defined nucleotide at defined aligned position

    Dear all,

    I would like to extract from a BAM (or SAM) file the reads that contain a specified nucleotide at a specified location. E.g. I would like to extract all reads that have the reference allele (T) at chr1:222222.

    All the tools that I could find around simply subset a BAM based on an input position, but I cannot find anything that is able to subset based on which base is at that position.

    Any ideas on how this could be accomplished?

    Thank a lot!

  • #2
    You'll probably have to put something together to do this for you. If you're familiar with python, you could do this with pysam (first subset the BAM/SAM file with samtools to just get reads covering that position and then read the results into a python program, iterating over the reads and just outputing those with a T at the desired position). You might be able to do the subsetting with pysam to, I've never tried.

    If you're more comfortable with C, there's the samtools C API, which can do the same things. If you're more of a java person then there's the picard API. Presumably there's something for perl too.

    Comment


    • #3
      Hi dpryan,

      thanks a lot for the answer! pysam pileup does exactly what I needed, we are now using it to look up one position in a bam file and then output a list of all reads names and for each one the type of nucleotide at the desired position.

      Thanks a lot for your help!

      Comment

      Latest Articles

      Collapse

      • seqadmin
        Strategies for Sequencing Challenging Samples
        by seqadmin


        Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
        03-22-2024, 06:39 AM
      • seqadmin
        Techniques and Challenges in Conservation Genomics
        by seqadmin



        The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

        Avian Conservation
        Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
        03-08-2024, 10:41 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Yesterday, 06:37 PM
      0 responses
      12 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, Yesterday, 06:07 PM
      0 responses
      10 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-22-2024, 10:03 AM
      0 responses
      52 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-21-2024, 07:32 AM
      0 responses
      68 views
      0 likes
      Last Post seqadmin  
      Working...
      X