Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sazz
    Member
    • Oct 2012
    • 28

    #1

    how to merge fastq files

    Hello all,

    I got my fastq files after sequencing, but they sent them in 5 pieces for 1 sample. Do you know a way to merge them?

    Thanks!
  • mastal
    Senior Member
    • Mar 2009
    • 666

    #2
    how to merge fastq files

    Use 'cat' from the command line;

    In the directory containing your fastq files:

    $ cat *.fastq > merged.fastq

    Comment

    • sazz
      Member
      • Oct 2012
      • 28

      #3
      I keep getting "-bash: *.fastq: Permission denied" even though I have read - write and execute permissions (-rwxrwxrwx) :/ But thanks for the command, I will try to make it work.

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Are your files are in the *.fastq.gz format? Is so, you need to amend mastal's command as follows:

        Code:
        $ cat *.fastq.gz > merged_file.fastq.gz
        It is probably not required but you could keep the sequence of the pieces intact like this:

        Code:
        cat Sample_ATCACG_L002_R1_001.fastq.gz Sample_ATCACG_L002_R1_002.fastq.gz > Sample_ATCACG_L002_R1_combined.fastq.gz
        Last edited by GenoMax; 07-03-2013, 03:32 AM.

        Comment

        • mastal
          Senior Member
          • Mar 2009
          • 666

          #5
          how to merge fastq files

          Maybe your system has a problem with using the wildcard * ?

          Since you just have 5 files, try listing the individual file names,

          $ cat file1.fastq file2.fastq file3.fastq file4.fastq file5.fastq > merged.fastq

          Comment

          • sazz
            Member
            • Oct 2012
            • 28

            #6
            I have unpacked them before and they are all in .fastq format. I tried like you wrote, in the long form as:

            sudo cat I-1_ATCACG_L002_R1_001.fastq I-1_ATCACG_L002_R1_002.fastq I-1_ATCACG_L002_R1_003.fastq I-1_ATCACG_L002_R1_004.fastq I-1_ATCACG_L002_R1_005.fastq > I-1.fastq
            Still give the same error:

            -bash: I-1.fastq: Permission denied
            But what I have realized is that; I have other fastq files (from a previous sequencing but in 1 piece for each sample), they are colored in "white" in the bash screen and before, I used split option on those and it worked fine; but this time, those new fastq files are colored green. This means anything?

            Comment

            • GenoMax
              Senior Member
              • Feb 2008
              • 7142

              #7
              Hmm. You should not have to "sudo" to "cat" files. It looks to me like you do not have write permissions on the directory where these files are residing.

              See if this works. This will put the merged file in your $HOME where you should have write permissions.

              Code:
              cat I-1_ATCACG_L002_R1_001.fastq I-1_ATCACG_L002_R1_002.fastq I-1_ATCACG_L002_R1_003.fastq I-1_ATCACG_L002_R1_004.fastq I-1_ATCACG_L002_R1_005.fastq > ~/I-1.fastq

              Comment

              • sazz
                Member
                • Oct 2012
                • 28

                #8
                Worked like a dream ! thanks GenoMax.

                Comment

                Latest Articles

                Collapse

                • kinpict.com
                  Reply to 16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                  by kinpict.com
                  The part about this topic feels surprisingly grounded, and the details on the page is the bit that made me slow down. I’d keep <a href="https://kinpict.com/">ai family photo generator</a> bookmarked for later.
                  Today, 06:37 PM
                • SEQadmin2
                  16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                  by SEQadmin2





                  NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
                  10-30-2026, 06:46 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 11-12-2026, 07:59 AM
                0 responses
                28 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 11-05-2026, 09:25 AM
                0 responses
                35 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 11-03-2026, 11:54 AM
                2 responses
                56 views
                0 reactions
                Last Post kinpict.com  
                Started by SEQadmin2, 10-28-2026, 09:57 AM
                0 responses
                175 views
                0 reactions
                Last Post SEQadmin2  
                Working...