Skip to content

Instantly share code, notes, and snippets.

@tomck
Created June 9, 2016 16:13
Show Gist options
  • Save tomck/ee16f679c1aacf1c4271dc444646da77 to your computer and use it in GitHub Desktop.
Save tomck/ee16f679c1aacf1c4271dc444646da77 to your computer and use it in GitHub Desktop.
Aspera Connect (ASCP) EBI.ac.uk ascession downloader
#!/bin/bash
# When downloading files from EBI, the FTP location is translatable to the Aspera location,
# and while taking an input of Ascession numbers (one per line) this can download them over Aspera Connect.
# For example, a URL for a fastq file may look like this:
# ftp://ftp.sra.ebi.ac.uk/vol1/fastq/ERR107/004/ERR1072624/ERR1072624.fastq.gz
# Moving the first 6 characters of the ascession, the last digit following two zeroes, and the ascession number again
# allows this format to work. If the files you're trying to download are located in vol2 ... voln, change accordingly.
# [email protected]:/vol1/fastq/$start/00$lastnum/$file/$file.fastq.gz
# To use this script (assuming you have the Aspera connect app installed locally to your home directory in .aspera)
# ./aspget.sh < ascessionlist.txt
while read file
do
leng=$((${#file}-1))
start=${file:0:6}
lastnum=${file:$leng:1}
~/.aspera/connect/bin/ascp -QT -l 300m -i $HOME/.aspera/connect/etc/asperaweb_id_dsa.openssh [email protected]:/vol1/fastq/$start/00$lastnum/$file/$file.fastq.gz .
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment