Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Reads clipping by refernce coordinates?

    I have a bam file and I’d like to retrieve the part of sequence of each reads that aligns to a certain region in the reference. For example, for reads that cover region chr1:1000-1100, I need to clip them such that only the part aligning to this region remains. The output should be reads that align exactly at this particular region, with all the flanking sequences clipped. Is there any tools available to do this? Thanks.

  • #2
    You can combine two tools:
    samtools view input.bam chr1:1000-1100 >slice.bam
    bedtools bamtofastq -i slice.bam -fq output.fastq

    Comment


    • #3
      It's best to do something like this in python or another language, at least if you have any indels. The general idea is to extract the reads covering that regions (with samtools), extract the start position, parse the CIGAR to determine the position of each nucleotide in the read, output nucleotides in the position of interest.

      @TiborNagy, that won't actually do what shiningway wants. If a read is AAACCTGACTGATCGAC and only the last 8 bases overlap the region, then the output for that read should be TGATCGAC.

      Comment


      • #4
        I was hoping to find existing tools to do this. But it seems I have to write it myself. Thanks.
        Originally posted by dpryan View Post
        It's best to do something like this in python or another language, at least if you have any indels. The general idea is to extract the reads covering that regions (with samtools), extract the start position, parse the CIGAR to determine the position of each nucleotide in the read, output nucleotides in the position of interest.

        @TiborNagy, that won't actually do what shiningway wants. If a read is AAACCTGACTGATCGAC and only the last 8 bases overlap the region, then the output for that read should be TGATCGAC.

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Exploring the Dynamics of the Tumor Microenvironment
          by seqadmin




          The complexity of cancer is clearly demonstrated in the diverse ecosystem of the tumor microenvironment (TME). The TME is made up of numerous cell types and its development begins with the changes that happen during oncogenesis. “Genomic mutations, copy number changes, epigenetic alterations, and alternative gene expression occur to varying degrees within the affected tumor cells,” explained Andrea O’Hara, Ph.D., Strategic Technical Specialist at Azenta. “As...
          07-08-2024, 03:19 PM
        • seqadmin
          Exploring Human Diversity Through Large-Scale Omics
          by seqadmin


          In 2003, researchers from the Human Genome Project (HGP) announced the most comprehensive genome to date1. Although the genome wasn’t fully completed until nearly 20 years later2, numerous large-scale projects, such as the International HapMap Project and 1000 Genomes Project, continued the HGP's work, capturing extensive variation and genomic diversity within humans. Recently, newer initiatives have significantly increased in scale and expanded beyond genomics, offering a more detailed...
          06-25-2024, 06:43 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Today, 11:09 AM
        0 responses
        16 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 07-19-2024, 07:20 AM
        0 responses
        148 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 07-16-2024, 05:49 AM
        0 responses
        124 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 07-15-2024, 06:53 AM
        0 responses
        111 views
        0 likes
        Last Post seqadmin  
        Working...
        X