biodbLipidmaps is a biodb extension package that implements a connector to Lipidmaps Structure [@sud2007_LipidMaps_LMSD].
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install('biodbLipidmaps')
The first step in using biodbLipidmaps, is to create an instance of the biodb
class BiodbMain
from the main biodb package. This is done by calling the
constructor of the class:
mybiodb <- biodb::newInst()
During this step the configuration is set up, the cache system is initialized and extension packages are loaded.
We will see at the end of this vignette that the biodb instance needs to be
terminated with a call to the terminate()
method.
In biodb connections to databases are handled by connector instances that you can get from the factory. Here is the code to instantiate a connector to Lipidmaps Structure database:
conn <- mybiodb$getFactory()$createConn('lipidmaps.structure')
To get the number of entries stored inside the database, run:
conn$getNbEntries()
To get some of the first entry IDs (accession numbers) from the database, run:
ids <- conn$getEntryIds(2) ids
To retrieve entries, use:
entries <- conn$getEntry(ids) entries
To convert a list of entries into a data frame, run:
x <- mybiodb$entriesToDataframe(entries) x
You can access the web service "LMSDSearch" directly with the wsLmsdSearch method:
ids <- conn$wsLmsdSearch(mode='ProcessStrSearch', name="fatty", retfmt="ids") ids
From this list of identifiers, we can obtain the full entry objects:
entries <- conn$getEntry(ids)
And then a data frame:
entriesDf <- mybiodb$entriesToDataframe(entries)
That you can see in table \@ref(tab:entriesTable).
knitr::kable(entriesDf, "pipe", caption="The entries listed in the result of the search.")
When done with your biodb instance you have to terminate it, in order to ensure release of resources (file handles, database connection, etc):
mybiodb$terminate()
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.