Matrix Science header
Public Member Functions

ms_modfile Class Reference
[Mascot configuration files module]

Use this class in order to read in the amino acid modification file. More...

#include <ms_modfile.hpp>

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

List of all members.

Public Member Functions

 ms_modfile ()
 Default constructor.
 ms_modfile (const ms_modfile &src)
 Copying 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_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_umod_configfile *right, const unsigned int flags=ms_umod_configfile::MODFILE_FLAGS_ALL)
 Copies all content from unimod-file object.
void copyFrom (const ms_modfile *right)
 Copies all content from another instance.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
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_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 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_massesgetMassFile () const
 Returns previously set ms_masses class instance.
const ms_modificationgetModificationByName (const char *nameMod) const
 Returns a modification object by its name or NULL in case of not found.
const ms_modificationgetModificationByNumber (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_modfileoperator= (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.

Detailed Description

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.

Examples:

config_modfile.cpp, and tools_aahelper.cpp.


Constructor & Destructor Documentation

ms_modfile ( const ms_umod_configfile src,
const unsigned int  flags = ms_umod_configfile::MODFILE_FLAGS_ALL 
)

Copying constructor that accepts unimod-file object.

Parameters:
srca Unimod file object to extract modifications from.
flagscan 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.

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 .
massFileIn order to use default masses, use a null value.
fromSubstitutionsis 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.
csconnection 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.

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_umod_configfile right,
const unsigned int  flags = ms_umod_configfile::MODFILE_FLAGS_ALL 
)

Copies all content from unimod-file object.

Parameters:
rightunimod file object to extract modifications from.
flagscan be one or more of the ms_umod_configfile::MODFILE_FLAGS values OR'ed together.
void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
bool deleteModificationByName ( const char *  name )

Remove a modification from the list in memory.

Parameters:
namemust be a valid modification name.
Returns:
True if the modification name is valid and the modification was removed.
Examples:
config_modfile.cpp.
bool deleteModificationByNumber ( const int  num )

Remove a modification from the list in memory.

Parameters:
nummust be in the range 0..getNumberOfModifications()-1.
Returns:
True if the modification number is valid.
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.
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.
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.
const ms_modification * getModificationByNumber ( const int  numMod ) const

Returns a modification object by its number.

Parameters:
numModis the modification number greater than or equal to zero and less than getNumberOfModifications().
Returns:
The modification object, or a null value if an invalid numMod value is passed. See Maintaining object references: two rules of thumb.
Examples:
config_modfile.cpp.
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().

Returns:
true if the subtitutions file is used to extract modifications, false if the mod file is used
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 is 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.
void read_file (  )

Reads configuration information from the file.

The function uses the file name supplied in setFileName() for reading.

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.

Parameters:
csis 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.

Parameters:
nameThe 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 .
Examples:
config_modfile.cpp.
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.

Parameters:
valueset 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.

Parameters:
namemust be a valid modification name.
modis the new definition of the modification.
Returns:
true if the modification was found and updated.
Examples:
config_modfile.cpp.
bool updateModificationByNumber ( const int  num,
const ms_modification  mod 
)

Update the information for a specific modification.

Parameters:
nummust be in the range 0..(getNumberOfModifications() - 1).
modis the new definition of the modification.
Returns:
true if the modification was found and updated.

The documentation for this class was generated from the following files:
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:53