Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • 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!

  • #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


    • #3
      New to the forum

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

      Comment


      • #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


        • #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

          • seqadmin
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM
          • seqadmin
            Strategies for Sequencing Challenging Samples
            by seqadmin


            Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
            03-22-2024, 06:39 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          17 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          22 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          46 views
          0 likes
          Last Post seqadmin  
          Working...
          X