Define a Singleton class which can hold a CV dictionary (so we do not have to load the .obo files over and over again)

Details

Get the full data by calling the 'getData()' function (which returns a list containing a 'CV', 'URI' and 'version'), or 'getCV()' which is a shorthand for 'getData()$CV'. You can set your own custom CV by calling 'setData()'. By default, the latest release of the PSI-MS-CV (see getCVDictionary). Wherever you need this data, simply re-grab the singleton using 'CV_$new()' (or use the convenience function getCVSingleton() from outside the package)

Super class

R6P::Singleton -> CV_

Methods

Inherited methods


Method ensureHasData()

Make sure that the CV data is loaded

Usage

CV_$ensureHasData()


Method byID()

A function to retrieve a CV entry using its ID

Usage

CV_$byID(id)

Arguments

id

A CV accession, e.g. 'MS:1000560'


Method setData()

Set a user-defined object (= a list of 'CV', 'URI' and 'version'), as obtained from getCVDictionary

Usage

CV_$setData(cv_data)

Arguments

cv_data

The result of a call to getCVDictionary


Method getData()

Gets the underlying data (CV, URI and version)

Usage

CV_$getData()


Method getCV()

A shorthand for 'getData()$CV', i.e. the CV data.frame.

Usage

CV_$getCV()


Method clone()

The objects of this class are cloneable with this method.

Usage

CV_$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) {
  cv_dict = CV_$new() ## uses 'getCVDictionary()' to populate the singleton
  cv_2 = CV_$new() ## uses the same data without parsing again
  cv_2$setData(getCVDictionary("custom", "https://my.com/custom.obo"))
}