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
          Latest Developments in Precision Medicine
          by seqadmin



          Technological advances have led to drastic improvements in the field of precision medicine, enabling more personalized approaches to treatment. This article explores four leading groups that are overcoming many of the challenges of genomic profiling and precision medicine through their innovative platforms and technologies.

          Somatic Genomics
          “We have such a tremendous amount of genetic diversity that exists within each of us, and not just between us as individuals,”...
          Yesterday, 01:16 PM
        • seqadmin
          Recent Advances in Sequencing Analysis Tools
          by seqadmin


          The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
          05-06-2024, 07:48 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Yesterday, 07:15 AM
        0 responses
        12 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-23-2024, 10:28 AM
        0 responses
        15 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-23-2024, 07:35 AM
        0 responses
        16 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-22-2024, 02:06 PM
        0 responses
        8 views
        0 likes
        Last Post seqadmin  
        Working...
        X