177 template <
class LAMBDA>
180 for (
const auto& child_id : getTerm(parent_id).children)
182 if (lbd(child_id) || iterateAllChildren(child_id, lbd))
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:55
ControlledVocabulary()
Constructor.
bool checkName_(const String &id, const String &name, bool ignore_case=true) const
checks if a name corresponds to an id
static const ControlledVocabulary & getPSIMSCV()
Returns a CV for parsing/storing PSI-MS related data, e.g. mzML, or handle accessions/ids in datastru...
bool hasTermWithName(const String &name) const
Returns true if a term with the given name is in the CV. Returns false otherwise.
const CVTerm & getTerm(const String &id) const
Returns a term specified by ID.
bool iterateAllChildren(const String &parent_id, LAMBDA lbd) const
Iterates over all children of parent recursively.
Definition: ControlledVocabulary.h:178
const String & label() const
Returns the CV label (set in the load method)
void loadFromOBO(const String &name, const String &filename)
Loads the CV from an OBO file.
String name_
Name set in the load method.
Definition: ControlledVocabulary.h:232
std::map< String, String > namesToIds_
Map from name to id.
Definition: ControlledVocabulary.h:230
String version_
CV version.
Definition: ControlledVocabulary.h:236
const CVTerm & getTermByName(const String &name, const String &desc="") const
Returns a term specified by name.
bool isChildOf(const String &child_id, const String &parent_id) const
Returns if child is a child of parent.
const String & url() const
Returns the CV url (set in the load method)
virtual ~ControlledVocabulary()
Destructor.
std::map< String, CVTerm > terms_
Map from ID to CVTerm.
Definition: ControlledVocabulary.h:228
void getAllChildTerms(std::set< String > &terms, const String &parent_id) const
Writes all child terms recursively into terms.
String label_
CV label.
Definition: ControlledVocabulary.h:234
const ControlledVocabulary::CVTerm * checkAndGetTermByName(const OpenMS::String &name) const
Searches the existing terms for the given name.
const String & name() const
Returns the CV name (set in the load method)
const String & version() const
Returns the CV version (set in the load method)
const std::map< String, CVTerm > & getTerms() const
returns all the terms stored in the CV
bool exists(const String &id) const
Returns true if the term is in the CV. Returns false otherwise.
String url_
CV URL.
Definition: ControlledVocabulary.h:238
friend std::ostream & operator<<(std::ostream &os, const ControlledVocabulary &cv)
Print the contents to a stream.
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:59
A more convenient string class.
Definition: String.h:60
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Representation of a CV term.
Definition: ControlledVocabulary.h:61
std::set< String > parents
The parent IDs.
Definition: ControlledVocabulary.h:84
String toXMLString(const String &ref, const DataValue &value) const
get mzidentml formatted string. i.e. a cvparam xml element, ref should be the name of the ControlledV...
CVTerm(const CVTerm &rhs)
StringList unparsed
Unparsed lines from the definition file.
Definition: ControlledVocabulary.h:89
std::set< String > children
The child IDs.
Definition: ControlledVocabulary.h:85
StringList xref_binary
xref binary-data-type for the CV-term (list of all allowed data value types for the current binary da...
Definition: ControlledVocabulary.h:91
String id
Identifier.
Definition: ControlledVocabulary.h:83
String description
Term description.
Definition: ControlledVocabulary.h:87
bool obsolete
Flag that indicates of the term is obsolete.
Definition: ControlledVocabulary.h:86
static String getXRefTypeName(XRefType type)
String name
if it is a score type, lookup has_order
Definition: ControlledVocabulary.h:82
StringList synonyms
List of synonyms.
Definition: ControlledVocabulary.h:88
XRefType xref_type
xref value-type for the CV-term
Definition: ControlledVocabulary.h:90
CVTerm()
Default constructor.
std::set< String > units
unit accession ids, defined by relationship has units
Definition: ControlledVocabulary.h:92
String toXMLString(const String &ref, const String &value=String("")) const
get mzidentml formatted string. i.e. a cvparam xml element, ref should be the name of the ControlledV...
XRefType
define xsd types allowed in cv term to specify their value-type
Definition: ControlledVocabulary.h:64
@ XSD_BOOLEAN
Definition: ControlledVocabulary.h:72
@ XSD_DATE
Definition: ControlledVocabulary.h:73
@ XSD_NEGATIVE_INTEGER
Definition: ControlledVocabulary.h:68
@ XSD_POSITIVE_INTEGER
Definition: ControlledVocabulary.h:69
@ XSD_NON_POSITIVE_INTEGER
Definition: ControlledVocabulary.h:71
@ XSD_DECIMAL
Definition: ControlledVocabulary.h:67
@ XSD_NON_NEGATIVE_INTEGER
Definition: ControlledVocabulary.h:70
@ XSD_ANYURI
Definition: ControlledVocabulary.h:74
@ XSD_INTEGER
Definition: ControlledVocabulary.h:66
CVTerm & operator=(const CVTerm &rhs)
static bool isHigherBetterScore(ControlledVocabulary::CVTerm term)