EnsDb-class {ensembldb} | R Documentation

## Basic usage of an Ensembl based annotation database

### Description

The `EnsDb` class provides access to an Ensembl-based annotation package. This help page describes functions to get some basic informations from such an object.

### Usage

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

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

    ## 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'
    returnFilterColumns(x)

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

    ## S4 replacement method for signature 'EnsDb'
    returnFilterColumns(x) <- value

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

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

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

### Arguments

(in alphabetic order)

`...` | Additional arguments. Not used.
`object` | For `organism`: an `EnsDb` instance.
`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.
`table` | For `listColumns`: optionally specify the table name(s) for which the columns should be returned.
`value` | For `returnFilterColumns`: a logical of length one specifying whether columns that are used for eventual filters should also be returned.
`x` | An `EnsDb` instance.

### Value

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 `returnFilterColumns`

  A logical of length 1.

For `seqinfo`

  A `Seqinfo` class.

For `updateEnsDb`

  A `EnsDb` object.

### 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.

.properties

  Internal list storing user-defined properties. Should not be directly accessed.

### Methods and Functions

dbconn

  Returns the connection to the internal SQL database.

ensemblVersion

  Returns the Ensembl version on which the package was built.

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"`).

returnFilterColumns, returnFilterColumns<-

  Get or set the option which results in columns that are used for eventually specified filters to be added as result columns. The default value is `TRUE` (i.e. filter columns are returned).

seqinfo

  Returns the sequence/chromosome information from the database.

seqlevels

  Returns the chromosome/sequence names that are available in the database.

show

  Displays some informations from the database.

updateEnsDb

  Updates the `EnsDb` object to the most recent implementation.

### Note

While a column named `"tx_name"` is listed by the `listTables` and `listColumns` method, no such column is present in the database. Transcript names returned by the methods are actually the transcript IDs. This virtual column was only introduced to be compliant with `TxDb` objects (which provide transcript names).

### Author(s)

Johannes Rainer

### See Also

`EnsDb`, `makeEnsembldbPackage`, `exonsBy`, `genes`, `transcripts`, `makeEnsemblSQLiteFromTables`

`addFilter` for globally adding filters to an `EnsDb` object.

### Examples

    library(EnsDb.Hsapiens.v86)

    ## Display some information:
    EnsDb.Hsapiens.v86

    ## Show the tables along with its columns
    listTables(EnsDb.Hsapiens.v86)

    ## For what species is this database?
    organism(EnsDb.Hsapiens.v86)

    ## What Ensembl version if the database based on?
    ensemblVersion(EnsDb.Hsapiens.v86)

    ## Get some more information from the database
    metadata(EnsDb.Hsapiens.v86)

    ## Get all the sequence names.
    seqlevels(EnsDb.Hsapiens.v86)

    ## List all available gene biotypes from the database:
    listGenebiotypes(EnsDb.Hsapiens.v86)

    ## List all available transcript biotypes:
    listTxbiotypes(EnsDb.Hsapiens.v86)

    ## Update the EnsDb; this is in most instances not necessary at all.
    updateEnsDb(EnsDb.Hsapiens.v86)

    ######    returnFilterColumns
    returnFilterColumns(EnsDb.Hsapiens.v86)

    ## Get protein coding genes on chromosome X, specifying to return
    ## only columns gene_name as additional column.
    genes(EnsDb.Hsapiens.v86, filter=list(SeqNameFilter("X"),
                                          GeneBiotypeFilter("protein_coding")),
          columns=c("gene_name"))
    ## By default we get also the gene_biotype column as the data was filtered
    ## on this column.

    ## This can be changed using the returnFilterColumns option
    returnFilterColumns(EnsDb.Hsapiens.v86) <- FALSE
    genes(EnsDb.Hsapiens.v86, filter=list(SeqNameFilter("X"),
                                          GeneBiotypeFilter("protein_coding")),
          columns=c("gene_name"))

[Package ensembldb version 2.12.1 Index]