I'm trying to find a fast way to cat multiple fastq files in a directory, but keep the output merged files separate for each samples. For example, if I have 2 samples split across multiple lanes in a directory:
Sample1_C_S4_L001_R1_001.fastq.gz Sample1_C_S4_L001_R2_001.fastq.gz Sample1_C_S4_L002_R1_001.fastq.gz Sample1_C_S4_L002_R2_001.fastq.gz Sample1_L_S4_L001_R1_001.fastq.gz Sample1_L_S4_L001_R2_001.fastq.gz Sample1_L_S4_L002_R1_001.fastq.gz Sample1_L_S4_L002_R2_001.fastq.gz
I've tried something like:
for f in Sample1_*.fastq.gz; do
cat $f > $f-merged.fastq.gz; done
but I can't get it to work, the output I want is two files named Sample_1_C-merged.fastq.gz and Sample_1_L-merged.fastq.gz. I don't need to keep the R1 and R2 reads separate
Can you rerun demultiplexer and not split by lane.?