Skip to content

Instantly share code, notes, and snippets.

@mfansler
Created June 8, 2017 19:39
Show Gist options
  • Save mfansler/c2bb5c9ed63a584ebc662603c13adec8 to your computer and use it in GitHub Desktop.
Save mfansler/c2bb5c9ed63a584ebc662603c13adec8 to your computer and use it in GitHub Desktop.
bash commands for downloading SRRs from NCBI's SRA
#!/bin/bash
# download SRR from NCBI SRA via Aspera Connect
#
# > get-srr SRR304976
get-srr () {
SRR=${1}
SRR_6=$(echo $SRR | cut -c1-6)
ascp -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh \
-k 2 -T -l 100m \
[email protected]:/sra/sra-instant/reads/ByRun/sra/SRR/${SRR_6}/${SRR}/${SRR}.sra \
.
}
# sequentially download all SRRs listed in a file
# e.g., Run Selector accession list
#
# > get-srr-list SRR_Acc_List.txt
get-srr-list () {
while read srr; do
get-srr $srr
done <${1}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment