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.

# S4 method for EnsDb
dbconn(x)

# S4 method for EnsDb
ensemblVersion(x)

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

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

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

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

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

# S4 method for EnsDb
organism(object)

# S4 method for EnsDb
returnFilterColumns(x)

# S4 method for EnsDb
returnFilterColumns(x)

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

# S4 method for EnsDb
seqinfo(x)

# S4 method for EnsDb
seqlevels(x)

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

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

Arguments

(in alphabetic order)

...

Additional arguments. Not used.

metadata

For listColumns: whether columns from the metadata database column should also be returned. Defaults to metadata = FALSE.

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.

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.

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.

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

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
#> EnsDb for Ensembl:
#> |Backend: SQLite
#> |Db type: EnsDb
#> |Type of Gene ID: Ensembl Gene ID
#> |Supporting package: ensembldb
#> |Db created by: ensembldb package from Bioconductor
#> |script_version: 0.3.0
#> |Creation time: Thu May 18 16:32:27 2017
#> |ensembl_version: 86
#> |ensembl_host: localhost
#> |Organism: homo_sapiens
#> |taxonomy_id: 9606
#> |genome_build: GRCh38
#> |DBSCHEMAVERSION: 2.0
#> | No. of genes: 63970.
#> | No. of transcripts: 216741.
#> |Protein data available.

## Show the tables along with its columns
listTables(EnsDb.Hsapiens.v86)
#> $gene
#> [1] "gene_id"          "gene_name"        "gene_biotype"     "gene_seq_start"  
#> [5] "gene_seq_end"     "seq_name"         "seq_strand"       "seq_coord_system"
#> [9] "symbol"          
#> 
#> $tx
#> [1] "tx_id"            "tx_biotype"       "tx_seq_start"     "tx_seq_end"      
#> [5] "tx_cds_seq_start" "tx_cds_seq_end"   "gene_id"          "tx_name"         
#> 
#> $tx2exon
#> [1] "tx_id"    "exon_id"  "exon_idx"
#> 
#> $exon
#> [1] "exon_id"        "exon_seq_start" "exon_seq_end"  
#> 
#> $chromosome
#> [1] "seq_name"    "seq_length"  "is_circular"
#> 
#> $protein
#> [1] "tx_id"            "protein_id"       "protein_sequence"
#> 
#> $uniprot
#> [1] "protein_id"           "uniprot_id"           "uniprot_db"          
#> [4] "uniprot_mapping_type"
#> 
#> $protein_domain
#> [1] "protein_id"            "protein_domain_id"     "protein_domain_source"
#> [4] "interpro_accession"    "prot_dom_start"        "prot_dom_end"         
#> 
#> $entrezgene
#> [1] "gene_id"  "entrezid"
#> 
#> $metadata
#> [1] "name"  "value"
#> 

## For what species is this database?
organism(EnsDb.Hsapiens.v86)
#> [1] "Homo sapiens"

## What Ensembl version if the database based on?
ensemblVersion(EnsDb.Hsapiens.v86)
#> [1] "86"

## Get some more information from the database
metadata(EnsDb.Hsapiens.v86)
#>                  name                               value
#> 1             Db type                               EnsDb
#> 2     Type of Gene ID                     Ensembl Gene ID
#> 3  Supporting package                           ensembldb
#> 4       Db created by ensembldb package from Bioconductor
#> 5      script_version                               0.3.0
#> 6       Creation time            Thu May 18 16:32:27 2017
#> 7     ensembl_version                                  86
#> 8        ensembl_host                           localhost
#> 9            Organism                        homo_sapiens
#> 10        taxonomy_id                                9606
#> 11       genome_build                              GRCh38
#> 12    DBSCHEMAVERSION                                 2.0

## Get all the sequence names.
seqlevels(EnsDb.Hsapiens.v86)
#>   [1] "1"                                     
#>   [2] "10"                                    
#>   [3] "11"                                    
#>   [4] "12"                                    
#>   [5] "13"                                    
#>   [6] "14"                                    
#>   [7] "15"                                    
#>   [8] "16"                                    
#>   [9] "17"                                    
#>  [10] "18"                                    
#>  [11] "19"                                    
#>  [12] "2"                                     
#>  [13] "20"                                    
#>  [14] "21"                                    
#>  [15] "22"                                    
#>  [16] "3"                                     
#>  [17] "4"                                     
#>  [18] "5"                                     
#>  [19] "6"                                     
#>  [20] "7"                                     
#>  [21] "8"                                     
#>  [22] "9"                                     
#>  [23] "CHR_HG107_PATCH"                       
#>  [24] "CHR_HG126_PATCH"                       
#>  [25] "CHR_HG1311_PATCH"                      
#>  [26] "CHR_HG1342_HG2282_PATCH"               
#>  [27] "CHR_HG1362_PATCH"                      
#>  [28] "CHR_HG142_HG150_NOVEL_TEST"            
#>  [29] "CHR_HG151_NOVEL_TEST"                  
#>  [30] "CHR_HG1651_PATCH"                      
#>  [31] "CHR_HG1832_PATCH"                      
#>  [32] "CHR_HG2021_PATCH"                      
#>  [33] "CHR_HG2022_PATCH"                      
#>  [34] "CHR_HG2023_PATCH"                      
#>  [35] "CHR_HG2030_PATCH"                      
#>  [36] "CHR_HG2058_PATCH"                      
#>  [37] "CHR_HG2062_PATCH"                      
#>  [38] "CHR_HG2063_PATCH"                      
#>  [39] "CHR_HG2066_PATCH"                      
#>  [40] "CHR_HG2072_PATCH"                      
#>  [41] "CHR_HG2095_PATCH"                      
#>  [42] "CHR_HG2104_PATCH"                      
#>  [43] "CHR_HG2116_PATCH"                      
#>  [44] "CHR_HG2128_PATCH"                      
#>  [45] "CHR_HG2191_PATCH"                      
#>  [46] "CHR_HG2213_PATCH"                      
#>  [47] "CHR_HG2217_PATCH"                      
#>  [48] "CHR_HG2232_PATCH"                      
#>  [49] "CHR_HG2233_PATCH"                      
#>  [50] "CHR_HG2235_PATCH"                      
#>  [51] "CHR_HG2239_PATCH"                      
#>  [52] "CHR_HG2247_PATCH"                      
#>  [53] "CHR_HG2249_PATCH"                      
#>  [54] "CHR_HG2288_HG2289_PATCH"               
#>  [55] "CHR_HG2290_PATCH"                      
#>  [56] "CHR_HG2291_PATCH"                      
#>  [57] "CHR_HG2334_PATCH"                      
#>  [58] "CHR_HG26_PATCH"                        
#>  [59] "CHR_HG986_PATCH"                       
#>  [60] "CHR_HSCHR10_1_CTG1"                    
#>  [61] "CHR_HSCHR10_1_CTG2"                    
#>  [62] "CHR_HSCHR10_1_CTG3"                    
#>  [63] "CHR_HSCHR10_1_CTG4"                    
#>  [64] "CHR_HSCHR10_1_CTG6"                    
#>  [65] "CHR_HSCHR11_1_CTG1_2"                  
#>  [66] "CHR_HSCHR11_1_CTG5"                    
#>  [67] "CHR_HSCHR11_1_CTG6"                    
#>  [68] "CHR_HSCHR11_1_CTG7"                    
#>  [69] "CHR_HSCHR11_1_CTG8"                    
#>  [70] "CHR_HSCHR11_2_CTG1"                    
#>  [71] "CHR_HSCHR11_2_CTG1_1"                  
#>  [72] "CHR_HSCHR11_3_CTG1"                    
#>  [73] "CHR_HSCHR12_1_CTG1"                    
#>  [74] "CHR_HSCHR12_1_CTG2_1"                  
#>  [75] "CHR_HSCHR12_2_CTG1"                    
#>  [76] "CHR_HSCHR12_2_CTG2"                    
#>  [77] "CHR_HSCHR12_2_CTG2_1"                  
#>  [78] "CHR_HSCHR12_3_CTG2"                    
#>  [79] "CHR_HSCHR12_3_CTG2_1"                  
#>  [80] "CHR_HSCHR12_4_CTG2"                    
#>  [81] "CHR_HSCHR12_4_CTG2_1"                  
#>  [82] "CHR_HSCHR12_5_CTG2"                    
#>  [83] "CHR_HSCHR12_5_CTG2_1"                  
#>  [84] "CHR_HSCHR12_6_CTG2_1"                  
#>  [85] "CHR_HSCHR13_1_CTG1"                    
#>  [86] "CHR_HSCHR13_1_CTG3"                    
#>  [87] "CHR_HSCHR13_1_CTG5"                    
#>  [88] "CHR_HSCHR13_1_CTG8"                    
#>  [89] "CHR_HSCHR14_1_CTG1"                    
#>  [90] "CHR_HSCHR14_2_CTG1"                    
#>  [91] "CHR_HSCHR14_3_CTG1"                    
#>  [92] "CHR_HSCHR14_7_CTG1"                    
#>  [93] "CHR_HSCHR15_1_CTG1"                    
#>  [94] "CHR_HSCHR15_1_CTG3"                    
#>  [95] "CHR_HSCHR15_1_CTG8"                    
#>  [96] "CHR_HSCHR15_2_CTG3"                    
#>  [97] "CHR_HSCHR15_2_CTG8"                    
#>  [98] "CHR_HSCHR15_3_CTG3"                    
#>  [99] "CHR_HSCHR15_3_CTG8"                    
#> [100] "CHR_HSCHR15_4_CTG8"                    
#> [101] "CHR_HSCHR15_5_CTG8"                    
#> [102] "CHR_HSCHR15_6_CTG8"                    
#> [103] "CHR_HSCHR16_1_CTG1"                    
#> [104] "CHR_HSCHR16_1_CTG3_1"                  
#> [105] "CHR_HSCHR16_2_CTG3_1"                  
#> [106] "CHR_HSCHR16_3_CTG1"                    
#> [107] "CHR_HSCHR16_4_CTG1"                    
#> [108] "CHR_HSCHR16_4_CTG3_1"                  
#> [109] "CHR_HSCHR16_5_CTG1"                    
#> [110] "CHR_HSCHR16_CTG2"                      
#> [111] "CHR_HSCHR17_10_CTG4"                   
#> [112] "CHR_HSCHR17_1_CTG1"                    
#> [113] "CHR_HSCHR17_1_CTG2"                    
#> [114] "CHR_HSCHR17_1_CTG4"                    
#> [115] "CHR_HSCHR17_1_CTG5"                    
#> [116] "CHR_HSCHR17_1_CTG9"                    
#> [117] "CHR_HSCHR17_2_CTG1"                    
#> [118] "CHR_HSCHR17_2_CTG2"                    
#> [119] "CHR_HSCHR17_2_CTG4"                    
#> [120] "CHR_HSCHR17_2_CTG5"                    
#> [121] "CHR_HSCHR17_3_CTG2"                    
#> [122] "CHR_HSCHR17_3_CTG4"                    
#> [123] "CHR_HSCHR17_4_CTG4"                    
#> [124] "CHR_HSCHR17_5_CTG4"                    
#> [125] "CHR_HSCHR17_6_CTG4"                    
#> [126] "CHR_HSCHR17_7_CTG4"                    
#> [127] "CHR_HSCHR17_8_CTG4"                    
#> [128] "CHR_HSCHR17_9_CTG4"                    
#> [129] "CHR_HSCHR18_1_CTG1_1"                  
#> [130] "CHR_HSCHR18_1_CTG2_1"                  
#> [131] "CHR_HSCHR18_2_CTG1_1"                  
#> [132] "CHR_HSCHR18_2_CTG2"                    
#> [133] "CHR_HSCHR18_2_CTG2_1"                  
#> [134] "CHR_HSCHR18_3_CTG2_1"                  
#> [135] "CHR_HSCHR18_5_CTG1_1"                  
#> [136] "CHR_HSCHR18_ALT21_CTG2_1"              
#> [137] "CHR_HSCHR18_ALT2_CTG2_1"               
#> [138] "CHR_HSCHR19KIR_ABC08_A1_HAP_CTG3_1"    
#> [139] "CHR_HSCHR19KIR_ABC08_AB_HAP_C_P_CTG3_1"
#> [140] "CHR_HSCHR19KIR_ABC08_AB_HAP_T_P_CTG3_1"
#> [141] "CHR_HSCHR19KIR_FH05_A_HAP_CTG3_1"      
#> [142] "CHR_HSCHR19KIR_FH05_B_HAP_CTG3_1"      
#> [143] "CHR_HSCHR19KIR_FH06_A_HAP_CTG3_1"      
#> [144] "CHR_HSCHR19KIR_FH06_BA1_HAP_CTG3_1"    
#> [145] "CHR_HSCHR19KIR_FH08_A_HAP_CTG3_1"      
#> [146] "CHR_HSCHR19KIR_FH08_BAX_HAP_CTG3_1"    
#> [147] "CHR_HSCHR19KIR_FH13_A_HAP_CTG3_1"      
#> [148] "CHR_HSCHR19KIR_FH13_BA2_HAP_CTG3_1"    
#> [149] "CHR_HSCHR19KIR_FH15_A_HAP_CTG3_1"      
#> [150] "CHR_HSCHR19KIR_FH15_B_HAP_CTG3_1"      
#> [151] "CHR_HSCHR19KIR_G085_A_HAP_CTG3_1"      
#> [152] "CHR_HSCHR19KIR_G085_BA1_HAP_CTG3_1"    
#> [153] "CHR_HSCHR19KIR_G248_A_HAP_CTG3_1"      
#> [154] "CHR_HSCHR19KIR_G248_BA2_HAP_CTG3_1"    
#> [155] "CHR_HSCHR19KIR_GRC212_AB_HAP_CTG3_1"   
#> [156] "CHR_HSCHR19KIR_GRC212_BA1_HAP_CTG3_1"  
#> [157] "CHR_HSCHR19KIR_LUCE_A_HAP_CTG3_1"      
#> [158] "CHR_HSCHR19KIR_LUCE_BDEL_HAP_CTG3_1"   
#> [159] "CHR_HSCHR19KIR_RP5_B_HAP_CTG3_1"       
#> [160] "CHR_HSCHR19KIR_RSH_A_HAP_CTG3_1"       
#> [161] "CHR_HSCHR19KIR_RSH_BA2_HAP_CTG3_1"     
#> [162] "CHR_HSCHR19KIR_T7526_A_HAP_CTG3_1"     
#> [163] "CHR_HSCHR19KIR_T7526_BDEL_HAP_CTG3_1"  
#> [164] "CHR_HSCHR19LRC_COX1_CTG3_1"            
#> [165] "CHR_HSCHR19LRC_COX2_CTG3_1"            
#> [166] "CHR_HSCHR19LRC_LRC_I_CTG3_1"           
#> [167] "CHR_HSCHR19LRC_LRC_J_CTG3_1"           
#> [168] "CHR_HSCHR19LRC_LRC_S_CTG3_1"           
#> [169] "CHR_HSCHR19LRC_LRC_T_CTG3_1"           
#> [170] "CHR_HSCHR19LRC_PGF1_CTG3_1"            
#> [171] "CHR_HSCHR19LRC_PGF2_CTG3_1"            
#> [172] "CHR_HSCHR19_1_CTG2"                    
#> [173] "CHR_HSCHR19_1_CTG3_1"                  
#> [174] "CHR_HSCHR19_2_CTG2"                    
#> [175] "CHR_HSCHR19_2_CTG3_1"                  
#> [176] "CHR_HSCHR19_3_CTG2"                    
#> [177] "CHR_HSCHR19_3_CTG3_1"                  
#> [178] "CHR_HSCHR19_4_CTG2"                    
#> [179] "CHR_HSCHR19_4_CTG3_1"                  
#> [180] "CHR_HSCHR19_5_CTG2"                    
#> [181] "CHR_HSCHR1_1_CTG11"                    
#> [182] "CHR_HSCHR1_1_CTG3"                     
#> [183] "CHR_HSCHR1_1_CTG31"                    
#> [184] "CHR_HSCHR1_1_CTG32_1"                  
#> [185] "CHR_HSCHR1_2_CTG3"                     
#> [186] "CHR_HSCHR1_2_CTG31"                    
#> [187] "CHR_HSCHR1_2_CTG32_1"                  
#> [188] "CHR_HSCHR1_3_CTG3"                     
#> [189] "CHR_HSCHR1_3_CTG31"                    
#> [190] "CHR_HSCHR1_3_CTG32_1"                  
#> [191] "CHR_HSCHR1_4_CTG3"                     
#> [192] "CHR_HSCHR1_4_CTG31"                    
#> [193] "CHR_HSCHR1_5_CTG3"                     
#> [194] "CHR_HSCHR1_5_CTG32_1"                  
#> [195] "CHR_HSCHR1_ALT2_1_CTG32_1"             
#> [196] "CHR_HSCHR20_1_CTG1"                    
#> [197] "CHR_HSCHR20_1_CTG2"                    
#> [198] "CHR_HSCHR20_1_CTG3"                    
#> [199] "CHR_HSCHR20_1_CTG4"                    
#> [200] "CHR_HSCHR21_2_CTG1_1"                  
#> [201] "CHR_HSCHR21_3_CTG1_1"                  
#> [202] "CHR_HSCHR21_4_CTG1_1"                  
#> [203] "CHR_HSCHR21_5_CTG2"                    
#> [204] "CHR_HSCHR21_6_CTG1_1"                  
#> [205] "CHR_HSCHR21_8_CTG1_1"                  
#> [206] "CHR_HSCHR22_1_CTG1"                    
#> [207] "CHR_HSCHR22_1_CTG2"                    
#> [208] "CHR_HSCHR22_1_CTG3"                    
#> [209] "CHR_HSCHR22_1_CTG4"                    
#> [210] "CHR_HSCHR22_1_CTG5"                    
#> [211] "CHR_HSCHR22_1_CTG6"                    
#> [212] "CHR_HSCHR22_1_CTG7"                    
#> [213] "CHR_HSCHR22_2_CTG1"                    
#> [214] "CHR_HSCHR22_3_CTG1"                    
#> [215] "CHR_HSCHR22_4_CTG1"                    
#> [216] "CHR_HSCHR22_5_CTG1"                    
#> [217] "CHR_HSCHR22_6_CTG1"                    
#> [218] "CHR_HSCHR22_7_CTG1"                    
#> [219] "CHR_HSCHR22_8_CTG1"                    
#> [220] "CHR_HSCHR2_1_CTG1"                     
#> [221] "CHR_HSCHR2_1_CTG15"                    
#> [222] "CHR_HSCHR2_1_CTG5"                     
#> [223] "CHR_HSCHR2_1_CTG7"                     
#> [224] "CHR_HSCHR2_1_CTG7_2"                   
#> [225] "CHR_HSCHR2_2_CTG1"                     
#> [226] "CHR_HSCHR2_2_CTG15"                    
#> [227] "CHR_HSCHR2_2_CTG7"                     
#> [228] "CHR_HSCHR2_2_CTG7_2"                   
#> [229] "CHR_HSCHR2_3_CTG1"                     
#> [230] "CHR_HSCHR2_3_CTG15"                    
#> [231] "CHR_HSCHR2_3_CTG7_2"                   
#> [232] "CHR_HSCHR2_4_CTG1"                     
#> [233] "CHR_HSCHR2_6_CTG7_2"                   
#> [234] "CHR_HSCHR3_1_CTG1"                     
#> [235] "CHR_HSCHR3_1_CTG2_1"                   
#> [236] "CHR_HSCHR3_1_CTG3"                     
#> [237] "CHR_HSCHR3_2_CTG2_1"                   
#> [238] "CHR_HSCHR3_2_CTG3"                     
#> [239] "CHR_HSCHR3_3_CTG1"                     
#> [240] "CHR_HSCHR3_3_CTG3"                     
#> [241] "CHR_HSCHR3_4_CTG2_1"                   
#> [242] "CHR_HSCHR3_4_CTG3"                     
#> [243] "CHR_HSCHR3_5_CTG2_1"                   
#> [244] "CHR_HSCHR3_5_CTG3"                     
#> [245] "CHR_HSCHR3_6_CTG3"                     
#> [246] "CHR_HSCHR3_7_CTG3"                     
#> [247] "CHR_HSCHR3_8_CTG3"                     
#> [248] "CHR_HSCHR3_9_CTG3"                     
#> [249] "CHR_HSCHR4_11_CTG12"                   
#> [250] "CHR_HSCHR4_1_CTG12"                    
#> [251] "CHR_HSCHR4_1_CTG4"                     
#> [252] "CHR_HSCHR4_1_CTG6"                     
#> [253] "CHR_HSCHR4_1_CTG9"                     
#> [254] "CHR_HSCHR4_2_CTG12"                    
#> [255] "CHR_HSCHR4_2_CTG4"                     
#> [256] "CHR_HSCHR4_3_CTG12"                    
#> [257] "CHR_HSCHR4_4_CTG12"                    
#> [258] "CHR_HSCHR4_5_CTG12"                    
#> [259] "CHR_HSCHR4_6_CTG12"                    
#> [260] "CHR_HSCHR4_7_CTG12"                    
#> [261] "CHR_HSCHR4_8_CTG12"                    
#> [262] "CHR_HSCHR4_9_CTG12"                    
#> [263] "CHR_HSCHR5_1_CTG1"                     
#> [264] "CHR_HSCHR5_1_CTG1_1"                   
#> [265] "CHR_HSCHR5_1_CTG5"                     
#> [266] "CHR_HSCHR5_2_CTG1"                     
#> [267] "CHR_HSCHR5_2_CTG1_1"                   
#> [268] "CHR_HSCHR5_2_CTG5"                     
#> [269] "CHR_HSCHR5_3_CTG1"                     
#> [270] "CHR_HSCHR5_3_CTG5"                     
#> [271] "CHR_HSCHR5_4_CTG1"                     
#> [272] "CHR_HSCHR5_4_CTG1_1"                   
#> [273] "CHR_HSCHR5_5_CTG1"                     
#> [274] "CHR_HSCHR5_6_CTG1"                     
#> [275] "CHR_HSCHR5_7_CTG1"                     
#> [276] "CHR_HSCHR6_1_CTG10"                    
#> [277] "CHR_HSCHR6_1_CTG2"                     
#> [278] "CHR_HSCHR6_1_CTG3"                     
#> [279] "CHR_HSCHR6_1_CTG4"                     
#> [280] "CHR_HSCHR6_1_CTG5"                     
#> [281] "CHR_HSCHR6_1_CTG6"                     
#> [282] "CHR_HSCHR6_1_CTG7"                     
#> [283] "CHR_HSCHR6_1_CTG8"                     
#> [284] "CHR_HSCHR6_1_CTG9"                     
#> [285] "CHR_HSCHR6_8_CTG1"                     
#> [286] "CHR_HSCHR6_MHC_APD_CTG1"               
#> [287] "CHR_HSCHR6_MHC_COX_CTG1"               
#> [288] "CHR_HSCHR6_MHC_DBB_CTG1"               
#> [289] "CHR_HSCHR6_MHC_MANN_CTG1"              
#> [290] "CHR_HSCHR6_MHC_MCF_CTG1"               
#> [291] "CHR_HSCHR6_MHC_QBL_CTG1"               
#> [292] "CHR_HSCHR6_MHC_SSTO_CTG1"              
#> [293] "CHR_HSCHR7_1_CTG1"                     
#> [294] "CHR_HSCHR7_1_CTG4_4"                   
#> [295] "CHR_HSCHR7_1_CTG6"                     
#> [296] "CHR_HSCHR7_1_CTG7"                     
#> [297] "CHR_HSCHR7_2_CTG1"                     
#> [298] "CHR_HSCHR7_2_CTG4_4"                   
#> [299] "CHR_HSCHR7_2_CTG6"                     
#> [300] "CHR_HSCHR7_2_CTG7"                     
#> [301] "CHR_HSCHR7_3_CTG6"                     
#> [302] "CHR_HSCHR8_1_CTG1"                     
#> [303] "CHR_HSCHR8_1_CTG6"                     
#> [304] "CHR_HSCHR8_1_CTG7"                     
#> [305] "CHR_HSCHR8_2_CTG1"                     
#> [306] "CHR_HSCHR8_2_CTG7"                     
#> [307] "CHR_HSCHR8_3_CTG1"                     
#> [308] "CHR_HSCHR8_3_CTG7"                     
#> [309] "CHR_HSCHR8_4_CTG1"                     
#> [310] "CHR_HSCHR8_4_CTG7"                     
#> [311] "CHR_HSCHR8_5_CTG1"                     
#> [312] "CHR_HSCHR8_5_CTG7"                     
#> [313] "CHR_HSCHR8_6_CTG1"                     
#> [314] "CHR_HSCHR8_7_CTG1"                     
#> [315] "CHR_HSCHR8_8_CTG1"                     
#> [316] "CHR_HSCHR8_9_CTG1"                     
#> [317] "CHR_HSCHR9_1_CTG1"                     
#> [318] "CHR_HSCHR9_1_CTG2"                     
#> [319] "CHR_HSCHR9_1_CTG3"                     
#> [320] "CHR_HSCHR9_1_CTG4"                     
#> [321] "CHR_HSCHR9_1_CTG5"                     
#> [322] "CHR_HSCHR9_1_CTG6"                     
#> [323] "CHR_HSCHRX_1_CTG3"                     
#> [324] "CHR_HSCHRX_2_CTG12"                    
#> [325] "CHR_HSCHRX_2_CTG3"                     
#> [326] "GL000009.2"                            
#> [327] "GL000194.1"                            
#> [328] "GL000195.1"                            
#> [329] "GL000205.2"                            
#> [330] "GL000213.1"                            
#> [331] "GL000216.2"                            
#> [332] "GL000218.1"                            
#> [333] "GL000219.1"                            
#> [334] "GL000220.1"                            
#> [335] "GL000225.1"                            
#> [336] "KI270442.1"                            
#> [337] "KI270711.1"                            
#> [338] "KI270713.1"                            
#> [339] "KI270721.1"                            
#> [340] "KI270726.1"                            
#> [341] "KI270727.1"                            
#> [342] "KI270728.1"                            
#> [343] "KI270731.1"                            
#> [344] "KI270733.1"                            
#> [345] "KI270734.1"                            
#> [346] "KI270744.1"                            
#> [347] "KI270750.1"                            
#> [348] "LRG_183"                               
#> [349] "LRG_187"                               
#> [350] "LRG_239"                               
#> [351] "LRG_311"                               
#> [352] "LRG_721"                               
#> [353] "LRG_741"                               
#> [354] "LRG_93"                                
#> [355] "MT"                                    
#> [356] "X"                                     
#> [357] "Y"                                     

## List all available gene biotypes from the database:
listGenebiotypes(EnsDb.Hsapiens.v86)
#>  [1] "protein_coding"                     "unitary_pseudogene"                
#>  [3] "unprocessed_pseudogene"             "processed_pseudogene"              
#>  [5] "processed_transcript"               "transcribed_unprocessed_pseudogene"
#>  [7] "antisense"                          "transcribed_unitary_pseudogene"    
#>  [9] "polymorphic_pseudogene"             "lincRNA"                           
#> [11] "sense_intronic"                     "transcribed_processed_pseudogene"  
#> [13] "sense_overlapping"                  "IG_V_pseudogene"                   
#> [15] "pseudogene"                         "TR_V_gene"                         
#> [17] "3prime_overlapping_ncRNA"           "IG_V_gene"                         
#> [19] "bidirectional_promoter_lncRNA"      "snRNA"                             
#> [21] "miRNA"                              "misc_RNA"                          
#> [23] "snoRNA"                             "rRNA"                              
#> [25] "Mt_tRNA"                            "Mt_rRNA"                           
#> [27] "IG_C_gene"                          "IG_J_gene"                         
#> [29] "TR_J_gene"                          "TR_C_gene"                         
#> [31] "TR_V_pseudogene"                    "TR_J_pseudogene"                   
#> [33] "IG_D_gene"                          "ribozyme"                          
#> [35] "IG_C_pseudogene"                    "TR_D_gene"                         
#> [37] "TEC"                                "IG_J_pseudogene"                   
#> [39] "scRNA"                              "scaRNA"                            
#> [41] "vaultRNA"                           "sRNA"                              
#> [43] "macro_lncRNA"                       "non_coding"                        
#> [45] "IG_pseudogene"                      "LRG_gene"                          

## List all available transcript biotypes:
listTxbiotypes(EnsDb.Hsapiens.v86)
#>  [1] "protein_coding"                     "processed_transcript"              
#>  [3] "nonsense_mediated_decay"            "retained_intron"                   
#>  [5] "unitary_pseudogene"                 "TEC"                               
#>  [7] "miRNA"                              "misc_RNA"                          
#>  [9] "non_stop_decay"                     "unprocessed_pseudogene"            
#> [11] "processed_pseudogene"               "transcribed_unprocessed_pseudogene"
#> [13] "lincRNA"                            "antisense"                         
#> [15] "transcribed_unitary_pseudogene"     "polymorphic_pseudogene"            
#> [17] "sense_intronic"                     "transcribed_processed_pseudogene"  
#> [19] "sense_overlapping"                  "IG_V_pseudogene"                   
#> [21] "pseudogene"                         "TR_V_gene"                         
#> [23] "3prime_overlapping_ncRNA"           "IG_V_gene"                         
#> [25] "bidirectional_promoter_lncRNA"      "snRNA"                             
#> [27] "snoRNA"                             "rRNA"                              
#> [29] "Mt_tRNA"                            "Mt_rRNA"                           
#> [31] "IG_C_gene"                          "IG_J_gene"                         
#> [33] "TR_J_gene"                          "TR_C_gene"                         
#> [35] "TR_V_pseudogene"                    "TR_J_pseudogene"                   
#> [37] "IG_D_gene"                          "ribozyme"                          
#> [39] "IG_C_pseudogene"                    "TR_D_gene"                         
#> [41] "IG_J_pseudogene"                    "scRNA"                             
#> [43] "scaRNA"                             "vaultRNA"                          
#> [45] "sRNA"                               "macro_lncRNA"                      
#> [47] "non_coding"                         "IG_pseudogene"                     
#> [49] "LRG_gene"                          

## Update the EnsDb; this is in most instances not necessary at all.
updateEnsDb(EnsDb.Hsapiens.v86)
#> EnsDb for Ensembl:
#> |Backend: SQLite
#> |Db type: EnsDb
#> |Type of Gene ID: Ensembl Gene ID
#> |Supporting package: ensembldb
#> |Db created by: ensembldb package from Bioconductor
#> |script_version: 0.3.0
#> |Creation time: Thu May 18 16:32:27 2017
#> |ensembl_version: 86
#> |ensembl_host: localhost
#> |Organism: homo_sapiens
#> |taxonomy_id: 9606
#> |genome_build: GRCh38
#> |DBSCHEMAVERSION: 2.0
#> | No. of genes: 63970.
#> | No. of transcripts: 216741.
#> |Protein data available.

######    returnFilterColumns
returnFilterColumns(EnsDb.Hsapiens.v86)
#> [1] TRUE

## 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"))
#> GRanges object with 841 ranges and 3 metadata columns:
#>                   seqnames              ranges strand |   gene_name
#>                      <Rle>           <IRanges>  <Rle> | <character>
#>   ENSG00000182378        X       276322-303356      + |      PLCXD1
#>   ENSG00000178605        X       304529-318819      - |      GTPBP6
#>   ENSG00000167393        X       333963-386955      - |     PPP2R3B
#>   ENSG00000185960        X       624344-659411      + |        SHOX
#>   ENSG00000205755        X     1187549-1212750      - |       CRLF2
#>               ...      ...                 ...    ... .         ...
#>   ENSG00000277745        X 155459415-155460005      - |      H2AFB3
#>   ENSG00000185973        X 155490115-155669944      - |       TMLHE
#>   ENSG00000168939        X 155767812-155782459      + |       SPRY3
#>   ENSG00000124333        X 155881293-155943769      + |       VAMP7
#>   ENSG00000124334        X 155997581-156010817      + |        IL9R
#>                           gene_id   gene_biotype
#>                       <character>    <character>
#>   ENSG00000182378 ENSG00000182378 protein_coding
#>   ENSG00000178605 ENSG00000178605 protein_coding
#>   ENSG00000167393 ENSG00000167393 protein_coding
#>   ENSG00000185960 ENSG00000185960 protein_coding
#>   ENSG00000205755 ENSG00000205755 protein_coding
#>               ...             ...            ...
#>   ENSG00000277745 ENSG00000277745 protein_coding
#>   ENSG00000185973 ENSG00000185973 protein_coding
#>   ENSG00000168939 ENSG00000168939 protein_coding
#>   ENSG00000124333 ENSG00000124333 protein_coding
#>   ENSG00000124334 ENSG00000124334 protein_coding
#>   -------
#>   seqinfo: 1 sequence from GRCh38 genome
## 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"))
#> GRanges object with 841 ranges and 2 metadata columns:
#>                   seqnames              ranges strand |   gene_name
#>                      <Rle>           <IRanges>  <Rle> | <character>
#>   ENSG00000182378        X       276322-303356      + |      PLCXD1
#>   ENSG00000178605        X       304529-318819      - |      GTPBP6
#>   ENSG00000167393        X       333963-386955      - |     PPP2R3B
#>   ENSG00000185960        X       624344-659411      + |        SHOX
#>   ENSG00000205755        X     1187549-1212750      - |       CRLF2
#>               ...      ...                 ...    ... .         ...
#>   ENSG00000277745        X 155459415-155460005      - |      H2AFB3
#>   ENSG00000185973        X 155490115-155669944      - |       TMLHE
#>   ENSG00000168939        X 155767812-155782459      + |       SPRY3
#>   ENSG00000124333        X 155881293-155943769      + |       VAMP7
#>   ENSG00000124334        X 155997581-156010817      + |        IL9R
#>                           gene_id
#>                       <character>
#>   ENSG00000182378 ENSG00000182378
#>   ENSG00000178605 ENSG00000178605
#>   ENSG00000167393 ENSG00000167393
#>   ENSG00000185960 ENSG00000185960
#>   ENSG00000205755 ENSG00000205755
#>               ...             ...
#>   ENSG00000277745 ENSG00000277745
#>   ENSG00000185973 ENSG00000185973
#>   ENSG00000168939 ENSG00000168939
#>   ENSG00000124333 ENSG00000124333
#>   ENSG00000124334 ENSG00000124334
#>   -------
#>   seqinfo: 1 sequence from GRCh38 genome