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

Represents the LibraryOptions section of mascot.dat. More...

#include <ms_libraryoptions.hpp>

Inheritance diagram for ms_libraryoptions:
Collaboration diagram for ms_libraryoptions:

Public Member Functions

 ms_libraryoptions ()
 Default constructor.
 
 ms_libraryoptions (const ms_libraryoptions &src)
 Copying constructor.
 
 ~ms_libraryoptions ()
 Destructor.
 
void appendProperty (const char *name, const char *value, const char *delimiter, const bool bFirstPlace=false)
 Adds a new property with the given parameters.
 
void appendText (const char *line, const bool bFirstPlace=false)
 Adds a new non-parsed property.
 
void copyFrom (const ms_customproperty *src)
 Copies all properties and comments from another instance.
 
void copyFrom (const ms_libraryoptions *right)
 Can be used to copy content from another instance.
 
void defaultValues ()
 Initializes the instance.
 
void delNonEmpty ()
 Deletes all non-comment properties.
 
void delProp (const char *name)
 Deletes all properties with the specified name.
 
void delPropByNumber (const int index)
 Deletes a single property with the specified number only.
 
void delPropStart (const char *nameBeginning)
 Deletes all properties whose names start with the given string.
 
void dropSpectralLibrary (const char *spectralLibraryName)
 Remove all references to the specified spectral library.
 
int findProperty (const char *name, const int startFrom=0) const
 Searches the list for a property with the given name.
 
int findPropertyBeginning (const char *nameBeginning, const int startFrom=0) const
 Searches the list for a property with the partially matching name.
 
std::string getDefaultDelimiter () const
 Return current default delimiter string used for parsing/storing properties.
 
std::string getDelimiterByNumber (const int index) const
 Returns a specific delimiter used for the property.
 
std::string getLibraryName (const int num) const
 Return the name of the library.
 
int getNumberOfLibraries () const
 Return the number of libraries.
 
int getNumberOfProperties () const
 Returns a total number of property/comment entries.
 
std::string getPreceedingComments () const
 Returns any comments preceeding the section.
 
std::string getPropertyName (const int index) const
 Returns a property name for a given index.
 
std::string getPropValStringByName (const char *name) const
 Retrieves property value by name.
 
std::string getPropValStringByNumber (const int index) const
 Retrieves property raw text values by number.
 
std::string getReferenceFasta (const char *spectralLibraryName) const
 Returns the name of the Fasta database used as a reference for accessions for the spectral library.
 
std::string getReferenceFastaTaxonomyTitle (const char *spectralLibraryName) const
 Returns the title of the taxonomy to use for the reference database.
 
double getToleranceInDa (const char *spectralLibraryName) const
 Returns the tolerance of the data in spectral library.
 
double getToleranceInPPM (const char *spectralLibraryName) const
 Returns the tolerance of the data in spectral library.
 
bool isSectionAvailable () const
 Check whether the section has been actually read from the file.
 
ms_libraryoptionsoperator= (const ms_libraryoptions &right)
 Assignment operator for C++ client applications.
 
void setDefaultDelimiter (const char *delim)
 Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.
 
void setPreceedingComments (const std::string &comments)
 Sets any comments preceeding the section.
 
void setPropertyName (const int index, const char *name)
 Changes name of the property with the given index.
 
void setPropValBoolByName (const char *name, const bool value, const bool bFirstPlace=false)
 Changes a boolean value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValCharByName (const char *name, const char value, const bool bFirstPlace=false)
 Changes a single character value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValFloatByName (const char *name, const double value, const bool bFirstPlace=false)
 Changes an floating point value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValInt64ByName (const char *name, const INT64 value, const bool bFirstPlace=false)
 Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValIntByName (const char *name, const int value, const bool bFirstPlace=false)
 Changes an integer value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValStringByName (const char *name, const char *value, const bool bFirstPlace=false)
 Changes a string value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValStringByNumber (const int index, const char *value)
 Changes an string value of an existing property with the given index.
 
void setReferenceFasta (const char *spectralLibraryName, const char *fastaDatabaseName, const char *taxonomyTitle)
 Sets the name of the Fasta database used as a reference for accessions for the spectral library.
 
void setSectionAvailable (const bool value)
 Changes availability of the section, i.e. whether it should be saved in a file.
 
void setToleranceInDa (const char *spectralLibraryName, double tolerance)
 Sets the tolerance of the data in spectral library.
 
void setToleranceInPPM (const char *spectralLibraryName, double tolerance)
 Sets the tolerance of the data in spectral library.
 
bool uncommentProp (const int index, const char *delimeter=0)
 Uncomments a line in the configuration file.
 

Detailed Description

Represents the LibraryOptions section of mascot.dat.

See : ms_datfile::getLibraryOptions and ms_datfile::setLibraryOptions

Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:

  • Retrieving an unsupported property.
  • Retrieving a raw/text/XML property representation.
  • Checking for existence of a certain property rather than dealing with its default value.
  • Accessing commented lines in a section.

More functionality is described in the documentation for ms_customproperty.

Constructor & Destructor Documentation

◆ ms_libraryoptions() [1/2]

Default constructor.

Create an object with no options

◆ ms_libraryoptions() [2/2]

Copying constructor.

C++ only. Use copyFrom from other languages.

Parameters
srcis the source options to copy into the new object

◆ ~ms_libraryoptions()

Destructor.

Frees any memory

Member Function Documentation

◆ appendProperty()

void appendProperty ( const char *  name,
const char *  value,
const char *  delimiter,
const bool  bFirstPlace = false 
)
inherited

Adds a new property with the given parameters.

Parameters
namea property name to use.
valuea property value to use.
delimitera specific delimiter or an empty string for a default one to be used.
bFirstPlaceforces a new property to be put on top of the list.

◆ appendText()

void appendText ( const char *  l,
const bool  bFirstPlace = false 
)
inherited

Adds a new non-parsed property.

All property elements will be retrieved from the first parameter. Before calling this method, a specific default delimiter can be set using setDefaultDelimiter().

Parameters
lraw text representation of the property to be parsed.
bFirstPlaceforces a new property to be put on top of the list.

◆ copyFrom()

void copyFrom ( const ms_libraryoptions right)

Can be used to copy content from another instance.

Copy all the parameter for the libraries from right into the object

Parameters
rightis the source library options

◆ defaultValues()

void defaultValues ( )

Initializes the instance.

Remove details for all the libraries

◆ delProp()

void delProp ( const char *  str)
inherited

Deletes all properties with the specified name.

Parameters
strProperty name to find a match and then delete.

◆ delPropStart()

void delPropStart ( const char *  str)
inherited

Deletes all properties whose names start with the given string.

Parameters
strBeginning a first part of the property name to delete.

◆ dropSpectralLibrary()

void dropSpectralLibrary ( const char *  spectralLibraryName)

Remove all references to the specified spectral library.

Parameters
spectralLibraryNameis the (short) name of the library

◆ findProperty()

int findProperty ( const char *  name,
const int  startFrom = 0 
) const
inherited

Searches the list for a property with the given name.

If no property found with the given name -1 will be returned. There may be several property entries in the list with the same name.

Parameters
namea property name to be found.
startFroma minimal property index to start search from.
Returns
a property index or -1 if no property found.

◆ findPropertyBeginning()

int findPropertyBeginning ( const char *  nameBeginning,
const int  startFrom = 0 
) const
inherited

Searches the list for a property with the partially matching name.

If no property found with the given name part -1 will be returned. There may be several property entries in the list whose names start with the given string.

Parameters
nameBeginningfirst part of a property name to be found.
startFroma minimal property index to start search from.
Returns
a property index or -1 if no property found.

◆ getDefaultDelimiter()

std::string getDefaultDelimiter ( ) const
inherited

Return current default delimiter string used for parsing/storing properties.

Returns
default delimiter

◆ getDelimiterByNumber()

std::string getDelimiterByNumber ( const int  index) const
inherited

Returns a specific delimiter used for the property.

Parameters
indexIndex for which to get a delimiter
Returns
corresponding delimiter

◆ getLibraryName()

std::string getLibraryName ( const int  num) const

Return the name of the library.

Parameters
nummust be in the range 0 to getNumberOfLibraries() -1
Returns
the name of the library which can be used in other functions such as getReferenceFasta()

◆ getNumberOfLibraries()

int getNumberOfLibraries ( ) const

Return the number of libraries.

Returns
The number of libraries with parameters in the section

◆ getNumberOfProperties()

int getNumberOfProperties ( ) const
inherited

Returns a total number of property/comment entries.

Returns
Number of property/comment entries

◆ getPreceedingComments()

std::string getPreceedingComments ( ) const
inherited

Returns any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also
setPreceedingComments()
Returns
any comments preceeding the section

◆ getPropertyName()

std::string getPropertyName ( const int  index) const
inherited

Returns a property name for a given index.

Parameters
indexproperty number from 0 to (getNumberOfProperties()-1).
Returns
Rroperty name of an empty string for comments.

◆ getPropValStringByName()

std::string getPropValStringByName ( const char *  name) const
inherited

Retrieves property value by name.

Don't use this method for comments as they all have empty name. Also note that there might be several entries corresponding to the same name . – only the first value will be returned. If in doubt use findProperty() and getPropValStringByNumber() instead.

Parameters
nameName for which to get a property value
Returns
corresponding property value

◆ getPropValStringByNumber()

std::string getPropValStringByNumber ( const int  index) const
inherited

Retrieves property raw text values by number.

Parameters
indexIndex for which to get a property value
Returns
corresponding property value

◆ getReferenceFasta()

std::string getReferenceFasta ( const char *  spectralLibraryName) const

Returns the name of the Fasta database used as a reference for accessions for the spectral library.

A Spectral library is essentially a peptide library and will often not contain meaningful accessions. To get useful protein grouping in Mascot reports, it is recommended that users specify a 'reference' database. When a reference database is used, Mascot tries to find the peptide sequence from the library in the reference fasta, and if it is found then it adds the accession for that protein sequence to the search results.

See also
getReferenceFastaTaxonomyTitle()
Parameters
spectralLibraryNameis the (short) name of the library
Returns
the (short) name of the reference fasta

◆ getReferenceFastaTaxonomyTitle()

std::string getReferenceFastaTaxonomyTitle ( const char *  spectralLibraryName) const

Returns the title of the taxonomy to use for the reference database.

The reference database may contain protein accessions from multiple taxa. If a suitable taxonomy index is configured, you can define the taxon to use for reference accessions. The returned value is the title string of an entry in the taxonomy configuration file (typically mascot/config/taxonomy).

See also
getReferenceFasta()
Parameters
spectralLibraryNameis the (short) name of the library
Returns
the title of the taxon, or the empty string if not set.

◆ getToleranceInDa()

double getToleranceInDa ( const char *  spectralLibraryName) const

Returns the tolerance of the data in spectral library.

A spectral library is created using an instrument with a known tolerance and this tolerance is specified by the user when they enable the use of the library in Mascot. When the library is searched, the tolerance used is the square root of the sum of the squares of the data being searched and this value.

The tolerance of the library is specified in Da and ppm since the user may choose either units when they submit a search.

See also, getToleranceInPPM(), setToleranceInPPM() and setToleranceInDa()

If spectralLibraryName does not exist, returns the default (0.6 Da)

Parameters
spectralLibraryNameis the (short) name of the library
Returns
the tolerance of the data in the library

◆ getToleranceInPPM()

double getToleranceInPPM ( const char *  spectralLibraryName) const

Returns the tolerance of the data in spectral library.

A spectral library is created using an instrument with a known tolerance and this tolerance is specified by the user when they enable the use of the library in Mascot. When the library is searched, the tolerance used is the square root of the sum of the squares of the data being searched and this value.

The tolerance of the library is specified in Da and ppm since the user may choose either units when they submit a search.

See also, setToleranceInPPM(), getToleranceInDa() and setToleranceInDa()

If spectralLibraryName does not exist, returns the default (500ppm)

Parameters
spectralLibraryNameis the (short) name of the library
Returns
the tolerance of the data in the library

◆ isSectionAvailable()

bool isSectionAvailable ( ) const

Check whether the section has been actually read from the file.

By default the LibraryOptions section is unavailable until it has been set to a different state.

The section does not have to exist in the mascot.dat file

Returns
true if the section exists

◆ operator=()

ms_libraryoptions & operator= ( const ms_libraryoptions right)

Assignment operator for C++ client applications.

C++ only

Parameters
rightis the source library options
Returns
a reference to 'this'

◆ setDefaultDelimiter()

void setDefaultDelimiter ( const char *  delim)
inherited

Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.

Parameters
delimString to set the default delimiter

◆ setPreceedingComments()

void setPreceedingComments ( const std::string &  comments)
inherited

Sets any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also
getPreceedingComments()
Parameters
commentsany comments preceeding the section

◆ setPropertyName()

void setPropertyName ( const int  index,
const char *  name 
)
inherited

Changes name of the property with the given index.

Parameters
indexproperty number from 0 to (getNumberOfProperties()-1).
namenew name to be given to the property.

◆ setPropValBoolByName()

void setPropValBoolByName ( const char *  name,
const bool  value,
const bool  bFirstPlace = false 
)
inherited

Changes a boolean value of the first entry with the given name or creates a new property if it is not found.

A new value will be converted into 1 (for TRUE) or 0 (for FALSE) character.

Parameters
namea name of the property to find or add.
valuea new boolean value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValCharByName()

void setPropValCharByName ( const char *  name,
const char  value,
const bool  bFirstPlace = false 
)
inherited

Changes a single character value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new single character value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValFloatByName()

void setPropValFloatByName ( const char *  name,
const double  value,
const bool  bFirstPlace = false 
)
inherited

Changes an floating point value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new floating point value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValInt64ByName()

void setPropValInt64ByName ( const char *  name,
const INT64  value,
const bool  bFirstPlace = false 
)
inherited

Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new long 64-bit integer value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValIntByName()

void setPropValIntByName ( const char *  name,
const int  value,
const bool  bFirstPlace = false 
)
inherited

Changes an integer value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new integer value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValStringByName()

void setPropValStringByName ( const char *  name,
const char *  value,
const bool  bFirstPlace = false 
)
inherited

Changes a string value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new string value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValStringByNumber()

void setPropValStringByNumber ( const int  index,
const char *  str 
)
inherited

Changes an string value of an existing property with the given index.

Parameters
indexan index of an existing property.
strString value for the property.

◆ setReferenceFasta()

void setReferenceFasta ( const char *  spectralLibraryName,
const char *  fastaDatabaseName,
const char *  taxonomyTitle 
)

Sets the name of the Fasta database used as a reference for accessions for the spectral library.

A Spectral library is essentially a peptide library and will often not contain meaningful accessions. To get useful protein grouping in Mascot reports, it is recommended that users specify a 'reference' database. When a reference database is used, Mascot tries to find the peptide sequence from the library in the reference fasta. If it is found, Mascot adds the accession for that protein sequence to the search results.

The reference database may contain protein accessions from multiple taxa. To restrict accesions to a particular taxon, give its title as the third argument. Titles typically come from the taxonomy configuration file (mascot/config/taxonomy). If left empty, there is no restriction.

Parameters
spectralLibraryNameis the (short) name of the library
fastaDatabaseNameis the (short) name of the reference database
taxonomyTitleis the title of the taxon to use, or the empty string.

◆ setSectionAvailable()

void setSectionAvailable ( const bool  value)

Changes availability of the section, i.e. whether it should be saved in a file.

The section does not have to exist in the mascot.dat file

Parameters
valueset to true if the section exists

◆ setToleranceInDa()

void setToleranceInDa ( const char *  spectralLibraryName,
double  tolerance 
)

Sets the tolerance of the data in spectral library.

A spectral library is created using an instrument with a known tolerance and this tolerance is specified by the user when they enable the use of the library in Mascot. When the library is searched, the tolerance used is the square root of the sum of the squares of the data being searched and this value.

The tolerance of the library is specified in Da and ppm since the user may choose either units when they submit a search.

See also, getToleranceInPPM(), setToleranceInPPM() and getToleranceInDa()

If spectralLibraryName does not exist, returns the default (500ppm)

Parameters
spectralLibraryNameis the (short) name of the library
toleranceis the new tolerance for spectralLibraryName

◆ setToleranceInPPM()

void setToleranceInPPM ( const char *  spectralLibraryName,
double  tolerance 
)

Sets the tolerance of the data in spectral library.

A spectral library is created using an instrument with a known tolerance and this tolerance is specified by the user when they enable the use of the library in Mascot. When the library is searched, the tolerance used is the square root of the sum of the squares of the data being searched and this value.

The tolerance of the library is specified in Da and ppm since the user may choose either units when they submit a search.

See also, getToleranceInPPM(), getToleranceInDa() and setToleranceInDa()

If spectralLibraryName does not exist, this adds a new entry for the library and sets a default value for other parameters for the library

Parameters
spectralLibraryNameis the (short) name of the library
toleranceis the new tolerance for spectralLibraryName

◆ uncommentProp()

bool uncommentProp ( const int  index,
const char *  delimeter = 0 
)
inherited

Uncomments a line in the configuration file.

Removes a # and any white space. Finds the delimeter and extracts the property name and value.

Parameters
indexmust be a value between 0 and getNumberOfProperties().
delimeterwill often be a space. If not supplied, the default delimeter will be used.
Returns
true if the delimiter was found, false otherwise

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