Created
January 23, 2013 15:50
-
-
Save joachimjacob/4608477 to your computer and use it in GitHub Desktop.
Aspera download script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Batch Download files from NCBI SRA using Aspera ascp on Mac / Linux | |
# to 'current_folder'/aspera_download | |
# remove space in 'Aspera\ connect' | |
# Stéphane Plaisance - VIB-BITS - Jan-2010 v1.0 | |
# updated path to the user copy of the package (2011-02-28) v1.1 | |
# –Q (for adaptive flow control) – needed for disk throttling! | |
# –T to disable encryption | |
# –k1 enable resume of failed transfers | |
# –l (maximum bandwidth of request, try 200M and go up from there) | |
# –r recursive copy | |
# –i <private key file> | |
########################################## | |
# edit path below here to fit your machine | |
########################################## | |
# findout which OS | |
thisos=`uname -a` | |
if [[ "$thisos" =~ "Linux" ]]; then | |
exefile="~/.aspera/connect/bin/ascp" | |
puttyfile="~/.aspera/connect/etc/asperaweb_id_dsa.putty" | |
echo "you run this script with Linux" | |
elif [[ $thisos =~ "Darwin" ]]; then | |
# remove space in App file name !!! | |
exefile="/Applications/AsperaConnect.app/Contents/Resources/ascp" | |
puttyfile="/Applications/AsperaConnect.app/Contents/Resources/asperaweb_id_dsa.putty" | |
echo "you run this script with macOSX" | |
else | |
echo "could not figure out your OS!" | |
exit 1 | |
fi | |
# create folder if noy exist | |
dest=`pwd` | |
mkdir -p ${dest} | |
# get URL from browser | |
# ftp://ftp-trace.ncbi.nlm.nih.gov | |
# /sra/sra-instant/reads/ByExp/litesra/ERX/ERX000/ERX000065 | |
read -p "paste here the link from SRA-lite: " -e url | |
fullpath="${url##ftp://ftp-trace.ncbi.nlm.nih.gov}" | |
ori="anonftp@ftp-private.ncbi.nlm.nih.gov:"${fullpath} | |
#CMD="${exefile} -i ${puttyfile} -k1 -QTr -l100m ${ori} ${dest}" | |
CMD="${exefile} -i ${puttyfile} -k1 -QTr -l100m anonftp@ftp-private.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByExp/litesra/SRX/SRX001/SRX001961 ${dest}" | |
eval $CMD | |
#fasp://anonftp@ftp-private.ncbi.nlm.nih.gov:22/sra/sra-instant/reads/ByRun/sra/DRR/DRR000/DRR000543/DRR000543.sra?auth=no&port=33001&bwcap=300000&targetrate=100p&policy=fair&enc=none&lockpolicy=no&locktargetrate=no&lockminrate=no&v=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment