Skip to content

Instantly share code, notes, and snippets.

@PoisonAlien
Last active August 13, 2018 07:40
Show Gist options
  • Save PoisonAlien/1ae764ec7f4e17883c4e338208dfbef4 to your computer and use it in GitHub Desktop.
Save PoisonAlien/1ae764ec7f4e17883c4e338208dfbef4 to your computer and use it in GitHub Desktop.
Download SRA runs with wget. Usage: fetch_sra SRR1067272
#!/usr/bin/env bash
#Usage example: fetch_sra SRR1067272
#Details - Downloads SRA runs with wget.
#Accepts one or more SRR run ids as input and downloads them into working directory
#Partially downloaded files will be resumed.
#Author: Anand Mayakonda <anandmt3@gmail.com>
echo "$(tput setaf 3)"
if [ $# -lt 1 ];then
echo "Need at least one SRR run ID"
echo "Usage: fetch_sra SRR1067272"
exit
fi
for sra in "$@"; do
echo "----- Downloading ${sra} ----"
wget --continue ftp://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/${sra:0:6}/${sra}/${sra}.sra
done
echo "---- Done! ----"
tput sgr0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment