Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • charlescoldroom
    Junior Member
    • Apr 2012
    • 8

    #1

    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!
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #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

    • charlescoldroom
      Junior Member
      • Apr 2012
      • 8

      #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

      • 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
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Yesterday, 11:13 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, Yesterday, 10:48 AM
      0 responses
      15 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      35 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      42 views
      0 reactions
      Last Post SEQadmin2  
      Working...