Hello let's say I have a directory that have multiple paired end reads and want to create a file containing the corresponding pairs, so this is something like this:
cat R1.fastq,gz R2.fastq.gz > R.fastq.gz
but given the fact that I have multiple libraries, doing this manually could take a lot of time, so how can I automatize this task to all my libraries using for loop ?
I tried with the below code but it stores all the multiple files in each output file:
R1='*_1.fastq.gz'
R2='*_2.fastq.gz'
for i in *_1.fastq.gz
do
base=$(basename $i "_1.fastq.gz")
cat $R1 $R2 > ${base}.fastq.gz
done
Thanks for reading :)
PD: IMPORTANT: this way of concatenating reads is needed for MASH program, for other programs (e.g some assembly programs) the best thing to save this files is using interleave formats.
this worked, thanks :)