Use this class in order to read in the amino acid modification file. More...
#include <ms_modfile.hpp>
Public Member Functions | |
ms_modfile () | |
Default constructor. | |
ms_modfile (const char *filename, const ms_masses *massFile, const bool fromSubstitutions=false, const ms_connection_settings *cs=0) | |
Immediate-action constructor that reads the given file on construction. | |
ms_modfile (const ms_modfile &src) | |
Copying constructor. | |
ms_modfile (const ms_umod_configfile &src, const unsigned int flags=ms_umod_configfile::MODFILE_FLAGS_ALL) | |
Copying constructor that accepts unimod-file object. | |
~ms_modfile () | |
Destructor. | |
void | appendErrors (const ms_errors &src) |
Copies all errors from another instance and appends them at the end of own list. | |
void | appendModification (const ms_modification *item) |
Adds a new modification at the end of the list. | |
void | clearAllErrors () |
Remove all errors from the current list of errors. | |
void | clearModifications () |
Deletes all modifications from the list. | |
void | copyFrom (const ms_errors *right) |
Use this member to make a copy of another instance. | |
void | copyFrom (const ms_modfile *right) |
Copies all content from another instance. | |
void | copyFrom (const ms_umod_configfile *right, const unsigned int flags=ms_umod_configfile::MODFILE_FLAGS_ALL) |
Copies all content from unimod-file object. | |
void | defaultValues () |
Call this member if you want to start again. | |
bool | deleteModificationByName (const char *name) |
Remove a modification from the list in memory. | |
bool | deleteModificationByNumber (const int num) |
Remove a modification from the list in memory. | |
ms_connection_settings | getConnectionSettings () const |
Returns the sessionID and proxy server for use with an HTTP transfer. | |
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 that is used to read configuration information. | |
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. | |
const ms_masses * | getMassFile () const |
Returns previously set ms_masses class instance. | |
const ms_modification * | getModificationByName (const char *nameMod) const |
Returns a modification object by its name or NULL in case of not found. | |
const ms_modification * | getModificationByNumber (const int numMod) const |
Returns a modification object by its number. | |
int | getNumberOfModifications () const |
Returns a number of modifications currently held in memory. | |
bool | isFromSubstitutions () const |
Returns TRUE if reading is done from the substitutions file. | |
bool | isValid () const |
Call this function to determine if there have been any errors. | |
ms_modfile & | operator= (const ms_modfile &right) |
C++ style assignment operator. | |
void | read_file () |
Reads configuration information from the file. | |
void | save_file () |
Stores modification information in the file. | |
void | saveToString (std::string &modfileAsStr) |
Stores modification information in the string supplied. | |
void | setConnectionSettings (const ms_connection_settings &cs) |
Sets the sessionID and proxy server for use with an HTTP transfer. | |
void | setFileName (const char *name) |
Call this member to set a custom file name to read from a different location. | |
void | setFromSubstitutions (const bool value) |
Sets internal flag telling which file should be used for extracting modifications. | |
void | setMassFile (const ms_masses *massFile) |
Set the atom masses to use when generating fragmentation mass deltas. | |
void | sortModifications () |
Re-orders mods by their names. | |
bool | updateModificationByName (const char *name, const ms_modification mod) |
Update the information for a specific modification. | |
bool | updateModificationByNumber (const int num, const ms_modification mod) |
Update the information for a specific modification. | |
Use this class in order to read in the amino acid modification file.
Amino acid modifications are defined in two files: mod_file
and substitutions
. An instance of this class can be used to read a file with any other name. Otherwise, the default name ../config/mod_file
is used. Just create an instance of the class and call read_file()-member.
Alternatively, you can call setFileName() to supply a custom file name. It is also recommended to read in the atom masses configuration file with ms_masses and call setMassFile() before calling read_file().
After reading a file and before using the object, check its by calling isValid() and retrieve error descriptions with getLastErrorString() if not valid.
ms_modfile | ( | const ms_umod_configfile & | src, |
const unsigned int | flags = ms_umod_configfile::MODFILE_FLAGS_ALL |
||
) |
Copying constructor that accepts unimod-file object.
src | a Unimod file object to extract modifications from. |
flags | can be one or more of the ms_umod_configfile::MODFILE_FLAGS values OR'ed together. |
ms_modfile | ( | const char * | filename, |
const ms_masses * | massFile, | ||
const bool | fromSubstitutions = false , |
||
const ms_connection_settings * | cs = 0 |
||
) |
Immediate-action constructor that reads the given file on construction.
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 . |
massFile | In order to use default masses, use a null value. |
fromSubstitutions | is an optional parameter is only used when the first parameter is a Mascot Server URL. Use FALSE or (leave the parameter out) to open the mod_file , and use TRUE to open the substitutions file. |
cs | connection settings to use when accessing remote files. This should contain a sessionID and optionally the proxy server settings. If security is enabled on the session and visibility control files are present in a unimod subdirectory then private modifications will not be loaded. |
|
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.
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
void copyFrom | ( | const ms_umod_configfile * | right, |
const unsigned int | flags = ms_umod_configfile::MODFILE_FLAGS_ALL |
||
) |
Copies all content from unimod-file object.
right | unimod file object to extract modifications from. |
flags | can be one or more of the ms_umod_configfile::MODFILE_FLAGS values OR'ed together. |
bool deleteModificationByName | ( | const char * | name | ) |
Remove a modification from the list in memory.
name | must be a valid modification name. |
bool deleteModificationByNumber | ( | const int | num | ) |
Remove a modification from the list in memory.
num | must be in the range 0..getNumberOfModifications()-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().
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
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.
|
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.
const ms_modification * getModificationByNumber | ( | const int | numMod | ) | const |
Returns a modification object by its number.
numMod | is the modification number greater than or equal to zero and less than getNumberOfModifications(). |
bool isFromSubstitutions | ( | ) | const |
Returns TRUE if reading is done from the substitutions
file.
This flag is important only when downloading the file from a remote host since the URL doesn't contain the file name – only the location. See setFromSubstitutions() and read_file().
|
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.
void read_file | ( | ) |
Reads configuration information from the file.
The function uses the file name supplied in setFileName() for reading.
void saveToString | ( | std::string & | modfileAsStr | ) |
Stores modification information in the string supplied.
See Multiple return values in Perl, Java, Python and C#.
[out] | modfileAsStr | is the complete file as a string |
void setConnectionSettings | ( | const 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 * | name | ) |
Call this member to set a custom file name to read from a different location.
The file name passed as the parameter can be either full/relative path to a local file or URL of the web-site to download it from. In case of URL, the parameter should specify only web-site address. The file name will be chosen depending on whether the file is substitutions
or a regular one. Call setFromSubstitutions() before calling read_file() if you want to obtain substitutions configurations rather than regular modifications.
name | 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 . |
void setFromSubstitutions | ( | const bool | value | ) |
Sets internal flag telling which file should be used for extracting modifications.
In case of remote URL it is necessary to tell which file (mod_file
or substitutions
) should be used for extracting modifications. By default all modifications are read from mod_file
either locally or remotely.
See read_file() for more information.
value | set whether the mod file or the substutitions file is used to extract modifications |
bool updateModificationByName | ( | const char * | name, |
const ms_modification | mod | ||
) |
Update the information for a specific modification.
name | must be a valid modification name. |
mod | is the new definition of the modification. |
bool updateModificationByNumber | ( | const int | num, |
const ms_modification | mod | ||
) |
Update the information for a specific modification.
num | must be in the range 0..(getNumberOfModifications() - 1). |
mod | is the new definition of the modification. |