EnsDb-class

0th

Percentile

Basic usage of an Ensembl based annotation database

Get some basic information from an Ensembl based annotation package generated with makeEnsembldbPackage.

Keywords
classes
Usage
"buildQuery"(x, columns=c("gene_id", "gene_biotype", "gene_name"), filter=list(), order.by, order.type="asc", skip.order.check=FALSE)
"dbconn"(x)
EnsDb(x)
"lengthOf"(x, of="gene", filter=list())
"listColumns"(x, table, skip.keys=TRUE, ...)
"listGenebiotypes"(x, ...)
"listTxbiotypes"(x, ...)
"listTables"(x, ...)
"metadata"(x, ...)
"organism"(object)
"seqinfo"(x)
Arguments
...
Additional arguments. Not used.
columns
Columns (attributes) to be retrieved from the database tables. Use the listColumns or listTables method for a list of supported columns.
filter
list of BasicFilter instance(s) to select specific entries from the database (see examples below).
object
For organism: an EnsDb instance.
of
for lengthOf: whether the length of genes or transcripts should be retrieved from the database.
order.by
name of one of the columns above on which the results should be sorted.
order.type
if the results should be ordered ascending (asc, default) or descending (desc).
skip.keys
for listColumns: whether primary and foreign keys (not being e.g. "gene_id" or alike) should be returned or not. By default these will not be returned.
skip.order.check
if paramter order.by should be checked for allowed column names. If TRUE the function checks if the provided order criteria orders on columns present in the database tables.
table
For listColumns: optionally specify the table name for which the columns should be returned.
x
For EnsDb: the file name of the SQLite database.

For lengthOf: either an EnsDb or a GRangesList object. For all other methods an EnsDb instance.

Value

For buildQuery
A character string with the SQL query.
For connection
The SQL connection to the RSQLite database.
For EnsDb
An EnsDb instance.
For lengthOf
A named integer vector with the length of the genes or transcripts.
For listColumns
A character vector with the column names.
For listGenebiotypes
A character vector with the biotypes of the genes in the database.
For listTxbiotypes
A character vector with the biotypes of the transcripts in the database.
For listTables
A list with the names corresponding to the database table names and the elements being the attribute (column) names of the table.
For metadata
A data.frame.
For organism
A character string.
For seqinfo
A Seqinfo class.

Objects from the Class

A connection to the respective annotation database is created upon loading of an annotation package created with the makeEnsembldbPackage function. In addition, the EnsDb constructor specifying the SQLite database file can be called to generate an instance of the object (see makeEnsemblSQLiteFromTables for an example).

Slots

ensdb:
Object of class "DBIConnection": the connection to the database.
tables:
named list of database table columns with the names being the database table names. The tables are ordered by their degree, i.e. the number of other tables they can be joined with.

Methods and Functions

buildQuery
helper function building the SQL query to be used to retrieve the wanted information. Usually there is no need to call this method.
dbconn
returns the connection to the internal SQL database.
lengthOf
retrieve the length of genes or transcripts from the database. The length is the sum of the lengths of all exons of a transcript or a gene. In the latter case the exons are first reduced so that the length corresponds to the part of the genomic sequence covered by the exons.
listColumns
lists all columns of all tables in the database, or, if table is specified, of the respective table.
listGenebiotypes
lists all gene biotypes defined in the database.
listTxbiotypes
lists all transcript biotypes defined in the database.
listTables
returns a named list of database table columns (names of the list being the database table names).
metadata
returns a data.frame with the metadata information from the database, i.e. informations about the Ensembl version or Genome build the database was build upon.
organism
returns the organism name (e.g. "homo_sapiens").
seqinfo
returns the sequence/chromosome information from the database.
show
displays some informations from the database.

See Also

makeEnsembldbPackage, BasicFilter, exonsBy, genes, transcripts, makeEnsemblSQLiteFromTables

Aliases
  • EnsDb-class
  • EnsDb
  • buildQuery
  • buildQuery,EnsDb-method
  • dbconn
  • dbconn,EnsDb-method
  • listColumns
  • listColumns,EnsDb-method
  • lengthOf
  • lengthOf,GRangesList-method
  • lengthOf,EnsDb-method
  • metadata
  • metadata,EnsDb-method
  • seqinfo
  • seqinfo,EnsDb-method
  • organism
  • organism,EnsDb-method
  • show
  • show,EnsDb-method
  • listGenebiotypes
  • listGenebiotypes,EnsDb-method
  • listTxbiotypes
  • listTxbiotypes,EnsDb-method
  • listTables
  • listTables,EnsDb-method
Examples

library(EnsDb.Hsapiens.v75)

## display some information:
EnsDb.Hsapiens.v75

## show the tables along with its columns
listTables(EnsDb.Hsapiens.v75)

## for what species is this database?
organism(EnsDb.Hsapiens.v75)

## get some more information from the database
metadata(EnsDb.Hsapiens.v75)

######    buildQuery
##
## join tables gene and transcript and return gene_id and tx_id
buildQuery(EnsDb.Hsapiens.v75, columns=c("gene_id", "tx_id"))


## get all exon_ids and transcript ids of genes encoded on chromosome Y.
buildQuery(EnsDb.Hsapiens.v75, columns=c("exon_id", "tx_id"),
           filter=list(SeqnameFilter( "Y")))

#####    lengthOf
##
## length of a specific gene.
lengthOf(EnsDb.Hsapiens.v75,
         filter=list(GeneidFilter("ENSG00000000003")))

## length of a transcript
lengthOf(EnsDb.Hsapiens.v75, of="tx",
         filter=list(TxidFilter("ENST00000494424")))

## average length of all protein coding genes encoded on chromosomes X
## and Y
mean(lengthOf(EnsDb.Hsapiens.v75, of="gene",
              filter=list(GenebiotypeFilter("protein_coding"),
                  SeqnameFilter(c("X", "Y")))))

## average length of all snoRNAs
mean(lengthOf(EnsDb.Hsapiens.v75, of="gene",
              filter=list(GenebiotypeFilter("snoRNA"),
                  SeqnameFilter(c("X", "Y")))))

## list all available gene biotypes from the database:
listGenebiotypes(EnsDb.Hsapiens.v75)

## list all available transcript biotypes:
listTxbiotypes(EnsDb.Hsapiens.v75)


Documentation reproduced from package ensembldb, version 1.0.1, License: LGPL

Community examples

Looks like there are no examples yet.