## Not run:
#
# ## get all human gene/transcript/exon annotations from Ensembl (75)
# ## the resulting tables will be stored by default to the current working
# ## directory; if the correct Ensembl api (version 75) is defined in the
# ## PERL5LIB environment variable, the ensemblapi parameter can also be omitted.
# fetchTablesFromEnsembl(75,
# ensemblapi="/home/bioinfo/ensembl/75/API/ensembl/modules",
# species="human")
#
# ## These tables can then be processed to generate a SQLite database
# ## containing the annotations
# DBFile <- makeEnsemblSQLiteFromTables()
#
# ## and finally we can generate the package
# makeEnsembldbPackage(ensdb=DBFile, version="0.0.1",
# maintainer="Johannes Rainer <johannes.rainer@eurac.edu>",
# author="J Rainer")
#
# ## Build an annotation database form a GFF file from Ensembl.
# ## ftp://ftp.ensembl.org/pub/release-83/gff3/rattus_norvegicus
# gff <- "Rattus_norvegicus.Rnor_6.0.83.gff3.gz"
# DB <- ensDbFromGff(gff=gff)
# edb <- EnsDb(DB)
# edb
#
# ## Build an annotation file from a GTF file.
# ## the GTF file can be downloaded from
# ## ftp://ftp.ensembl.org/pub/release-75/gtf/homo_sapiens/
# gtffile <- "Homo_sapiens.GRCh37.75.gtf.gz"
# ## generate the SQLite database file
# DB <- ensDbFromGtf(gtf=paste0(ensemblhost, gtffile))
#
# ## load the DB file directly
# EDB <- EnsDb(DB)
#
# ## Alternatively, we could fetch a GTF file directly from AnnotationHub
# ## and build the database from that:
# library(AnnotationHub)
# ah <- AnnotationHub()
# ## Query for all GTF files from Ensembl for Ensembl version 81
# query(ah, c("Ensembl", "release-81", "GTF"))
# ## We could get the one from e.g. Bos taurus:
# DB <- ensDbFromAH(ah["AH47941"])
# edb <- EnsDb(DB)
# edb
# ## End(Not run)
## Generate a sqlite database for genes encoded on chromosome Y
chrY <- system.file("chrY", package="ensembldb")
DBFile <- makeEnsemblSQLiteFromTables(path=chrY ,dbname=tempfile())
## load this database:
edb <- EnsDb(DBFile)
edb
## Generate a sqlite database from a GRanges object specifying
## genes encoded on chromosome Y
load(system.file("YGRanges.RData", package="ensembldb"))
Y
DB <- ensDbFromGRanges(Y, path=tempdir(), version=75,
organism="Homo_sapiens")
edb <- EnsDb(DB)
Run the code above in your browser using DataLab