38 size_t hash = 14695981039346656037ull;
41 hash ^=
static_cast<unsigned char>(c);
42 hash *= 1099511628211ull;
59 XSD_NON_NEGATIVE_INTEGER,
60 XSD_NON_POSITIVE_INTEGER,
91 std::string
toXMLString(
const std::string& ref,
const std::string& value =std::string(
""))
const;
105 const std::string&
name()
const;
114 const std::string&
url()
const;
125 void loadFromOBO(
const std::string& name,
const std::string& filename);
128 bool exists(
const std::string&
id)
const;
149 const std::map<std::string, CVTerm>&
getTerms()
const;
184 template <
class LAMBDA>
187 for (
const auto& child_id : getTerm(parent_id).children)
189 if (lbd(child_id) || iterateAllChildren(child_id, lbd))
212 bool isChildOf(
const std::string& child_id,
const std::string& parent_id)
const;
237 bool checkName_(
const std::string&
id,
const std::string& name,
bool ignore_case =
true)
const;
Definition ControlledVocabulary.h:29
ControlledVocabulary()
Constructor.
bool exists(const std::string &id) const
Returns true if the term is in the CV. Returns false otherwise.
bool iterateAllChildren(const std::string &parent_id, LAMBDA lbd) const
Iterates over all children (incl. subchildren etc) of parent recursively, i.e. the whole subtree.
Definition ControlledVocabulary.h:185
const CVTerm & getTermByName(const std::string &name, const std::string &desc="") const
Returns a term specified by name.
std::map< std::string, CVTerm > terms_
Map from ID to CVTerm.
Definition ControlledVocabulary.h:241
std::string url_
CV URL.
Definition ControlledVocabulary.h:251
bool checkName_(const std::string &id, const std::string &name, bool ignore_case=true) const
checks if a name corresponds to an id
const std::string & name() const
Returns the CV name (set in the load method)
std::string label_
CV label.
Definition ControlledVocabulary.h:247
bool hasTermWithName(const std::string &name) const
Returns true if a term with the given name is in the CV. Returns false otherwise.
const std::string & version() const
Returns the CV version (set in the load method)
friend std::ostream & operator<<(std::ostream &os, const ControlledVocabulary &cv)
Print the contents to a stream.
std::string name_
Name set in the load method.
Definition ControlledVocabulary.h:245
const std::string & label() const
Returns the CV label (set in the load method)
void loadFromOBO(const std::string &name, const std::string &filename)
Loads the CV from an OBO file.
std::string version_
CV version.
Definition ControlledVocabulary.h:249
std::map< std::string, std::string > namesToIds_
Map from name to id.
Definition ControlledVocabulary.h:243
virtual ~ControlledVocabulary()
Destructor.
const ControlledVocabulary::CVTerm * checkAndGetTermByName(const std::string &name) const
Searches the existing terms for the given name.
void getAllChildTerms(std::set< std::string > &terms, const std::string &parent_id) const
Writes all child terms recursively into terms.
const std::map< std::string, CVTerm > & getTerms() const
returns all the terms stored in the CV
static const ControlledVocabulary & getPSIMSCV()
Returns a CV for parsing/storing PSI-MS related data, e.g. mzML, or handle accessions/ids in datastru...
bool isChildOf(const std::string &child_id, const std::string &parent_id) const
Returns if child is a child of parent.
const CVTerm & getTerm(const std::string &id) const
Returns a term specified by ID.
const std::string & url() const
Returns the CV url (set in the load method)
void addAllChildTerms(std::set< std::string > &terms, const std::string &parent_id) const
Writes the parent term and all descendant term IDs into terms.
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition DataValue.h:32
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Representation of a CV term.
Definition ControlledVocabulary.h:50
std::string description
Term description.
Definition ControlledVocabulary.h:76
static std::string getXRefTypeName(XRefType type)
CVTerm(const CVTerm &rhs)
std::string toXMLString(const std::string &ref, const DataValue &value) const
get mzidentml formatted string. i.e. a cvparam xml element, ref should be the name of the ControlledV...
StringList unparsed
Unparsed lines from the definition file.
Definition ControlledVocabulary.h:78
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:80
bool obsolete
Flag that indicates of the term is obsolete.
Definition ControlledVocabulary.h:75
std::string name
if it is a score type, lookup has_order
Definition ControlledVocabulary.h:71
StringList synonyms
List of synonyms.
Definition ControlledVocabulary.h:77
XRefType xref_type
xref value-type for the CV-term
Definition ControlledVocabulary.h:79
CVTerm()
Default constructor.
std::set< std::string > parents
The parent IDs.
Definition ControlledVocabulary.h:73
XRefType
define xsd types allowed in cv term to specify their value-type
Definition ControlledVocabulary.h:53
std::set< std::string > units
unit accession ids, defined by relationship has units
Definition ControlledVocabulary.h:81
CVTerm & operator=(const CVTerm &rhs)
std::set< std::string > children
The child IDs.
Definition ControlledVocabulary.h:74
static bool isHigherBetterScore(ControlledVocabulary::CVTerm term)
std::string id
Identifier.
Definition ControlledVocabulary.h:72
std::string toXMLString(const std::string &ref, const std::string &value=std::string("")) const
get mzidentml formatted string. i.e. a cvparam xml element, ref should be the name of the ControlledV...
ensure same hash on all platforms (for reproducibility)-
Definition ControlledVocabulary.h:35
size_t operator()(const std::string &key) const noexcept
Definition ControlledVocabulary.h:36