text: user8601: How can I programmatically obtain ftp links to RNA seq fastq files in ENA? Here's an example of a link that I would be interested in obtaining:
  ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR824/000/SRR8240860/SRR8240860_1.fastq.gz
  In particular, is there some tool that, given the BioProject ID (here, PRJNA506829), would be able give me all ftp links for the runs in the project, or would I need to write a web scraper to do it?
  
  user3818: They have an API you can interact with.
  If you need to get files for only a few different projects:
  Search for your accession ID in the browser (leading to https://www.ebi.ac.uk/ena/browser/view/PRJNA506829). Filter the show selected columns to only fastq_ftp, click download tsv to get the list of ftp links.
  
  user8749: Here are some command lines I used for that purpose in bash.
  Simply prepare a text file containing each accession number (SRR/ERR) you want and create a for loop. Here I used prozilla to speed up downloads but you may use wget either.
  for index in $(cat list_of_accessions) ; do
  
  if [ ${#index} -eq 9 ]; then
              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/${index}/${index}_1.fastq.gz
              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/${index}/${index}_2.fastq.gz
              else
              if [ ${#index} -eq 10 ]; then
                      proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/00${index:9:9}/${index}/${index}_1.fastq.gz
                              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/00${index:9:9}/${index}/${index}_2.fastq.gz
                      else
                      if [ ${#index} -eq 11 ]; then
                       proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/0${index:9:10}/${index}/${index}_1.fastq.gz
                                          proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/0${index:9:10}/${index}/${index}_2.fastq.gz
                      else
                          proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/${index:9:11}/${index}/${index}_1.fastq.gz
                                                  proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/${index:0:6}/${index:9:11}/${index}/${index}_2.fastq.gz
                          fi
                  fi
              
              fi
  done
  ```
  
  
original_text: 8601: <p>How can I programmatically obtain ftp links to RNA seq fastq files in ENA? Here's an example of a link that I would be interested in obtaining:</p>
  <p><code>ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR824/000/SRR8240860/SRR8240860_1.fastq.gz</code></p>
  <p>In particular, is there some tool that, given the BioProject ID (here, PRJNA506829), would be able give me all ftp links for the runs in the project, or would I need to write a web scraper to do it?</p>
   3818: <p>They have an <a href="https://ena-docs.readthedocs.io/en/latest/retrieval/programmatic-access/browser-api.html" rel="nofollow noreferrer">API</a> you can interact with.</p>
  <p>If you need to get files for only a few different projects:
  Search for your accession ID in the browser (leading to <a href="https://www.ebi.ac.uk/ena/browser/view/PRJNA506829" rel="nofollow noreferrer">https://www.ebi.ac.uk/ena/browser/view/PRJNA506829</a>). Filter the show selected columns to only fastq_ftp, click download tsv to get the list of ftp links.</p>
   8749: <p>Here are some command lines I used for that purpose in bash.
  Simply prepare a text file containing each accession number (SRR/ERR) you want and create a for loop. Here I used <a href="https://github.com/totosugito/prozilla-2.0.4" rel="nofollow noreferrer">prozilla</a> to speed up downloads but you may use <code>wget</code> either.</p>
  <pre><code>for index in $(cat list_of_accessions) ; do
  
  if [ <span class="math-container">${#index} -eq 9 ]; then
              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$</span>{index:0:6}/<span class="math-container">${index}/$</span>{index}_1.fastq.gz
              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/<span class="math-container">${index:0:6}/$</span>{index}/<span class="math-container">${index}_2.fastq.gz
              else
              if [ $</span>{#index} -eq 10 ]; then
                      proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/<span class="math-container">${index:0:6}/00$</span>{index:9:9}/<span class="math-container">${index}/$</span>{index}_1.fastq.gz
                              proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/<span class="math-container">${index:0:6}/00$</span>{index:9:9}/<span class="math-container">${index}/$</span>{index}_2.fastq.gz
                      else
                      if [ <span class="math-container">${#index} -eq 11 ]; then
                       proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$</span>{index:0:6}/0<span class="math-container">${index:9:10}/$</span>{index}/<span class="math-container">${index}_1.fastq.gz
                                          proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$</span>{index:0:6}/0<span class="math-container">${index:9:10}/$</span>{index}/<span class="math-container">${index}_2.fastq.gz
                      else
                          proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$</span>{index:0:6}/<span class="math-container">${index:9:11}/$</span>{index}/<span class="math-container">${index}_1.fastq.gz
                                                  proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$</span>{index:0:6}/<span class="math-container">${index:9:11}/$</span>{index}/${index}_2.fastq.gz
                          fi
                  fi
              
              fi
  done
  <span class="math-container">```</span>
  </code></pre>
  