Last active
June 21, 2019 07:26
-
-
Save danielecook/1fe7c42ded1e05fabe35 to your computer and use it in GitHub Desktop.
Download data from the sequence read archive and convert to fastq format
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
Download_SRP_Runs() { | |
SRP_IDs=`esearch -db sra -query $1 | efetch -format docsum | xtract -pattern DocumentSummary -element Run@acc | tr '\t' '\n'` | |
for r in ${SRP_IDs}; do | |
url="ftp://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/${r:0:6}/${r}/${r}.sra" | |
wget $url | |
done; | |
} | |
Download_SRP_Runs <SRP ID GOES HERE> | |
# Convert to fastq | |
parallel fastq-dump --split-files --gzip {} ::: *.sra | |
# Perform quality control | |
parallel fastqc {} ::: *.fastq.gz |
url="ftp://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/${r:0:6}/${r}/${r}.sra"
Just seeing this but thank you very much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just to point out that the way the
${url}
is being constructed will fail in some instances. For example SRR1049814 will generate a url that does not exist:The problem lays in in this bit:
${r:0:9}
that truncates this SRR. According to the manual, it should be the full accession number rather than a truncated portion:The solution is small change in the construction of the url:
Your script does of course work for most cases, I just happened to stumble across the SRR that breaks it :)