Last active
August 29, 2015 14:28
-
-
Save katwre/897bae0c44e67baeda43 to your computer and use it in GitHub Desktop.
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
destdir = "~/" #directory where fastq files will be stored | |
nmbr_of_cores = 20 | |
SRAdb_path = '~/SRAmetadb.sqlite' | |
exp_ids=c("ERX620541") | |
require(SRAdb) | |
sqlfile <- SRAdb_path | |
if(!file.exists(SRAdb_path)) sqlfile <- getSRAdbFile() | |
sra_con <- dbConnect(SQLite(),sqlfile) #conection to SRA database | |
download = function(i, exp_ids=exp_ids, sra_con=sra_con, destdir=destdir){ | |
sra = getSRA(exp_ids[i], out_types=c('sra','study','experiment','sample','run'), sra_con, acc_only=FALSE) | |
fas = getFASTQinfo( sra$run, sra_con, srcType = "ftp" ) | |
filename <- basename(fas$ftp) | |
download.file(fas$ftp, paste(destdir, filename, sep="")) | |
} | |
require(parallel) | |
mclapply(1:length(exp_ids), | |
download, | |
exp_ids=exp_ids, | |
sra_con=sra_con, | |
destdir=destdir, | |
mc.cores=nmbr_of_cores) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment