EnsDb-class: Basic usage of an Ensembl based annotation database

Description Usage Arguments Value Objects from the Class Slots Methods and Functions Author(s) See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## S4 method for signature 'EnsDb'
buildQuery(x, columns=c("gene_id", "gene_biotype",
                                    "gene_name"), filter=list(), order.by,
                             order.type="asc", skip.order.check=FALSE)

## S4 method for signature 'EnsDb'
dbconn(x)

EnsDb(x)

## S4 method for signature 'EnsDb'
ensemblVersion(x)

## S4 method for signature 'EnsDb'
lengthOf(x, of="gene", filter=list())

## S4 method for signature 'EnsDb'
listColumns(x, table, skip.keys=TRUE, ...)

## S4 method for signature 'EnsDb'
listGenebiotypes(x, ...)

## S4 method for signature 'EnsDb'
listTxbiotypes(x, ...)

## S4 method for signature 'EnsDb'
listTables(x, ...)

## S4 method for signature 'EnsDb'
metadata(x, ...)

## S4 method for signature 'EnsDb'
organism(object)

## S4 method for signature 'EnsDb'
seqinfo(x)

Arguments

(in alphabetic order)

...

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.

ensemblVersion

Returns the Ensembl version on which the package was built.

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.

Author(s)

Johannes Rainer

See Also

makeEnsembldbPackage, BasicFilter, exonsBy, genes, transcripts, makeEnsemblSQLiteFromTables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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)

## what Ensembl version if the database based on?
ensemblVersion(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)

jotsetung/ensembldb-old documentation built on May 19, 2019, 9:41 p.m.