I want to zip the files generated by fasterq-dump simultaneously as they are generated. The code that I tried is this.
cat SRR_Acc_List.txt | while read i
do fasterq-dump ${i} --split-spot -v --skip-technical -e 15| gzip -k ${i}> ${i}.gz
done
Haven't tried, but I believe you may add -Z
to fasterq-dump and remove -k ${i}
from gzip. In addition, I would recommend the following:
cat SRR_Acc_List.txt | xargs -i echo fasterq-dump {} --split-spot -Z -v --skip-technical -e 15 \| gzip > {}.gz | sh
It is simpler and more flexible. For example, replacing sh
with parallel
would allow you to download in parallel.
I tried this and it worked
cat SRR_Acc_List.txt | while read i ; do fasterq-dump ${i} --split-spot -v --skip-technical -e 20 ; for j in i ; do gzip ${i}.fastq ; done; done