Opens a connection to a SemanticSQL SQLite database, either by supplying
a direct file path or by referencing a short ontology name that is
retrieved and cached via BiocFileCache.
Usage
semsql_connect(
db_path = NULL,
ontology_prefix = NULL,
ontology = NULL,
cache = BiocFileCache::BiocFileCache(),
validate = TRUE,
...
)Arguments
- db_path
character(1) or NULL. Path to an existing SQLite database file. Either
db_pathorontologymust be supplied.- ontology_prefix
character(1) or NULL. Primary CURIE prefix for the ontology (e.g.
"CL"). If NULL andontologyis supplied, defaults totoupper(ontology); otherwise auto-detected from the database.- ontology
character(1) or NULL. Short name of an INCAtools ontology (e.g.
"cl","go"). If supplied,retrieve_semsql_conn()is called to locate or download the cached database.- cache
a
BiocFileCacheinstance used whenontologyis supplied. Defaults toBiocFileCache::BiocFileCache().- validate
logical(1) if TRUE (the default value) the ontology code is checked against available Semantic SQL resources at INCAtools. Set to FALSE if using off line.
- ...
passed to
retrieve_semsql_conn()and ultimately toutils::download.file().
Value
A SemsqlConn() object.
Note
The connection has flag SQLITE_RO for read-only access. There will
be an attempt to validate the ontology tag that is supplied, against all
available Semantic SQL resources available at INCAtools bucket. Function fails
if a match cannot be made, which in general requires network access.
Examples
# by ontology short name (downloads if not cached)
goref <- semsql_connect(ontology = "go")
#> Connected to SemanticSQL database: /home/runner/.cache/R/BiocFileCache/1988cc470f_go.db
#> Primary ontology prefix: GO
goref
#> <SemsqlConn> prefix: GO | labeled terms: 88,849
disconnect(goref)
#> Disconnected from '1988cc470f_go.db'