Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • horvathdp
    Member
    • Dec 2011
    • 66

    Removing duplicate fastq entries from concatenated files

    I have concatenated two fastq files and I m pretty certain I have quite a few duplicates. Is there a script, program (something in BBMAP?) or common way to remove duplicates based on the sequence identifier (as opposed to a kmer-or sequence based method since I want to retain all unique fragments at this point)? Any assistance would be most appreciated.
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    Why would there be duplicates if the files came from two different lanes/flowcells?

    Comment

    • horvathdp
      Member
      • Dec 2011
      • 66

      #3
      They were not. They were two different selections (one was a selection of fragments from low copy regions of the genome based on kmers counts and the other a selection of genomic fragments that mapped to transcribed sequences) from the same sets of flow cells. Thus I am expecting a fair number of common frags from both selections.

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Originally posted by horvathdp View Post
        Is there a script, program (something in BBMAP?) or common way to remove duplicates based on the sequence identifier (as opposed to a kmer-or sequence based method since I want to retain all unique fragments at this point)?
        Since you had asked about "based on sequence identifiers" originally .. but it sounds like you are just looking to de-duplicate the actual fastq reads.

        dedupe.sh from BBMap is what you need. Depending on the size of your sequence file be ready to allocate adequate amount of RAM to the process.

        Comment

        • horvathdp
          Member
          • Dec 2011
          • 66

          #5
          If I ran dedupe, wouldn't that result in eliminating all duplicated kmers not just duplicated fragments? I want to assemble the resulting file, and I worry that normalizing the kmer counts to no greater than 1 would not be the best file for assembling. Am I wrong in this thinking? I toyed with the idea of just normalizing to 20 (which I intend to do at the end anyways, but figured that might leave cases where I still have more duplicate sequences than necessary.

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            Since dedupe can do the following

            Removes duplicate sequences, which may be specified to be exact matches, subsequences, or sequences within some percent identity.
            You can specify that only exact maches over (full length) be eliminated (I assume that is what you want)?

            Comment

            • horvathdp
              Member
              • Dec 2011
              • 66

              #7
              Possibly? If that works, then why do people not just use these essentially 1X files for assembly? I normally see a 20 or 30X coverage for assemblies. This all said, do you know of way to just eliminate duplicate entries in a fastq file based on identifiers rather than sequence?

              Comment

              • GenoMax
                Senior Member
                • Feb 2008
                • 7142

                #8
                Originally posted by horvathdp View Post
                Possibly? If that works, then why do people not just use these essentially 1X files for assembly? I normally see a 20 or 30X coverage for assemblies. This all said, do you know of way to just eliminate duplicate entries in a fastq file based on identifiers rather than sequence?
                I am not sure what you are referring to here.

                If one was certain to have every part of starting material covered (e.g. if we had a theoretical sequencer that started at one end of the chromosome and went through the entire length) then 1x sequencing would be enough. By using 30x you are ensuring that all sequenceable areas would be sampled (and be represented in) your data.

                In theory there can be no duplicate entries as far as sequence identifiers go (if you are referring to fastq headers). You would need to cat the same file twice to make a new one.

                Comment

                • horvathdp
                  Member
                  • Dec 2011
                  • 66

                  #9
                  Ahhh!!! I might have just o=found the answer to my own question:
                  ./dedupe.sh in=concat1.merged out=depuded_concat.merged rmn=t
                  the rmn=f requires both sequence and identifier to be identical.

                  sorce https://github.com/BioInfoTools/BBMa...r/sh/dedupe.sh

                  Comment

                  • GenoMax
                    Senior Member
                    • Feb 2008
                    • 7142

                    #10
                    I think I understand this finally ...

                    Original fastq dataset was sampled (two different ways) and you want to eliminate duplicates that may have been selected in both datasets leaving only one copy in the final combined file. And yes, the dedupe solution you discovered will work for that.
                    Last edited by GenoMax; 10-18-2016, 07:27 AM.

                    Comment

                    • horvathdp
                      Member
                      • Dec 2011
                      • 66

                      #11
                      In answer to your question above, I did essentially (in some cases when the two different selection protocols identified the same fragment) concat the same file twice. Thus my desire to remove the duplicates. Do you follow?

                      Comment

                      • horvathdp
                        Member
                        • Dec 2011
                        • 66

                        #12
                        Yes! Thanks

                        Comment

                        • horvathdp
                          Member
                          • Dec 2011
                          • 66

                          #13
                          NO! sadly, dedupe.sh uses too much memory for my 250G machine for me to run this on my more than 800 million frag file.

                          Any other ideas that might just sort and remove the duplicates by sequence name?

                          Comment

                          • GenoMax
                            Senior Member
                            • Feb 2008
                            • 7142

                            #14
                            How many sequences do you expect are duplicated? You could identify them (sort | uniq -d) after just pulling the headers out (grep "^@YOUR_SEQ_ID" and then remove one of the copies.

                            Comment

                            • horvathdp
                              Member
                              • Dec 2011
                              • 66

                              #15
                              I am playing with a unix-based option right now. I made a short test list of names in a file test.txt

                              @HWI-D00653:49:H2FF5BCXX:2:1101:1631:2117 1:N:0:ATCACG
                              @HWI-D00653:49:H2FF5BCXX:2:1101:1631:2117 2:N:0:ATCACG trim=1
                              @HWI-D00653:49:H2FF5BCXX:2:1101:1804:2196 1:N:0:ATCACG
                              @HWI-D00653:49:H2FF5BCXX:2:1101:2187:2119 1:N:0:ATCACG

                              and am trying to see if I can regenerate a fastq file from it using the command
                              grep -A 3 test.txt concated.fastq >out.fastq

                              If it works, I can generate a unique list using grep|sort|uniq

                              My guess is this could take a while though as the test.txt has been running for the last 5 minutes

                              Comment

                              Latest Articles

                              Collapse

                              • mylaser
                                Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                                by mylaser
                                Kheloyar – Everything You Need to Know About Kheloyaar Login and Kheoyar Id
                                If you are looking for an online gaming platform that offers a user-friendly experience, Kheloyar has become a name that many users search for. Whether you're interested in creating a new account, accessing your dashboard through Kheloyaar Login, or learning how to obtain a Kheoyar Id, understanding the platform's features and account process is essential.
                                This guide explains everything you need to know about...
                                Today, 01:13 AM
                              • SEQadmin2
                                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                                by SEQadmin2



                                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                                ...
                                07-09-2026, 11:10 AM
                              • SEQadmin2
                                Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                                by SEQadmin2



                                Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                                There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                                07-08-2026, 05:17 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, 07-09-2026, 10:04 AM
                              0 responses
                              17 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-08-2026, 10:08 AM
                              0 responses
                              10 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-07-2026, 11:05 AM
                              0 responses
                              22 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-02-2026, 11:08 AM
                              0 responses
                              31 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...