<p>A sample code is given in the salmon documentation as follows. <a href="https://combine-lab.github.io/salmon/getting_started/" rel="nofollow noreferrer">Source</a></p>
<pre><code>#!/bin/bash
mkdir data
cd data
for i in `seq 25 40`; 
do 
  mkdir DRR0161${i}; 
  cd DRR0161${i}; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_1.fastq.gz; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_2.fastq.gz; 
  cd ..; 
done
cd .. 
</code></pre>
<p>This could be modified as follows.</p>
<pre><code>#!/bin/bash
mkdir data
cd data
for i in `seq 14 17`; 
do 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR106/0${i}/SRR106112${i}/SRR106112${i}_1.fastq.gz; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR106/0${i}/SRR106112${i}/SRR106112${i}_2.fastq.gz; 
done
cd .. 
</code></pre>
<p>You can save the code as a shell script and run it from the linux terminal. For example <code>bash download_fastq.sh</code></p>

CC BY-SA 4.0
2020-07-18T02:18:07.913Z
2020-07-18T02:18:07.913Z
Balan
<p>Make a list.txt file containing a single column of SRA numbers to download.</p>
<p>then:</p>
<p><code>for i in $(cat list.txt); do echo $i; date; fasterq-dump -S $i; done</code></p>
<p>It works well to use NCBI's web interface to find SRA samples of interest, download and open findings in Excel, then copy single column containing SRA numbers and paste into list.txt using document editor such as vim.</p>
<p>After downloading including the &quot;R&quot; can be nice:</p>
<p><code>for i in *_1.fastq; do mv $i ${i%_1.fastq}_R1.fastq; done</code></p>
<p><code>for i in *_2.fastq; do mv $i ${i%_2.fastq}_R1.fastq; done</code></p>
<p>and zip:</p>
<p><code>pigz *fastq</code></p>
<p>If needed a conda option for downloading fasterq-dump:</p>
<p><code>conda install -c bioconda sra-tools</code></p>

CC BY-SA 4.0
2020-07-23T13:35:08.460Z
2020-07-23T13:35:08.460Z
Stuber
<p>You can use <code>parallel</code>.</p>
<pre><code>parallel -j 3 fastq-dump {} ::: SRR10611214 SRR10611215 SRR10611215 SRR10611216 SRR10611217
</code></pre>
<p>The option <code>-j</code> says how many jobs should maximal run parallel. So in this case maximal 3 identifier would be handled at the same time.</p>
<p>How many jobs you can run parallel depends on your machine.</p>
<p>You can also take a look at <a href="https://github.com/rvalieris/parallel-fastq-dump" rel="nofollow noreferrer">parallel-fastq-dump</a>.</p>

CC BY-SA 4.0
2020-07-22T21:59:10.343Z
2020-07-22T21:59:10.343Z
Mr_Z
<p>I want to download the following fastq files at the same time in Salmon:</p>
<pre><code> - SRR10611214
 - SRR10611215
 - SRR10611215
 - SRR10611216
 - SRR10611217
</code></pre>
<p>Is there a way to do this using a bash for loop or fastq-dump? or prefetch</p>

CC BY-SA 4.0
2020-07-18T20:49:39.547Z
https://www.biostars.org/p/347050/ you can refer to this answer. Here you are trying each read separately. it would be better if you can download and split the read.
kcm
<rna-seq><fastq><data-download><salmon>
Download multiple fastq files using fastq-dump
# Download multiple fastq files using fastq-dump

(Asked by: username_0 on 2020-07-17)

I want to download the following fastq files at the same time in Salmon:
 - SRR10611214
 - SRR10611215
 - SRR10611215
 - SRR10611216
 - SRR10611217

Is there a way to do this using a bash for loop or fastq-dump? or prefetch

**Tags:** rna-seq, fastq, data-download, salmon
> **Comments:**
> **username_1**: https://www.biostars.org/p/347050/ you can refer to this answer. Here you are trying each read separately. it would be better if you can download and split the read.  

---

## 3 answers

### Answer by username_2 on 2020-07-18. Score: 4

A sample code is given in the salmon documentation as follows. Source
#!/bin/bash
mkdir data
cd data
for i in `seq 25 40`; 
do 
  mkdir DRR0161${i}; 
  cd DRR0161${i}; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_1.fastq.gz; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_2.fastq.gz; 
  cd ..; 
done
cd .. 

This could be modified as follows.
#!/bin/bash
mkdir data
cd data
for i in `seq 14 17`; 
do 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR106/0${i}/SRR106112${i}/SRR106112${i}_1.fastq.gz; 
  wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR106/0${i}/SRR106112${i}/SRR106112${i}_2.fastq.gz; 
done
cd .. 

You can save the code as a shell script and run it from the linux terminal. For example bash download_fastq.sh


---

### Answer by username_3 on 2020-07-23. Score: 1

Make a list.txt file containing a single column of SRA numbers to download.

then:

`for i in $(cat list.txt); do echo $i; date; fasterq-dump -S $i; done`

It works well to use NCBI's web interface to find SRA samples of interest, download and open findings in Excel, then copy single column containing SRA numbers and paste into list.txt using document editor such as vim.

After downloading including the "R" can be nice:

`for i in *_1.fastq; do mv $i ${i%_1.fastq}_R1.fastq; done`

`for i in *_2.fastq; do mv $i ${i%_2.fastq}_R1.fastq; done`

and zip:

`pigz *fastq`

If needed a conda option for downloading fasterq-dump:

`conda install -c bioconda sra-tools`


---

### Answer by username_4 on 2020-07-22. Score: 0

You can use parallel.
parallel -j 3 fastq-dump {} ::: SRR10611214 SRR10611215 SRR10611215 SRR10611216 SRR10611217

The option -j says how many jobs should maximal run parallel. So in this case maximal 3 identifier would be handled at the same time.
How many jobs you can run parallel depends on your machine.
You can also take a look at parallel-fastq-dump.


---

