create_ensembl_query_func: Create a function to query genes

Description Usage Arguments Details Value Examples

View source: R/create_ensembl_query_func.R

Description

Create a function that will query genes from a GenomicRanges object with ensembl gene annotations and return a data frame with gene information for a selected region.

Usage

1
create_ensembl_query_func(ensembl, full_genes_only = TRUE)

Arguments

ensembl

Ensembl gene annotations as a GenomicRanges object.

full_genes_only

If TRUE, filter by type=="gene"

Details

Note that this function assumes that the database has start and end fields that are in basepairs, but the selection uses positions in Mbp, and the output data frame should have start and stop columns in Mbp.

Value

Function with three arguments, chr, start, and end, which returns a data frame with the genes overlapping that region, with start and end being in Mbp. The output should contain at least the columns Name, chr, start, and stop, the latter two being positions in Mbp.

Examples

1
2
3
4
5
6
7
8
# small version of ensembl data
ensembl <- readRDS(system.file("extdata", "ensembl_small.rds", package="qtl2bioc"))

# create query function, pulling only full genes
query_ensembl <- create_ensembl_query_func(ensembl)

# genes on chr 2 overlapping (96.5 - 97.0)
genes <- query_ensembl("2", 96.5, 97.0)

rqtl/qtl2bioc documentation built on Jan. 2, 2021, 1:53 a.m.