Matrix Science header
Public Member Functions

ms_obofile Class Reference
[Mascot configuration files module]

The class provides simplified access to ontology files in the .obo format. More...

#include <ms_obofile.hpp>

Inheritance diagram for ms_obofile:
Inheritance graph
[legend]
Collaboration diagram for ms_obofile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ms_obofile ()
 Default constructor - not generally useful.
 ms_obofile (const char *oboFileName)
 Constructor which loads the obo file from a local file.
 ms_obofile (const ms_obofile &right)
 Copying constructor.
 ~ms_obofile ()
 Destructor.
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
void clearAllErrors ()
 Remove all errors from the current list of errors.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
void copyFrom (const ms_obofile *right)
 Copies all data from another instance of the class.
void defaultValues ()
 Initialises the object.
std::string findIDFromTagValue (const char *tag, const char *value) const
 Find the ontology term with an exact match to the passed tag/value pair.
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
std::vector< std::string > getItemFromId (const char *id) const
 Returns the vector of tag, value, comment strings for the specified ontology item.
int getLastError () const
 Return the error description of the last error that occurred.
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
int getNumberOfEntries () const
 Returns the number of entries .
bool isValid () const
 Call this function to determine if there have been any errors.
ms_obofileoperator= (const ms_obofile &right)
 Assignment operator.
void parseLine (const std::string str, std::string &tag, std::string &value, std::string &comment) const
 Retrieves the tag, value and any comments from a line in the obo file.

Detailed Description

The class provides simplified access to ontology files in the .obo format.

The file format for the ontology files is described in http://www.geneontology.org/GO.format.obo-1_2.shtml .

This class provides limited read only access to OBO files. The aim of the class is to allow scripts using Mascot Parser to easily look up an ID for a given term in a local .obo file.


Constructor & Destructor Documentation

ms_obofile (  )

Default constructor - not generally useful.

Create a default empty ontology.

ms_obofile ( const char *  oboFileName )

Constructor which loads the obo file from a local file.

Loads ontology from a local file. The file format will be:

 [Term]
 id: PI:00000
 name: protein informatics cv
 def: "Collection of terms for PSI Proteome Informatics standards." [PSI:PI]

 [Term]
 . . .
 

The ID of each term is indexed for fast access.

After loading, use the isValid() function to determine if there were any errors.

Parameters:
oboFileNameis the file name of the local file.
ms_obofile ( const ms_obofile src )

Copying constructor.

Note:
This constructor can only be used in C++.
Parameters:
srcis the original OBO file.
~ms_obofile (  )

Destructor.

No need to call this directly. Frees the complete ontology.


Member Function Documentation

void appendErrors ( const ms_errors src ) [inherited]

Copies all errors from another instance and appends them at the end of own list.

Parameters:
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.
void clearAllErrors (  ) [inherited]

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also:
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples:
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.
void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
void copyFrom ( const ms_obofile right )

Copies all data from another instance of the class.

Parameters:
rightis the original object to copy to the new one.
void defaultValues (  )

Initialises the object.

Reset all values to their defaults.

std::string findIDFromTagValue ( const char *  tag,
const char *  value 
) const

Find the ontology term with an exact match to the passed tag/value pair.

This function is only useful for retrieving items where you expect the tag value to be unique -- for example the "name" field.

Parameters:
tagis the name of the tag. For example, "name", "is_a", "property_value".
valueis the value to be found.
Returns:
An empty string if there is no match, or the term ID if successful.
const ms_errs * getErrorHandler (  ) const [inherited]

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns:
Constant pointer to the error handler
See also:
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples:
common_error.cpp, and http_helper_getstring.cpp.
std::vector< std::string > getItemFromId ( const char *  id ) const

Returns the vector of tag, value, comment strings for the specified ontology item.

Returns all the lines in the [Term] for the specified ID.

Parameters:
idis the ID of the term. For example, "PI:00171".
Returns:
vector of lines
int getLastError (  ) const [inherited]

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also:
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns:
the error number of the last error, or 0 if there have been no errors.

Reimplemented in ms_mascotresfile.

std::string getLastErrorString (  ) const [inherited]

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns:
Most recent error, warning, information or debug message

See Error Handling.

See also:
isValid(), getLastError(), clearAllErrors(), getErrorHandler()

Reimplemented in ms_mascotresfile.

Examples:
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.
int getNumberOfEntries (  ) const

Returns the number of entries .

Each [Term] section is considered to be a single entry.

Returns:
The number of terms in the ontology.
bool isValid (  ) const [inherited]

Call this function to determine if there have been any errors.

This will return true unless there have been any fatal errors.

See Error Handling.

Returns:
True if no fatal error occured
See also:
getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples:
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, peptide_list.cpp, resfile_summary.cpp, and tools_aahelper.cpp.
ms_obofile & operator= ( const ms_obofile right )

Assignment operator.

Parameters:
rightis the original object to copy to the new one.
Returns:
reference to the current object
void parseLine ( const std::string  str,
std::string &  tag,
std::string &  value,
std::string &  comment 
) const

Retrieves the tag, value and any comments from a line in the obo file.

Note:
This function can only be used from C++.

For example, for the following line, the tag would be "is_a", the value returned would be "PI:00153" and the comment would be "search engine specific score":

   is_a: PI:00153 ! search engine specific score
Parameters:
stris the input string.
tagis the name of the tag in the input line.
valueis the value of the tag in the input line.
commentis any comment (after the ! in the input line).

The documentation for this class was generated from the following files:

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:35