I am running the following bash script as is. I.e. sequentially. Note that the prefetch and fastq-dump are calls for downloading files from a database, and _shrink is a C++ program that I have made to shrink the fetched files (due to limited storage).
Is it possible for me to use threads for this? It takes ages to download the files.
Important! The commands inside each block must run sequentially, but the blocks are allowed to run in parallel. Moreover, I would like to only run 10 blocks at a time.
#!/bin/bash
g++ -std=c++11 shrink_files.cpp -o _shrink
#block1
prefetch SRR837459
fastq-dump --fasta 0 SRR837459
rm ../../sra_sequences/sra/SRR837459.sra
./_shrink SRR837459
rm SRR837459.fasta
echo "SRR837459" >> list_of_done.txt
#block1
prefetch SRR805782
fastq-dump --fasta 0 SRR805782
rm ../../sra_sequences/sra/SRR805782.sra
./_shrink SRR805782
rm SRR805782.fasta
echo "SRR805782" >> list_of_done.txt
#... more blocks