Skip to content

Instantly share code, notes, and snippets.

@mfansler
Last active September 24, 2024 06:04
Show Gist options
  • Save mfansler/71f09c8b6c9a95ec4e759a8ffc488be3 to your computer and use it in GitHub Desktop.
Save mfansler/71f09c8b6c9a95ec4e759a8ffc488be3 to your computer and use it in GitHub Desktop.
Install ascp on Linux
#!/bin/bash
## How to install ascp, in a gist.
## The URI below is not persistent!
## Check for latest link: https://www.ibm.com/aspera/connect/
wget -qO- https://ak-delivery04-mul.dhe.ibm.com/sar/CMA/OSA/0a07f/0/ibm-aspera-connect_4.1.0.46-linux_x86_64.tar.gz | tar xvz
## run it
chmod +x ibm-aspera-connect_4.1.0.46-linux_x86_64.sh
./ibm-aspera-connect_4.1.0.46-linux_x86_64.sh
## add it to the path now and in the future
export PATH=$PATH:~/.aspera/connect/bin/
echo 'export PATH=$PATH:~/.aspera/connect/bin/' >> ~/.bash_profile
#!/bin/bash
## Some helper functions to put in .bash_profile
# download SRR from NCBI SRA via Aspera Connect
# Usage:
#
# $ get-srr SRR304976
#
get-srr () {
SRR=${1}
SRR_6=$(echo $SRR | cut -c1-6)
# Tune the ascp parameters for your bandwidth!
ascp -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh \
-k 2 -T -l200m \
anonftp@ftp.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByRun/sra/SRR/${SRR_6}/${SRR}/${SRR}.sra \
.
}
# download all SRRs listed in a file
get-srr-all () {
while read srr; do
get-srr $srr
done <${1}
}
@mfansler
Copy link
Author

@hmkim yes, thanks. Since IBM apparently does not persist the download links, one almost always has to go through the site to get a working URL. I try to update the one in the Gist occasionally, but with NCBI phasing out aspera, I revisit this infrequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment