This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging two fastq files

I used two lanes on a flow cell for the same library. I have the fastq files now, and want to merge the data together for each duplicate sample. At what point of the downstream analysis should I merge the two, and what command do I use?

chip-seq fastq merge two lanes

2 answers

You can combine them with "cat". For example, if you have paired-end reads, you'll have 4 files, something like this:

read1_L1.fq.gz
read2_L1.fq.gz
read1_L2.fq.gz
read2_L2.fq.gz

You would combine them like this:

cat read1_L1.fq.gz read1_L2.fq.gz > read1_combined.fq.gz
cat read2_L1.fq.gz read2_L2.fq.gz > read2_combined.fq.gz

Do this as early as possible. If your sequences are single-ended then it's even easier.

I think you probably meant:

cat read1_L1.fq.gz read1_L2.fq.gz > read1_combined.fq.gz
cat read2_L1.fq.gz read2_L2.fq.gz > read2_combined.fq.gz

Why not using Heng's seqtk package, which can interleave two PE FASTA/Q files.

seqtk mergepe fq1.gz fq2.gz |gzip > pe.gz

Original question is NOT about interleaving reads. So this answer does not apply in this case.

Yes, you are right. Thank you

Log in to answer this question.