I have a directory data in which there are several fastqs like below:
SRR13456784_1.fastq
SRR13456784_2.fastq
SRR13456784_3.fastq
SRR13456785_1.fastq
SRR13456785_2.fastq
SRR13456785_3.fastq
SRR13456786_1.fastq
SRR13456786_2.fastq
SRR13456786_3.fastq
SRR19876543_1.fastq
SRR19876543_2.fastq
SRR19876543_3.fastq
SRR19876544_1.fastq
SRR19876544_2.fastq
SRR19876544_3.fastq
I have a details.txt delimited file, in which there two columns ID and Sample. I wanted to concatenate the ID fastqs of the matching sample and give the Sample name for the output.
ID Sample
SRR13456784 GJK1234567
SRR13456785 GJK1234567
SRR13456786 GJK1234567
SRR19876543 GJK2444103
SRR19876544 GJK2444103
For one of the file I concatenated like below:
cat SRR13456784_1.fastq SRR13456785_1.fastq SRR13456786_1.fastq > GSK1234567_1.fastq
cat SRR13456784_2.fastq SRR13456785_2.fastq SRR13456786_2.fastq > GSK1234567_2.fastq
cat SRR13456784_3.fastq SRR13456785_3.fastq SRR13456786_3.fastq > GSK1234567_3.fastq
The above txt file is an example, but in my original file there are 300 IDs matching to 50 samples.
Can anyone tell me how to do this concatenation and give Sample name for the output in a single script? Thank you.