Last active
December 21, 2015 02:29
-
-
Save adamewing/6235852 to your computer and use it in GitHub Desktop.
SRA 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/sh | |
if [ $# -ne 1 ] | |
then | |
cat << EOF | |
usage: $0 <list of SRA location, name (whitespace seperated)> | |
For example, make a file called sra.txt and add this to it: | |
/sra/sra-instant/reads/ByExp/sra/SRX/SRX243/SRX243479 orang_kiki | |
/sra/sra-instant/reads/ByExp/sra/SRX/SRX243/SRX243480 orang_kiki | |
/sra/sra-instant/reads/ByExp/sra/SRX/SRX243/SRX243476 orang_napoleon | |
/sra/sra-instant/reads/ByExp/sra/SRX/SRX243/SRX243475 orang_napoleon | |
Then execute: | |
$0 sra.txt | |
You may need to edit the following line: | |
ascp=$HOME/aspera/connect | |
to point to your aspera installation. | |
EOF | |
exit 65 | |
fi | |
ascp=$HOME/aspera/connect | |
IFS=$'\n' | |
for line in `cat $1` | |
do | |
filepath=`echo $line | awk '{print $1}'` | |
outdir=`echo $line | awk '{print $2}'` | |
if [ ! -d $outdir ] | |
then | |
echo "$outdir does not exist, creating directory" | |
mkdir $outdir | |
fi | |
if [ ! -d $outdir ] | |
then | |
echo "failed to create directory: $outdir" | |
exit 1 | |
fi | |
$ascp/bin/ascp -i $ascp/etc/asperaweb_id_dsa.putty -QTr -l500M anonftp@ftp-private.ncbi.nlm.nih.gov:$filepath $outdir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment