Thursday, 8 May 2014

Bash script to download SRA files

#!/bin/bash
#shell script to download SRA files
#
#Author: Minghui Wang, minghui.wang@mssm.edu
#Date: 8 May, 2014
#

cd $WORK_DIR #you must set this directory

#the ftp address to the sequence experiment on SRA (you must change this to the real ftp)
link=ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByExp/sra/SRX/SRX016/SRX016366/

#list all the samples shown under the link
sampleLists=`curl $link 2>/dev/null | awk '{print $NF}'`

#download *.sra files
for f in $sampleLists; do wget  $link${f}/${f}.sra 2>/dev/null; done

echo "Job completed!"

No comments:

Post a Comment