Hi, I wanted to combine paired end reads into two files--one for R1 and one for R2. How do I do it using Linux Command line while making sure the orders are the same in the two file files?
For example, here are all the files in the directory
L001_R1_001.fastq
L002_R2_001.fastq
L004_R1_001.fastq
L005_R2_001.fastq
L001_R2_001.fastq
L003_R1_001.fastq
L004_R2_001.fastq
L006_R1_001.fastq
L002_R1_001.fastq
L003_R2_001.fastq
L005_R1_001.fastq
L006_R2_001.fastq
I wanted to do the following:
cat L001_R1_001.fastq L002_R1_001.fastq L003_R1_001.fastq L004_R1_001.fastq L005_R1_001.fastq L006_R1_001.fastq > R1.fastq
cat L001_R2_001.fastq L002_R2_001.fastq L003_R2_001.fastq L004_R2_001.fastq L005_R2_001.fastq L006_R2_001.fastq > R2.fastq
I can manually sort, copy, and paste for now. But what is a good way of doing it for large number of samples?
Thanks
For example, here are all the files in the directory
L001_R1_001.fastq
L002_R2_001.fastq
L004_R1_001.fastq
L005_R2_001.fastq
L001_R2_001.fastq
L003_R1_001.fastq
L004_R2_001.fastq
L006_R1_001.fastq
L002_R1_001.fastq
L003_R2_001.fastq
L005_R1_001.fastq
L006_R2_001.fastq
I wanted to do the following:
cat L001_R1_001.fastq L002_R1_001.fastq L003_R1_001.fastq L004_R1_001.fastq L005_R1_001.fastq L006_R1_001.fastq > R1.fastq
cat L001_R2_001.fastq L002_R2_001.fastq L003_R2_001.fastq L004_R2_001.fastq L005_R2_001.fastq L006_R2_001.fastq > R2.fastq
I can manually sort, copy, and paste for now. But what is a good way of doing it for large number of samples?
Thanks
Comment