Last active
January 24, 2020 19:38
-
-
Save aneeshpanoli/bf70e834bdef12b3fe5591532f954c58 to your computer and use it in GitHub Desktop.
Download sequence from NCBI SRA
This file contains hidden or 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
import os | |
#download SRA tool kit | |
def setup_sra_tool(url): | |
!wget $url | |
!gunzip sratoolkit.2.9.6-1-ubuntu64.tar.gz | |
!tar -xf sratoolkit.2.9.6-1-ubuntu64.tar | |
#download SRA file and extract fastq | |
def get_sra(url, sra_path): | |
os.chdir('/content') | |
!wget $url | |
sra_name = url[-11:] | |
os.chdir(sra_path) | |
!./fastq-dump /content/$sra_name -O /content/ | |
os.chdir('/content') | |
# url of SRA tool kit | |
url_tk= 'https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.9.6-1/sratoolkit.2.9.6-1-ubuntu64.tar.gz' | |
setup_sra_tool(url_tk) | |
# example SRA file | |
sra_url = 'https://sra-download.ncbi.nlm.nih.gov/traces/era6/ERR/ERR3014/ERR3014700' | |
tool_path = '/content/sratoolkit.2.9.6-1-ubuntu64/bin' | |
get_sra(sra_url, tool_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment