Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_enzymefile Class Reference

Reads and parses the enzymes file that contains multiple enzyme definitions. More...

#include <ms_enzyme.hpp>

Inheritance diagram for ms_enzymefile:
Collaboration diagram for ms_enzymefile:

Public Member Functions

 ms_enzymefile ()
 Default constructor.
 
 ms_enzymefile (const char *filename, const matrix_science::ms_connection_settings *cs=0)
 This constructor may be used in order to read the given file immediately on construction.
 
 ms_enzymefile (const ms_enzymefile &src)
 Copying constructor.
 
 ~ms_enzymefile ()
 Destructor.
 
void appendEnzyme (const ms_enzyme *item)
 Adds a copy of given enzyme at the end of the list.
 
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 clearEnzymes ()
 Deletes all enzymes from the list.
 
void copyFrom (const ms_enzymefile *right)
 Call this member to copy all the information from another instance.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
void defaultValues ()
 Use this member to re-initialise the instance.
 
bool deleteEnzymeByName (const char *name)
 Remove an enzyme from the list in memory.
 
bool deleteEnzymeByNumber (const int num)
 Remove an enzyme from the list in memory.
 
matrix_science::ms_connection_settings getConnectionSettings () const
 Returns the sessionID and proxy server for use with an HTTP transfer.
 
const ms_enzymegetEnzymeByName (const char *name) const
 Finds an enzyme with the specified name (case insensitive).
 
const ms_enzymegetEnzymeByNumber (const int num) const
 Returns a pointer to an internally stored enzyme.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
std::string getFileName () const
 Returns a file name previously set or a default one used to read the file.
 
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 getNumberOfEnzymes () const
 Returns a number of enzymes successfully read from the file.
 
bool isNoneFound () const
 Returns TRUE if an entry with name "NONE" has been found in the file.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
ms_enzymefileoperator= (const ms_enzymefile &right)
 C++ style assignment operator.
 
void read_buffer (const char *buffer)
 Reads and parses an in-memory null-terminated buffer instead of a disk file.
 
void read_file ()
 Reads and parses the file.
 
void save_file ()
 Stores enzyme definitions in a file.
 
void setConnectionSettings (const matrix_science::ms_connection_settings &cs)
 Sets the sessionID and proxy server for use with an HTTP transfer.
 
void setFileName (const char *filename)
 Call this member before reading the file if you want to specify a non-default name.
 
bool updateEnzymeByName (const char *name, const ms_enzyme enzyme)
 Update the information for a specific enzyme.
 
bool updateEnzymeByNumber (const int num, const ms_enzyme enzyme)
 Update the information for a specific enzyme.
 

Detailed Description

Reads and parses the enzymes file that contains multiple enzyme definitions.

Proteolytic enzymes and specific chemical cleavage agents are defined in ../config/enzymes .

Usage is simple:

Examples
config_enzymes.cpp, and tools_aahelper.cpp.

Constructor & Destructor Documentation

◆ ms_enzymefile() [1/3]

Default constructor.

Creates an empty list of enzymes in memory. A file is not created.

◆ ms_enzymefile() [2/3]

ms_enzymefile ( const ms_enzymefile src)

Copying constructor.

Note
This constructor can only be used from C++.
Parameters
srcis the ms_enzymefile to make a copy of.

◆ ms_enzymefile() [3/3]

ms_enzymefile ( const char *  filename,
const matrix_science::ms_connection_settings cs = 0 
)

This constructor may be used in order to read the given file immediately on construction.

Equivalent to the following call sequence:

Parameters
filenameThe file name parameter can be either a local file path or a Mascot server URL, it cannot be an empty string or NULL pointer. If it is a URL it should be of the form http://your-server/mascot/cgi .
csis a an optional pointer to the connection settings. This should contain a sessionID and optionally the proxy server settings.

◆ ~ms_enzymefile()

Destructor.

Called automatically from C++ and other languages.

Member Function Documentation

◆ appendEnzyme()

void appendEnzyme ( const ms_enzyme item)

Adds a copy of given enzyme at the end of the list.

Parameters
itemis the new item to add to the end of the list of enzymes.

◆ appendErrors()

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.

◆ clearAllErrors()

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.

◆ clearEnzymes()

void clearEnzymes ( )

Deletes all enzymes from the list.

Similar to calling defaultValues() except that this function doesn't clear all the comments from the file.

◆ copyFrom() [1/2]

void copyFrom ( const ms_enzymefile right)

Call this member to copy all the information from another instance.

Simply create an instance of the class using the default constructor and call this method.

Parameters
rightPointer to another instance to copy from.

◆ copyFrom() [2/2]

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ defaultValues()

void defaultValues ( )

Use this member to re-initialise the instance.

Note that this member doesn't clear the file name; that has to be re-set explicitly if needed.

◆ deleteEnzymeByName()

bool deleteEnzymeByName ( const char *  name)

Remove an enzyme from the list in memory.

Parameters
namemust be a valid enzyme name.
Returns
True if the enyzme name is valid.
Examples
config_enzymes.cpp.

◆ deleteEnzymeByNumber()

bool deleteEnzymeByNumber ( const int  num)

Remove an enzyme from the list in memory.

Parameters
nummust be in the range 0..getNumberOfEnzymes()-1.
Returns
True if the enyzme number is valid.

◆ getConnectionSettings()

matrix_science::ms_connection_settings getConnectionSettings ( ) const

Returns the sessionID and proxy server for use with an HTTP transfer.

See also the constructor documentation and setConnectionSettings().

Returns
The current connection settings.

◆ getEnzymeByName()

const ms_enzyme * getEnzymeByName ( const char *  name) const

Finds an enzyme with the specified name (case insensitive).

The special entry "NONE" being found also generates NULL as an outcome. For more information on this see isNoneFound().

Parameters
namename of the enzyme to look for
Returns
a pointer to the found one or NULL otherwise. See Maintaining object references: two rules of thumb.

◆ getEnzymeByNumber()

const ms_enzyme * getEnzymeByNumber ( const int  num) const

Returns a pointer to an internally stored enzyme.

Parameters
numMust be in the range 0..getNumberOfEnzymes()-1.
Returns
A pointer to an ms_enzyme object. If num is out of range, then the return value is a null object.
Examples
config_enzymes.cpp.

◆ getErrorHandler()

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.

◆ getFileName()

std::string getFileName ( ) const

Returns a file name previously set or a default one used to read the file.

Returns
The filename (if any) as set in a previous call to setFileName() or as specified in the constructor.

◆ getLastError()

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.

◆ getLastErrorString()

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()
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.

◆ getNumberOfEnzymes()

int getNumberOfEnzymes ( ) const

Returns a number of enzymes successfully read from the file.

Returns
The current number of enzymes in the list.
Examples
config_enzymes.cpp.

◆ isNoneFound()

bool isNoneFound ( ) const

Returns TRUE if an entry with name "NONE" has been found in the file.

The standard enzymes files has an entry "None" which is used to specify a no enzyme search. This special entry never represents a real enzyme and therefore all properties of the entry are meaningless. Therefore, calling getEnzymeByName() with "None" as a parameter will always return NULL.

Returns
True if there is an entry for "None" in the file.

◆ isValid()

bool isValid ( ) const
inherited

◆ operator=()

ms_enzymefile & operator= ( const ms_enzymefile right)

C++ style assignment operator.

Note
This operator can only be used in C++.

Acts identically to copyFrom() member.

Parameters
rightis the enzymefile definition to copy from.
Returns
reference to the current object

◆ read_buffer()

void read_buffer ( const char *  buffer)

Reads and parses an in-memory null-terminated buffer instead of a disk file.

Check for possible errors after calling this functions with isValid(). In case of any errors it keeps all of the already read entries that can still be accessed in a usual way.

Parameters
buffera null-terminated string with enzymes definitions.

◆ read_file()

void read_file ( )

Reads and parses the file.

Check for possible errors after calling this functions with isValid(). In case of any errors it keeps all of the already read entries that can still be accessed in a usual way.

◆ save_file()

void save_file ( )

Stores enzyme definitions in a file.

Don't forget to check for errors after this function call. The filename used to save the file is specified by setFileName().

Examples
config_enzymes.cpp.

◆ setConnectionSettings()

void setConnectionSettings ( const matrix_science::ms_connection_settings cs)

Sets the sessionID and proxy server for use with an HTTP transfer.

This value would normally be passed in the constructor.

Parameters
csis the new connection settings.

◆ setFileName()

void setFileName ( const char *  filename)

Call this member before reading the file if you want to specify a non-default name.

Parameters
filenameis the name of the file to be saved using save_file() or read using read_file().
Examples
config_enzymes.cpp.

◆ updateEnzymeByName()

bool updateEnzymeByName ( const char *  name,
const ms_enzyme  enzyme 
)

Update the information for a specific enzyme.

Parameters
nametitle of the enzyme to retrieve.
enzymeis a pointer to the new definition of the enzyme.
Returns
true if the name can be found, false otherwise

◆ updateEnzymeByNumber()

bool updateEnzymeByNumber ( const int  num,
const ms_enzyme  enzyme 
)

Update the information for a specific enzyme.

Parameters
nummust be in the range 0..getNumberOfEnzymes()-1.
enzymeIs a pointer to the new definition of the enzyme.
Returns
true if num param is in range, false otherwise
Examples
config_enzymes.cpp.

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