<p>Hello,</p>

<p>I am developing customized pipelines for ChIP-seq analysis using Snakemake. I want share it, so I created model workflows that people can execute immediatly after downloading the code. It handles file conversion, mapping, peak-calling... And uses public data from GEO database. However it requires people to download these data themselves. I would like to include an automatic download of the data (sra or fastq files), ideally by using GSM/GSE or SRR identifiers.</p>

<p>So far I&#39;ve found several ways:</p>

<p>* SRA toolkit&#39;s fastq-dump function.</p>

<pre>
fastq-dump --outdir &lt;outdir&gt; &lt;srr_ids&gt;</pre>

<p>However this way is insanely slow (as stated <a href="https://www.biostars.org/p/91885/">here).</a></p>

<p>* SRAdb R package</p>

<pre>
getSRAfile( in_acc = &quot;&lt;srr_ids&gt;&quot;, sra_con = sra_con, destDir = &lt;dir&gt;, fileType = &#39;sra&#39; )</pre>

<p>This requires using this command first:</p>

<pre>
geometadbfile &lt;- getSRAdbFile(destdir = &lt;dir&gt;, destfile = &quot;SRAmetadb.sqlite.gz&quot;)</pre>

<p>which downloads locally an sqlite file of 16Go. Could be fine if I were to use it locally, but I don&#39;t want users of my pipeline to be forced to do so...</p>

<p>* Biopython&#39;s Bio.Geo module</p>

<p>Not sure how this one works... <a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc123">http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc123</a></p>

<p>The object Entrez.esearch doesn&#39;t help me finding out the ftp URL or so.<br />
<br />
<br />
I think there should be a way to download data in a more simple way?</p>

<p>Any idea will be greatly appreciated!</p>

I just found out <a href="https://www.biostars.org/p/111040/">here</a> that I can download the sra files with SRA toolkit, using the prefetch command:

    prefetch <SRR ID>

It's quite fast, the only issue is that it seems there is no output directory option. It's worth mentioning that the data is automatically downloaded to `/home/<USER>/ncbi/public/sra/<SRR ID>.sra` (not mentioned in the doc!)

I can then run fastq-dump to get fastq files:

    fastq-dump --outdir <output directory> /home/<USER>/ncbi/public/sra/<SRR ID>.sra

Surprisingly, it looks a lot faster than doing these 2 steps at once with fast-dump...