I am trying to concatenate FASTQ files that the same files in 2 different folders.
E.g.
Folder_A/Sample_10_DNA
contains
Sample_10_DNA_S7_L001_R1_001.fastq.gz,
Sample_10_DNA_S7_L001_R2_001.fastq.gz,
Sample_10_DNA_S7_L002_R2_001.fastq.gz,
Sample_10_DNA_S7_L002_R1_001.fastq.gz
and
Folder_B/Sample_10_DNA
contains
Sample_10_DNA_S7_L001_R1_001.fastq.gz
Sample_10_DNA_S7_L001_R2_001.fastq.gz
Sample_10_DNA_S7_L002_R2_001.fastq.gz
Sample_10_DNA_S7_L002_R1_001.fastq.gz
I have about 20 of these folders and am thinking of using the cat function to concatenate the FASTQ files using a BASH script. E.g.
cat Folder_A/Sample_10_DNA/Sample_10_DNA_S7_L001_R1_001.fastq.gz Folder_B/Sample_10/DNA_Sample_10_DNA_S7_L001_R1_001.fastq.gz >Folder_C/Sample_10_DNA/ample_10_DNA_S7_L001_R1_001.fastq.gz
Would appreciate any advice I can get. :)
Tried a Bash script but did not have the expertise to build it.
You can use something along the lines of this
forloop:Besides the for loop, the other key piece is the use of the
basenamecommand to get just the filename without the directory. You can collapse things to a 1-liner like this: