Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rkizen
    Member
    • Jun 2013
    • 20

    #1

    Get unique reads when merging FastQ Files from BAM

    Hello,
    I have paired end fastq files that were retrieved from two bam files using BamUtil and I would like to merge the respective fastq files. The only issue is that since they come from two bam files that were created using the same original fastq reads, there are many reads which are shared between the two respective files (ie bamfile1_reads_1.fastq has shared reads with bamfile2_reads_1.fastq). Are there any tools that would allow me to merge the files while ensuring that there are no duplicated reads in the merged fastq file?

    Thank you!
  • Heisman
    Senior Member
    • Dec 2010
    • 534

    #2
    Maybe others will have ideas, but if they are exactly the same (ie, identical headers, bases, quality scores), you could convert them to one line, combine the files, sort them, and then use uniq, as shown here kind of: http://thegenomefactory.blogspot.com...-with-ngs.html

    So, with file1.fq and file2.fq:
    Code:
    cat file1.fq file2.fq > file_combined.fq
    paste - - - - file_combined.fq | sort | uniq > file_combined_unique.fq

    Comment

    • komalsrathi
      Member
      • Aug 2013
      • 14

      #3
      New to the forum

      how do I create a new thread?
      Komal Rathi
      Bioinformatics Application Developer
      University of Pennsylvania

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Originally posted by komalsrathi View Post
        how do I create a new thread?
        SeqAnswers --> Forums (in site navigation menu) --> Select appropriate forum (e.g. Bioinformatics) --> "New Thread" button in the top left corner.

        Comment

        • rkizen
          Member
          • Jun 2013
          • 20

          #5
          Originally posted by Heisman View Post
          Maybe others will have ideas, but if they are exactly the same (ie, identical headers, bases, quality scores), you could convert them to one line, combine the files, sort them, and then use uniq, as shown here kind of: http://thegenomefactory.blogspot.com...-with-ngs.html

          So, with file1.fq and file2.fq:
          Code:
          cat file1.fq file2.fq > file_combined.fq
          paste - - - - file_combined.fq | sort | uniq > file_combined_unique.fq
          Paste is a very cool command. Thank you for the link! Luckily the reads are identical.

          Just as a note to anyone else who will be doing this, you may have to change your sort tmp directory when sorting "sort -T dir" if you are sorting a large fastq file and have limited space on your default tmp directory.

          Oh and remember to tr "\t" "\n" to get it back in fastq format!

          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, 10-22-2026, 11:13 AM
          0 responses
          45 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-22-2026, 10:48 AM
          0 responses
          34 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-15-2026, 10:52 AM
          0 responses
          46 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-14-2026, 05:39 AM
          0 responses
          46 views
          0 reactions
          Last Post SEQadmin2  
          Working...