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
          Multiomics Techniques Advancing Disease Research
          by seqadmin


          New and advanced multiomics tools and technologies have opened new avenues of research and markedly enhanced various disciplines such as disease research and precision medicine1. The practice of merging diverse data from various ‘omes increasingly provides a more holistic understanding of biological systems. As Maddison Masaeli, Co-Founder and CEO at Deepcell, aptly noted, “You can't explain biology in its complex form with one modality.”

          A major leap in the field has
          ...
          02-08-2024, 06:33 AM
        • seqadmin
          The 3D Genome: New Technologies and Emerging Insights
          by seqadmin


          The study of three-dimensional (3D) genomics explores the spatial structure of genomes and their role in processes like gene expression and DNA replication. By employing innovative technologies, researchers can study these arrangements to discover their role in various biological processes. Scientists continue to find new ways in which the organization of DNA is involved in processes like development1 and disease2.

          Basic Organization and Structure
          Understanding...
          01-22-2024, 03:25 PM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Yesterday, 08:57 AM
        0 responses
        12 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 02-14-2024, 09:19 AM
        0 responses
        43 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 02-12-2024, 03:37 PM
        0 responses
        409 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 02-09-2024, 03:36 PM
        0 responses
        648 views
        0 likes
        Last Post seqadmin  
        Working...
        X