Define a Singleton class which can hold a CV dictionary (so we do not have to load the .obo files over and over again)
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)
R6P::Singleton
-> CV_
Inherited methods
setData()
Set a user-defined object (= a list of 'CV', 'URI' and 'version'), as obtained from getCVDictionary
cv_data
The result of a call to getCVDictionary
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"))
}