Reads and parses the enzymes
file that contains multiple enzyme definitions.
More...
#include <ms_enzyme.hpp>
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_enzyme * | getEnzymeByName (const char *name) const |
Finds an enzyme with the specified name (case insensitive). | |
const ms_enzyme * | getEnzymeByNumber (const int num) const |
Returns a pointer to an internally stored enzyme. | |
const ms_errs * | getErrorHandler () 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_enzymefile & | operator= (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. | |
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:
ms_enzymefile | ( | ) |
Default constructor.
Creates an empty list of enzymes in memory. A file is not created.
ms_enzymefile | ( | const ms_enzymefile & | src | ) |
Copying constructor.
src | is the ms_enzymefile to make a copy of. |
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:
filename | The 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 . |
cs | is 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.
void appendEnzyme | ( | const ms_enzyme * | item | ) |
Adds a copy of given enzyme at the end of the list.
item | is the new item to add to the end of the list of enzymes. |
|
inherited |
Copies all errors from another instance and appends them at the end of own list.
src | The object to copy the errors across from. See Maintaining object references: two rules of thumb. |
|
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.
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.
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.
right | Pointer to another instance to copy from. |
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
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.
bool deleteEnzymeByName | ( | const char * | name | ) |
Remove an enzyme from the list in memory.
name | must be a valid enzyme name. |
bool deleteEnzymeByNumber | ( | const int | num | ) |
Remove an enzyme from the list in memory.
num | must be in the range 0..getNumberOfEnzymes()-1. |
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().
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().
name | name of the enzyme to look for |
const ms_enzyme * getEnzymeByNumber | ( | const int | num | ) | const |
Returns a pointer to an internally stored enzyme.
num | Must be in the range 0..getNumberOfEnzymes()-1. |
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
See Error Handling.
std::string getFileName | ( | ) | const |
Returns a file name previously set or a default one used to read the file.
|
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.
|
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.
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.
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.
|
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.
ms_enzymefile & operator= | ( | const ms_enzymefile & | right | ) |
C++ style assignment operator.
Acts identically to copyFrom() member.
right | is the enzymefile definition to copy from. |
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.
buffer | a null-terminated string with enzymes definitions. |
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.
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().
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.
cs | is the new connection settings. |
void setFileName | ( | const char * | filename | ) |
Call this member before reading the file if you want to specify a non-default name.
filename | is the name of the file to be saved using save_file() or read using read_file(). |
bool updateEnzymeByName | ( | const char * | name, |
const ms_enzyme | enzyme | ||
) |
Update the information for a specific enzyme.
name | title of the enzyme to retrieve. |
enzyme | is a pointer to the new definition of the enzyme. |
bool updateEnzymeByNumber | ( | const int | num, |
const ms_enzyme | enzyme | ||
) |
Update the information for a specific enzyme.
num | must be in the range 0..getNumberOfEnzymes()-1. |
enzyme | Is a pointer to the new definition of the enzyme. |