NCBI SRA データベースにアクセスし、ID のリストをクエリして、出力をマトリックスに保存しようとしています。
これを行うために Bioconductor の sradb パッケージを使用していますが、データベースにアクセスしてクエリを実行できるようになりましたが、非常に遅く、ループ出力を保存する方法がわかりませんでした。
ファイル GPL11154_GSMs.txt には、私が興味を持っている ID が含まれています。これは次のようになります。
GSM616127
GSM616128
GSM616129
GSM663427
GSM665037
私が今持っているものは、反復ごとに結果を更新します。
#source("https://bioconductor.org/biocLite.R")
#biocLite("SRAdb")
library(SRAdb)
#connect to databasse
sqlfile <- getSRAdbFile()
sra_con <- dbConnect(SQLite(),sqlfile)
## lists all the tables in the SQLite database
sra_tables <- dbListTables(sra_con)
sra_tables
dbGetQuery(sra_con,'PRAGMA TABLE_INFO(study)')
## checking the structure of the tables
#dbListFields(sra_con,"experiment")
#dbListFields(sra_con,"run")
#read in file with sample IDs per platform
x <- scan("GPL11154_GSMs.txt", what="", sep="\n")
gsm_list <- strsplit(x, "[[:space:]]+") # Separate elements by one or more whitepace
for (gsm in gsm_list){
gsm_to_srr <- getSRA(search_terms = gsm, out_types = c("submission", "study", "sample","experiment", "run"), sra_con)
print(gsm_to_srr)
}