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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dbhelpers.R
\name{EnsDb}
\alias{EnsDb}
\title{Connect to an EnsDb object}
\usage{
EnsDb(x)
}
\arguments{
\item{x}{Either a character specifying the \emph{SQLite} database file, or
a \code{DBIConnection} to e.g. a MariaDB/MySQL database.}
}
\value{
A \code{\linkS4class{EnsDb}} object.
}
\description{
The \code{EnsDb} constructor function connects to the database
specified with argument \code{x} and returns a corresponding
\code{\linkS4class{EnsDb}} object.
}
\details{
By providing the connection to a MariaDB/MySQL database, it is possible
to use MariaDB/MySQL as the database backend and queries will be performed on
that database. Note however that this requires the package \code{RMariaDB}
to be installed. In addition, the user needs to have access to a MySQL
server providing already an EnsDb database, or must have write
privileges on a MySQL server, in which case the \code{\link{useMySQL}}
method can be used to insert the annotations from an EnsDB package into
a MySQL database.
}
\examples{
## "Standard" way to create an EnsDb object:
library(EnsDb.Hsapiens.v86)
EnsDb.Hsapiens.v86
## Alternatively, provide the full file name of a SQLite database file
dbfile <- system.file("extdata/EnsDb.Hsapiens.v86.sqlite", package = "EnsDb.Hsapiens.v86")
edb <- EnsDb(dbfile)
edb
## Third way: connect to a MySQL database
\dontrun{
library(RMariaDB)
dbcon <- dbConnect(MySQL(), user = my_user, pass = my_pass,
host = my_host, dbname = "ensdb_hsapiens_v86")
edb <- EnsDb(dbcon)
}
}
\author{
Johannes Rainer
}
|