dirpath <- "https://raw.githubusercontent.com/rqtl/qtl2data/master/DOex"
create_qv <- function(dirpath) {
# Download SNP info for DOex from web via RDS.
# snpinfo is referenced internally in the created function.
tmpfile <- tempfile()
download.file(file.path(dirpath, "c2_snpinfo.rds"), tmpfile, quiet=TRUE)
snpinfo <- readRDS(tmpfile)
unlink(tmpfile)
snpinfo <- dplyr::rename(snpinfo, pos = pos_Mbp)
function(chr, start, end) {
if(chr != "2") return(NULL)
if(start < 96.5) start <- 96.5
if(end > 98.5) end <- 98.5
if(start >= end) return(NULL)
dplyr::filter(snpinfo, .data$pos >= start, .data$pos <= end)
}
}
# \donttest{
query_variants <- create_qv(dirpath)
# }
create_qg <- function(dirpath) {
# Download Gene info for DOex from web via RDS
# gene_tbl is referenced internally in the created function.
tmpfile <- tempfile()
download.file(file.path(dirpath, "c2_genes.rds"), tmpfile, quiet=TRUE)
gene_tbl <- readRDS(tmpfile)
unlink(tmpfile)
function(chr, start, end) {
if(chr != "2") return(NULL)
if(start < 96.5) start <- 96.5
if(end > 98.5) end <- 98.5
if(start >= end) return(NULL)
dplyr::filter(gene_tbl, .data$end >= start, .data$start <= end)
}
}
# \donttest{
query_genes <- create_qg(dirpath)
# }
# Examples for probs require either FST or RDS storage of data.
Run the code above in your browser using DataLab