Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • extracting identical reads from bam file

    Hello,
    I have an alignment file of smallRNAs in bam format.
    How can I extact from this file all the identical reads in a single sequence but mantaining the reads count?
    Thank you for the help!

  • #2
    Are you trying to match a specific sequence ?

    samtools view x.bam | grep TTTTCTGCCTGTTGGGCTGGAG | awk '{print $10}' | uniq -c


    All reads with same sequence as another read, try this ...

    samtools view x.bam | awk '{print $10}' | sort --buffer-size=20G | uniq -c | awk '{if ($1!=1) print $0}'


    where x.bam is you bam file.
    fine tune the --buffer-size parameter to sort

    Comment


    • #3
      It would take longer, but swap the second awk in Richard's command line with

      Code:
      sort -nr
      To get the most common reads in order, starting with the most abundant. Tack a

      Code:
      | head -n 100
      to get only the top 100

      Comment


      • #4
        thank you! it worked!
        can I do the same from a fastq file?

        Comment


        • #5
          Yes, you might want to use awk to only print every 4th line.
          Note 1) the "mod" operator and 2) "line count" intrinsic variable in awk.
          Perl/python/C/java if you prefer can address the issue of filtering for only the sequence also.

          Comment


          • #6
            After I extracted the identical reads in a single sequence from the bam file I aligned them again to the genome. When I use igv to visualize the alignment now all the sequences are mapping in sense orientation.. even those sequences that are supposed to be antisense to the genome are shown in sense orientation. Why is that?

            Comment


            • #7
              The sequence for the read in a bam files may be reverse complemented to align to the reference.
              Reads are supposed to be properly noted as reversed in the bitwise flags field in a line/entry of sam/bam.

              You may wish to interrogate this flag for special processing.

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Advancing Precision Medicine for Rare Diseases in Children
                by seqadmin




                Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
                12-16-2024, 07:57 AM
              • seqadmin
                Recent Advances in Sequencing Technologies
                by seqadmin



                Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

                Long-Read Sequencing
                Long-read sequencing has seen remarkable advancements,...
                12-02-2024, 01:49 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 12-17-2024, 10:28 AM
              0 responses
              26 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-13-2024, 08:24 AM
              0 responses
              42 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-12-2024, 07:41 AM
              0 responses
              28 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-11-2024, 07:45 AM
              0 responses
              42 views
              0 likes
              Last Post seqadmin  
              Working...
              X