Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
46 lines (29 sloc) 984 Bytes
---
title: "Example Query of Prediction db"
output: html_document
---
```{r}
install.packages("RSQLite")
library("RSQLite")
sqlite <- dbDriver("SQLite")
dbname <- "DGN-WB_0.5.db" ## add full path if db file not in current directory
## connect to db
db = dbConnect(sqlite,dbname)
## list tables
dbListTables(db)
dbListFields(db, "weights")
dbListFields(db, "extra")
## convenience query function
query <- function(...) dbGetQuery(db, ...)
## example queries
query('select count(*) from weights')
query('select * from weights where gene = "GATA6" ')
query('select * from weights limit 10')
## how many genes are available for given tissue?
## dbname should be the name of the sqlite database for the tissue
query('select count(*) from extra')
## select genes with R2>0.01 (this is cor>0.1)
## ths won't work for the latest MASHR-based GTEx V8 models
## this only works for models where R2 is included.
high.h2.genes <- query('select * from extra where R2 > 0.01')
```
You can’t perform that action at this time.