Matrix Science header
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

ms_ms1quantitation Class Reference
[Quantitation analysis for Mascot Server and Distiller]

The result of quantitation calculations applied to peptide summary. More...

#include <ms_ms1quantitation.hpp>

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

List of all members.

Public Types

enum  MERGE_QUANT_RESULTS_FLAGS {
  MERGE_QUANT_QUERY_NUMBERS_ARE_FROM_MERGED_RESULTS = 0x0001,
  MERGE_QUANT_MERGE_COMPONENTS_INTO_QUANT_MATCH = 0x0002,
  MERGE_QUANT_USE_COMPONENT_FILE_INDEX_TO_FIND_XIC = 0x0004,
  MERGE_QUANT_APPLY_THRESHOLDS_AFTER_MERGE = 0x0008,
  MERGE_QUANT_DEFAULT_PRECURSOR_METHOD = MERGE_QUANT_APPLY_THRESHOLDS_AFTER_MERGE,
  MERGE_QUANT_DEFAULT_REPLICATE_METHOD = (MERGE_QUANT_QUERY_NUMBERS_ARE_FROM_MERGED_RESULTS | MERGE_QUANT_MERGE_COMPONENTS_INTO_QUANT_MATCH | MERGE_QUANT_USE_COMPONENT_FILE_INDEX_TO_FIND_XIC)
}
 

Enum for mergeQuantitationResults()

More...
enum  MS1QUANT_BUGFIX_NUM { BUGFIX_12409 = 12409 }
 

bugNum values for isDataCached().

More...

Public Member Functions

 ms_ms1quantitation (const ms_peptidesummary &summary, const ms_quant_method &method)
 Constructor: given a peptide summary and a quantitation method, prepare for data processing.
void addHeaderField (const std::string &name, const std::string &value)
 Adds an item of project or search header information.
matrix_science::ms_ms1quant_match addMatchInferred (const ms_ms1quant_match &siblingMatch, int newCharge)
 Add an inferred peptide match to the quantitation results.
void addMatchPeptide (matrix_science::ms_protein *hit, matrix_science::ms_peptide *peptide, const matrix_science::ms_quant_component &component, const std::string &matchBelongsToComponent)
 Add a quantitation peptide match to a protein hit.
void addMatchStatus (matrix_science::ms_peptide *peptide, matrix_science::ms_ms1quant_peptide_status::peptideStatus status, matrix_science::ms_protein *hit=0)
 Add the quantitation status for the protein-peptide match to the quantitation results.
void addPeptideQuantKey (const std::string &accession, int dbIdx, const ms_peptide_quant_key &key)
 Associate a protein accession with a peptide quant key.
void addPeptideQuantKeys (const std::string &accession, int dbIdx, const ms_peptide_quant_key_vector &keys)
 Associate a protein accession with particular peptide quant keys.
void addPeptideQuantKeys (const std::string &accession, int dbIdx, const std::vector< ms_peptide_quant_key > &keys)
 Associate a protein accession with particular peptide quant keys.
void addPeptideRatio (const ms_peptide_quant_ratio &ratio)
 Add a new peptide ratio.
void addRawFileField (const unsigned int id, const std::string &name, const std::string &value)
 Adds an item of raw file header information.
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 clearHeaderFields ()
 Clears any header information from the result.
void clearPeptideQuantKeys (const std::string &accession, int dbIdx)
 Clear all peptide quant key associations for a given protein.
void clearPeptideRatios ()
 Remove all peptide ratios.
void clearRawFileFields ()
 Clears any raw file header information from the result.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
virtual int countDistinctPeptides (const std::vector< ms_peptide_quant_key > &activeKeys) const
 Get the number of distinct peptides in the list of active candidates.
virtual int countDistinctPeptides (const ms_peptide_quant_key_vector &activeKeys) const
 Get the number of distinct peptides in the list of active candidates.
bool findMatch (matrix_science::ms_peptide_quant_key matchKey, ms_ms1quant_match *match) const
 Get a match by its key.
bool findPeptideStatus (int query, int rank, ms_ms1quant_peptide_status *peptideStatus) const
 Get a peptide status in the quantitation results by the peptide's query and rank.
bool getAveragePeptideIntensity (const std::string &accession, int dbIdx, double *averageIntensity, int *sampleSize, ms_peptide_quant_key_vector *includeKeys, ms_peptide_quant_key_vector *excludeKeys) const
 Average protocol only: get the intensity of the protein based on its component peptide intensities.
const ms_ms1quant_average_resultsgetAverageResults () const
 Return the results from an 'average' protocol.
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
ms_proteingetHit (int index1) const
 Get a quantitated protein.
std::string getLabelFree (std::string peptideStr, std::string varMods, std::string summedMods, const matrix_science::ms_quant_component &comp) const
 Get the label-free modifications string, combined from the variable mods and the summed mods.
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.
ms_ms1quant_match getMatch (int index) const
 Get a match by its index (1..getNumMatches()).
ms_ms1quant_match getMatch (const ms_peptide_quant_key &key) const
 Get a match by its key.
ms_ms1quant_match getMatchForHit (int index, int hitId, int memberNumber) const
 Get a match for the specified hit protein (index is 1..numberOfMatchesForHit).
int getNumGroups () const
 Return the number of match groups
int getNumHits () const
 Get the number of quantitated proteins.
int getNumMatches () const
 Get the number of peptide matches for all quantitated proteins.
int getNumMatchesForGroup (int groupIndex1) const
 Return the number of matches for each group.
int getNumMatchesForHit (int hitId, int memberNumber) const
 Get the number of matches for the specified hit protein.
int getNumPeptideStatuses () const
 Get the number of peptide statuses.
int getNumProteinFamilies () const
 Get the number of protein families.
ms_peptide_quant_key_vector getPeptideQuantKeys (const std::string &accession, int dbIdx) const
 Look up peptide quant keys associated with a given protein, if any.
virtual ms_peptide_quant_ratio getPeptideRatio (const ms_peptide_quant_key &key, const std::string &ratioName) const
 Given peptide quant key and ratio name, return the corresponding peptide ratio data.
double getPeptideRatioNormalisationBase (const std::string &ratioName) const
 Get the peptide ratio normalisation base of the given ratio name.
ms_ms1quant_peptide_status getPeptideStatus (int index) const
 Get a peptide status by its index.
const ms_progress_infogetProgressInfo ()
 Get information about the progress of a currently running long operation (e.g. loading from a file).
virtual ms_protein_quant_ratio getProteinRatio (const std::string &accession, int dbIdx, const std::string &ratioName) const
 Overridden from ms_quantitation (via ms_customquantitation) base class.
virtual ms_protein_quant_ratio getProteinRatio (const std::string &accession, int dbIdx, const std::string &ratioName, const ms_peptide_quant_key_vector &includeKeys, const ms_peptide_quant_key_vector &excludeKeys) const
 Overridden from ms_quantitation (via ms_customquantitation) base class.
std::vector< int > getQuantitationDatasources () const
 Get the datasource identifiers of every data source in use for quantitation.
const ms_quant_methodgetQuantitationMethod () const
 Return the current quantitation method.
std::string getReadableVarMods (std::string varmods)
 Get the human-readable format of the given variable modifications.
std::string getReadableVarModsConcise (std::string varmods)
 Get the concise version of the human-readable format of the given variable modifications.
const ms_peptidesummarygetSummary () const
 The summary is needed to recover the proteins and peptides.
double getUnnormalisedAveragePeptideRatio (const std::string &ratioName, const std::string &averageType) const
 Calculate the unnormalised average peptide ratio.
double getUnnormalisedAveragePeptideRatio (const std::string &ratioName, const std::string &averageType, const ms_peptide_quant_key_vector &keys) const
 Calculate the unnormalised average of selected peptide quant keys.
double getUnnormalisedAveragePeptideRatio (const std::string &ratioName, const std::string &averageType, const std::string &accession, int dbIdx) const
 Calculate the unnormalised average of peptide quant keys of a protein accession.
virtual bool hasPeptideRatio (const ms_peptide_quant_key &key, const std::string &ratioName) const
 Existence check: return true if a peptide ratio with the associated peptide quant key and ratio name exists.
void initGroupChargeStates (std::set< int > *calc_chargestates, int iGroup1, int minCharge, int maxCharge)
 Add inferred charge states to the group if specified in the method.
bool isAverageProtocol () const
 Return true if the quantitation method uses the Average protocol.
bool isDataCached (MS1QUANT_BUGFIX_NUM bugNum) const
 Returns true if the cache file contains data relevant to the given bug number.
virtual bool isPeptideRatioExcluded (const ms_peptide_quant_key &key, const std::string &ratioName) const
 Boolean flag: is the given peptide ratio globally excluded from protein ratio calculation?
bool isValid () const
 Call this function to determine if there have been any errors.
bool loadCdbFile (const std::string &cdbFilename, const std::string &cacheFilename, bool revalidateQualityThresholds=true)
 Load the results from a matched pair of files.
bool loadXmlFile (const std::string &filename, const std::string &xmlSchemaPath)
 Load quantitation results from an XML file. The schema is loaded from the location known to the.
bool mergeQuantitationResults (const std::vector< std::string > &xmlFilenames, const MERGE_QUANT_RESULTS_FLAGS flags, const std::string &xmlSchemaPath="", const matrix_science::ms_quant_method *originalMethod=0)
 Merges the quantitation results loaded from xml result files.
bool mergeQuantitationResults (const std::vector< std::string > &cdbFilenames, const std::vector< std::string > &cacheFilenames, const MERGE_QUANT_RESULTS_FLAGS flags, const matrix_science::ms_quant_method *originalMethod=0)
 Merges the quantitation results from matched pairs of cdb files.
void removeMatch (matrix_science::ms_peptide_quant_key matchKey)
 Remove the specified peptide match from the results.
void removePeptideQuantKey (const std::string &accession, int dbIdx, const ms_peptide_quant_key &key)
 Deassociate a peptide quant key from the given protein.
void removePeptideRatio (const ms_peptide_quant_key &key, const std::string &ratioName)
 Remove a particular peptide ratio.
void removePeptideRatioNormalisationBase (const std::string &ratioName)
 Reset the peptide ratio normalisation base of the given ratio name.
void removePeptideRatioNormalisationBases ()
 Reset all peptide ratio normalisation bases.
bool saveCdbFile (const std::string &cdbFilename, const std::string &cacheFilename, bool createEmptyMissingComponents=false)
 Save the results to a matched pair of files.
bool saveXmlFile (const std::string &xmlFilename, bool completeReport)
 Save the quantitation results to an XML file.
void setAverageNumPeptides (unsigned int num=3)
 Average protocol only: set the number of most intense peptide groups to use.
void setAverageReferenceProtein (const char *accession, int dbIdx, bool isReferenceUserSelected)
 Average protocol only: select a reference protein accession and database.
void setAverageSelection (const char *value)
 Average protocol only: set the method of grouping peptide ratios.
void setMinNumPeptides (int value)
 Set the minimum number of peptides needed for protein ratio calculation.
virtual void setPeptideRatioExcluded (const ms_peptide_quant_key &key, const std::string &ratioName)
 Globally exclude a particular peptide ratio from protein ratio calculation.
virtual void setPeptideRatioIncluded (const ms_peptide_quant_key &key, const std::string &ratioName)
 Globally include a particular peptide ratio in protein ratio calculation.
void setPeptideRatioNormalisationBase (const std::string &ratioName, double b)
 Set the peptide ratio normalisation base of the given ratio name.
virtual void setProteinRatioType (const char *value)
 Set the protein ratio type.
virtual void setQuantOutliers (const ms_quant_outliers *)
 Set new peptide ratio outlier settings.

Static Public Member Functions

static
matrix_science::ms_ms1quantitation
openQuantitationCdbResults (const matrix_science::ms_peptidesummary &summary, const matrix_science::ms_quant_method &method, const std::string &cdbFilename, const std::string &cacheFilename, const matrix_science::ms_quant_method *originalMethod=0)
 Opens and loads quantitation results from a matched pair of cdb files.
static
matrix_science::ms_ms1quantitation
openQuantitationXmlResults (const matrix_science::ms_peptidesummary &summary, const matrix_science::ms_quant_method &method, const std::string &filename, const std::string &xmlSchemaPath="", const matrix_science::ms_quant_method *originalMethod=0)
 Opens and loads quantitation results from an xml result file.
static bool readResultCounters (const std::string &cdbFile, int &numMatches, int &numHits, int &numPepGrp, int &numPeptideComponents)
 Reads and returns the Counters information from the cdb result file.

Protected Member Functions

ms_protein_quant_ratio calculateGeometricMeanRatio (const std::string &accession, int dbIdx, const std::string &ratioName, const std::vector< double > &sample, const std::vector< double > &logSample, const std::vector< ms_peptide_quant_key > &activeKeys, const std::map< ms_peptide_quant_key, int > &inactiveKeys, double normalityPvalue) const
 Given a sample of peptide ratios, calculate the geometric mean and standard deviation.
ms_protein_quant_ratio calculateMedianRatio (const std::string &accession, int dbIdx, const std::string &ratioName, const std::vector< double > &sample, const std::vector< double > &logSample, const std::vector< ms_peptide_quant_key > &activeKeys, const std::map< ms_peptide_quant_key, int > &inactiveKeys, double normalityPvalue) const
 Given a sample of peptide ratios, calculate the median and standard deviation from the median.
ms_protein_quant_ratio calculateWeightedGeometricMeanRatio (const std::string &accession, int dbIdx, const std::string &ratioName, const std::vector< double > &sample, const std::vector< double > &logSample, const std::vector< double > &weights, const std::vector< ms_peptide_quant_key > &activeKeys, const std::map< ms_peptide_quant_key, int > &inactiveKeys, double normalityPvalue) const
 Given a sample of peptide ratios, calculate the weighted geometric mean and standard deviation.
int getMinNumPeptides () const
 Get the minimum number of peptides needed for protein ratio calculation.
void getProteinRatioSample (const std::string &accession, int dbIdx, const std::string &ratioName, const std::vector< ms_peptide_quant_key > &includeKeys, const std::vector< ms_peptide_quant_key > &excludeKeys, std::vector< double > &sample, std::vector< double > &logSample, std::vector< double > &weights, std::vector< ms_peptide_quant_key > &activeKeys, std::map< ms_peptide_quant_key, int > &inactiveKeys, double &normalityPvalue) const
 Find the peptide quant keys associated with the protein, collect their unique peptide ratios, remove outliers (if desired) and return the values as the sample of peptide ratios.
virtual void getSortedFinitePeptideRatioValues (const std::string &ratioName, const std::set< ms_peptide_quant_key > &keys, const std::set< ms_peptide_quant_key > &includeKeys, const std::set< ms_peptide_quant_key > &excludeKEys, std::vector< double > &values, std::vector< double > &weights, std::vector< ms_peptide_quant_key > &activeKeys, std::map< ms_peptide_quant_key, int > &inactiveKeys) const
 Given a list of q,p values and ratio name, find the non-infinite peptide ratio values and return them in numerically increasing order.
bool initialiseBaseSettings (const ms_quant_method &qmBase, const ms_quant_method &qmConfig)
 Initialise quantitation method settings from the two method objects.

Protected Attributes

protein_to_peptide_quant_key_t proteinKeys_
 Protein-to-peptide mapping.

Detailed Description

The result of quantitation calculations applied to peptide summary.

Each ms_protein hit from the ms_peptidesummary can have any number of peptide matches (ms_ms1quant_match) that contribute to its protein ratios.

Peptide ratios are identified by the index key (0..getNumMatches()-1) identifying the ms_ms1quant_match (ms_peptide_quant_key(int ID)).

Protein ratios are identified by protein accession and database index.

As the quantitation results are loading (loadCdbFile() or loadXmlFile()), the protein hits references to the quantitation peptide ratio results validated with the current ms_peptidesummary. These will normally match but may not if, for instance, the peptide summary has been re-calculated since the quantitation results were generated. If a protein has changed its hit reference in the peptide summary (but can still be found by its accession, in any database) a warning message is added to the ms_errors to indicate that the protein reference has been updated. If a protein is no longer present in the peptide summary then a warning message is added to the ms_errors to indicate that the protein was not found.

Example code to load quantitation results and list protein ratios:

void listProteins(const ms_peptidesummary & pepsum, const ms_quant_method & method, const char * cdbFilename, const char * cacheFilename)
{
    ms_ms1quantitation quant(pepsum, method);
    quant.loadCdbFile(cdbFilename, cacheFilename);
    for (int iHit = 1; iHit <= pepsum.getNumberOfHits(); ++iHit)
    {
        ms_protein * hit = pepsum.getHit(iHit);
        cout << endl << pepsum.getProteinDescription(hit->getAccession().c_str(), hit->getDB()) << endl;
        const std::vector<const matrix_science::ms_quant_ratio*> & proteinRatios = quant.getProtocol()->getProteinRatios();
        for (unsigned iRatio = 0; iRatio < proteinRatios.size(); ++iRatio)
        {
            std::string ratioName = proteinRatios[iRatio]->getName();
            ms_protein_quant_ratio rat = quant.getProteinRatio(hit->getAccession(), hit->getDB(), ratioName);
            if (!rat.isMissing())
            {
                cout << "    " << ratioName << " = " << rat.getValue() << endl;
            }
        }
    }
}
     

Member Enumeration Documentation

Enum for mergeQuantitationResults()

Enumerator:
MERGE_QUANT_QUERY_NUMBERS_ARE_FROM_MERGED_RESULTS 

For replicate, each subproject uses the merged results. (For precursor, each subproject uses its own search result)

MERGE_QUANT_MERGE_COMPONENTS_INTO_QUANT_MATCH 

For replicate, we create a component in one file, based on the match to the same query in another file. Merge these components into one ms_ms1quant_match.

MERGE_QUANT_USE_COMPONENT_FILE_INDEX_TO_FIND_XIC 

For replicate, the XIC for a particular component is saved saved in the relevant file, available using ms_quant_component::getFileIndex(). For precursor, all components can be in one subproject file.

MERGE_QUANT_APPLY_THRESHOLDS_AFTER_MERGE 

This shouldn't be done for replicate, because the ratios will all be incorrect until they are recalculated after calling mergeQuantitationResults()

MERGE_QUANT_DEFAULT_PRECURSOR_METHOD 

Use this for any precursor method.

MERGE_QUANT_DEFAULT_REPLICATE_METHOD 

Use this for any replicate method.

bugNum values for isDataCached().

If loaded from a cdb file from Distiller 2.7 or earlier, then the cache file may not contain data for later improvements. While this does not affect functionality, it may impact performance. For example, bug#12409 means that unnormalised peptide ratios are saved in the cdb file, allowing for rapid disabling of normalisation without requiring requantitation

See Using enumerated values and static const ints in Perl, Java, Python and C# and ms_peptidesummary::isDataCached(),

Enumerator:
BUGFIX_12409 

Distiller 2.7 or earlier save normalised peptide ratios to the cdb file. If this method returns false, the enabling and disabling normalisation is not possible from within msparser and requires the data to be requantitated.


Constructor & Destructor Documentation

ms_ms1quantitation ( const ms_peptidesummary summary,
const ms_quant_method method 
)

Constructor: given a peptide summary and a quantitation method, prepare for data processing.

ms_ms1quantitation does not calculate the quantitation matches; it loads in previously calculated and stored matches but the peptide and protein ratios are re-calculated as required.

After contructing the ms_ms1quantitation, the quantitation results should be loaded using loadCdbFile() or loadXmlFile().

Parameters:
summaryMascot results file to quantitate. Note that you must first validate the embedded XML sections of the results file. Either pass the schema directory to the ms_mascotresfile constructor or use ms_mascotresfile::setXMLschemaFilePath().
methodQuantitation method to use. If the results are being taken from a Distiller project file, then the quantitation method from the ms_distiller_data should be used.

Member Function Documentation

matrix_science::ms_ms1quant_match addMatchInferred ( const ms_ms1quant_match siblingMatch,
int  newCharge 
)

Add an inferred peptide match to the quantitation results.

Parameters:
siblingMatchThe identified match the inferred match is derived from
newChargeThe charge state of the inferred match
Returns:
the newly created and added ms_ms1quant_match object
void addMatchPeptide ( matrix_science::ms_protein hit,
matrix_science::ms_peptide peptide,
const matrix_science::ms_quant_component component,
const std::string &  matchBelongsToComponent 
)

Add a quantitation peptide match to a protein hit.

Parameters:
hitThe protein hit the peptide quantitation match is associated with
peptideThe peptide
componentThe quantitation component the match is associated with
matchBelongsToComponentis used to determine whether to call ms_ms1quant_match::addIdentifiedComponent() or ms_ms1quant_match::addCreatedComponent() because for MS1 label free we need a created component if there's no match in our file. Pass an empty string for protocols other than label free

Add the quantitation status for the protein-peptide match to the quantitation results.

Adds the status of a peptide match assigned to the specified protein to the quantitation results

Parameters:
peptideThe peptide associated with the quantitation match
statusThe peptide quantitation match status
hitThe protein hit the peptide match is associated with. Do not pass this parameter for unassigned peptide matches
void addPeptideQuantKey ( const std::string &  accession,
int  dbIdx,
const ms_peptide_quant_key key 
) [inherited]

Associate a protein accession with a peptide quant key.

A protein-peptide mapping is required for protein ratio calculation purposes. That is, each protein accession whose ratio you need must have at least one peptide quant key associated with it, and the peptide quant key must have a peptide ratio defined.

If key is already associated with this protein, no changes are made.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
keyPeptide quant key.
void addPeptideQuantKeys ( const std::string &  accession,
int  dbIdx,
const std::vector< ms_peptide_quant_key > &  keys 
) [inherited]

Associate a protein accession with particular peptide quant keys.

Note:
This method can only be used from C++. Use addPeptideQuantKeys(std::string, int, const ms_peptide_quant_key_vector) from other programming languages instead.

A protein-peptide mapping is required for protein ratio calculation purposes. That is, each protein accession whose ratio you need must have at least one peptide quant key associated with it, and the peptide quant key must have a peptide ratio defined.

Values in keys already associated with the protein are skipped.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
keysPeptide quant keys.
void addPeptideQuantKeys ( const std::string &  accession,
int  dbIdx,
const ms_peptide_quant_key_vector keys 
) [inherited]

Associate a protein accession with particular peptide quant keys.

A protein-peptide mapping is required for protein ratio calculation purposes. That is, each protein accession whose ratio you need must have at least one peptide quant key associated with it, and the peptide quant key must have a peptide ratio defined.

Values in keys already associated with the protein are skipped.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
keysPeptide quant keys.
void addPeptideRatio ( const ms_peptide_quant_ratio ratio ) [inherited]

Add a new peptide ratio.

If an existing peptide ratio exists with the same query, rank and ratio name as ratio.getQuery(), ratio.getRank() and ratio.getRatioName(), it will be replaced with the new data.

If ratio represents an undefined ("missing") value, the peptide ratio will be removed, as if you had called removePeptideRatio() instead.

Parameters:
ratioPeptide ratio to add.
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.
ms_protein_quant_ratio calculateGeometricMeanRatio ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName,
const std::vector< double > &  sample,
const std::vector< double > &  logSample,
const std::vector< ms_peptide_quant_key > &  activeKeys,
const std::map< ms_peptide_quant_key, int > &  inactiveKeys,
double  normalityPvalue 
) const [protected, inherited]

Given a sample of peptide ratios, calculate the geometric mean and standard deviation.

Parameters:
accessionProtein accession. This is returned verbatim in the returned object and not used otherwise.
dbIdxProtein database index. This is returned verbatim in the returned object and not used otherwise.
ratioNameRatio name. This is returned verbatim in the returned object and not used otherwise.
sampleSample of peptide ratios in increasing numerical order. Sample size must be at least 1.
logSampleLog transform of sample.
normalityPvalueThe p-value that logSample looks normally distributed.
activeKeysPeptide quant keys for which sample values are present.
inactiveKeysPeptide quant keys ignored due to being skipped, excluded or detected as outliers.
Returns:
A protein ratio object encapsulating the calculated ratio, standard deviation and p-value, if relevant.
ms_protein_quant_ratio calculateMedianRatio ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName,
const std::vector< double > &  sample,
const std::vector< double > &  logSample,
const std::vector< ms_peptide_quant_key > &  activeKeys,
const std::map< ms_peptide_quant_key, int > &  inactiveKeys,
double  normalityPvalue 
) const [protected, inherited]

Given a sample of peptide ratios, calculate the median and standard deviation from the median.

See ms_quant_stats::sortedMedian for details of how this is calculated.

Parameters:
accessionProtein accession. This is returned verbatim in the returned object and not used otherwise.
dbIdxProtein database index. This is returned verbatim in the returned object and not used otherwise.
ratioNameRatio name. This is returned verbatim in the returned object and not used otherwise.
sampleSample of peptide ratios in increasing numerical order. Sample size must be at least 1.
logSampleLog transform of sample.
normalityPvalueThe p-value that logSample looks normally distributed.
activeKeysPeptide quant keys for which sample values are present.
inactiveKeysPeptide quant keys ignored due to being skipped, excluded or detected as outliers.
Returns:
A protein ratio object encapsulating the calculated ratio, standard deviation and p-values, if relevant.
ms_protein_quant_ratio calculateWeightedGeometricMeanRatio ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName,
const std::vector< double > &  sample,
const std::vector< double > &  logSample,
const std::vector< double > &  weights,
const std::vector< ms_peptide_quant_key > &  activeKeys,
const std::map< ms_peptide_quant_key, int > &  inactiveKeys,
double  normalityPvalue 
) const [protected, inherited]

Given a sample of peptide ratios, calculate the weighted geometric mean and standard deviation.

Parameters:
accessionProtein accession. This is returned verbatim in the returned object and not used otherwise.
dbIdxProtein database index. This is returned verbatim in the returned object and not used otherwise.
ratioNameRatio name. This is returned verbatim in the returned object and not used otherwise.
sampleSample of peptide ratios in increasing numerical order. Sample size must be at least 1.
logSampleLog transform of sample.
weightsWeighting factors corresponding to the order of sample (and logSample).
normalityPvalueThe p-value that logSample looks normally distributed.
activeKeysPeptide quant keys for which sample values are present.
inactiveKeysPeptide quant keys ignored due to being skipped, excluded or detected as outliers.
Returns:
A protein ratio object encapsulating the calculated ratio, standard deviation and p-value, if relevant.
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 clearPeptideQuantKeys ( const std::string &  accession,
int  dbIdx 
) [inherited]

Clear all peptide quant key associations for a given protein.

After this, getProteinRatio() will return a ratio with state isMissing() when given accession, dbIdx and any ratio name.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
void clearPeptideRatios (  ) [inherited]

Remove all peptide ratios.

This method also removes all q,p aliases of peptide ratios. However, the peptide-protein mapping will not be changed.

void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
int countDistinctPeptides ( const ms_peptide_quant_key_vector activeKeys ) const [virtual, inherited]

Get the number of distinct peptides in the list of active candidates.

The base class ms_quantitation does not have enough infomation about the peptides associated with each ms_peptide_quant_key to determine if they are truly distinct. By default, the number of distinct peptides is the number of elements in activeKeys.

In ms_ms1quantitation and ms_ms2quantitation, peptides are treated as distinctly different only if they have a difference in their peptide string.

This function just calls countDistinctPeptides(const ms_peptide_quant_key_vector &) (which should call the relevant ms_ms1quantitation or ms_ms2quantitation version.

Parameters:
activeKeysPeptide quant keys that are included in the quantitation of a protein.
Returns:
The number of distinct peptides.
int countDistinctPeptides ( const std::vector< ms_peptide_quant_key > &  activeKeys ) const [virtual]

Get the number of distinct peptides in the list of active candidates.

The base class ms_quantitation does not have enough infomation about the peptides associated with each ms_peptide_quant_key to determine if they are truly distinct. By default, the number of distinct peptides is the number of elements in activeKeys.

In ms_ms1quantitation and ms_ms2quantitation, peptides are treated as distinctly different only if they have a difference in their peptide string.

Parameters:
activeKeysPeptide quant keys that are included in the quantitation of a protein.
Returns:
The number of distinct peptides.

Reimplemented from ms_quantitation.

bool findMatch ( matrix_science::ms_peptide_quant_key  matchKey,
matrix_science::ms_ms1quant_match match 
) const

Get a match by its key.

Parameters:
matchKeyThe ms_peptide_quant_key to search for in the results' matches.
matchAn ms_ms1quant_match to receive the found match information.
Returns:
True if a ms_ms1quant_match was found with a key matching matchKey.
bool findPeptideStatus ( int  query,
int  rank,
matrix_science::ms_ms1quant_peptide_status peptideStatus 
) const

Get a peptide status in the quantitation results by the peptide's query and rank.

Parameters:
queryThe query number of the peptide.
rankThe rank of the peptide within the query.
peptideStatusAn ms_ms1quant_peptide_status to receive the found peptide information.
Returns:
True if a peptide matching the search criteria was found in the quantitation data.
bool getAveragePeptideIntensity ( const std::string &  accession,
int  dbIdx,
double *  averageIntensity,
int *  sampleSize,
matrix_science::ms_peptide_quant_key_vector includeKeys,
matrix_science::ms_peptide_quant_key_vector excludeKeys 
) const

Average protocol only: get the intensity of the protein based on its component peptide intensities.

The number of peptide intensities associated with a protein will typically not be the same as then number to be used for the Average protocol, see setAverageNumPeptides(). If there are insufficient peptide intensities then the sample size will still be set (less than the number required). If there are sufficient peptide intensities then the sample size is set to the total number and the average is set to the average of the peptide intensities used (typically not the entire sample).

The average returned is that of the grouped intensities. Each peptide ratio group is summed and then the average is taken of those sums.

See Multiple return values in Perl, Java, Python and C#.

Parameters:
[in]accessionThe protein accession.
[in]dbIdxThe protein database index.
[out]averageIntensityReturns the average of the peptide intenties that are selected.
[out]sampleSizeReturns the number of different peptide groups available; after grouping by selection type.
[out]includeKeysThe peptide quant ratio keys in the peptide groups that were selected; this may be greater than sampleSize.
[out]excludeKeysThe peptide quant ratio keys in the peptide groups that were not selected.
Returns:
True if enough peptides (after grouping) are associated with the sample to calculate the average.
const matrix_science::ms_ms1quant_average_results * getAverageResults (  ) const

Return the results from an 'average' protocol.

Returns:
The results that are only applicable to an 'average' protocol, or null if the quantitation method type is not 'average'.
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.
matrix_science::ms_protein * getHit ( int  index1 ) const

Get a quantitated protein.

Parameters:
index1The quantitated protein's index (1..getNumHits()).
Returns:
The selected quantitated protein.
std::string getLabelFree ( std::string  peptideStr,
std::string  varMods,
std::string  summedMods,
const matrix_science::ms_quant_component comp 
) const

Get the label-free modifications string, combined from the variable mods and the summed mods.

Mods are now encoded into two strings: varMods and summedMods. The use of two strings allows for the site of the label to also contain another mod. Having stripped the labels from the strings, there will only be one mod per site allowing the two strings to be merged into a single label-free mod string

Parameters:
peptideStrThe peptide sequence string.
varModsThe encoded variable modifications.
summedModsThe encoded summed modifications.
compThe component defining all the modifications that are part of the labelling protocol and so should not be included in the label-free list of modifications.
Returns:
label-free string.
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.
ms_ms1quant_match getMatch ( const ms_peptide_quant_key key ) const

Get a match by its key.

Parameters:
keyThe match's key
Returns:
The selected match, or an empty match if not found.
ms_ms1quant_match getMatch ( int  index ) const

Get a match by its index (1..getNumMatches()).

Parameters:
indexThe match's index (1..getNumMatches()).
Returns:
The selected match.
ms_ms1quant_match getMatchForHit ( int  index,
int  hitId,
int  memberNumber 
) const

Get a match for the specified hit protein (index is 1..numberOfMatchesForHit).

Parameters:
indexThe index (1..getNumMatches()) of the required match.
hitIdThe protein hit's identifier.
memberNumberThe number of the hits within its family, or zero if it is not in a family.
Returns:
The match from the list of matches associated with the protein hit, or null if the index or match identifiers are invalid.
int getMinNumPeptides (  ) const [protected, inherited]

Get the minimum number of peptides needed for protein ratio calculation.

Returns:
The minimum number of peptides needed for protein ratio calculation.
int getNumGroups (  ) const

Return the number of match groups

A single match group is all the matches with a unique datasourceId:peptideStr:labelFreeVarMods.

Returns:
the number of match groups
int getNumHits (  ) const

Get the number of quantitated proteins.

Returns:
The number of proteins included in the quantitation result.
int getNumMatches (  ) const

Get the number of peptide matches for all quantitated proteins.

Returns:
The number of matches in the quantitation result.
int getNumMatchesForGroup ( int  groupIndex1 ) const

Return the number of matches for each group.

There will be one match group for each datasourceId:peptideStr:labelFreeVarMods that got a significant match. Each match group will contain one or more matches, one for each charge state that had a signficant PSM.

Parameters:
groupIndex1should be in the range 1..getNumGroups()
Returns:
the number of matches for each group
int getNumMatchesForHit ( int  hitId,
int  memberNumber 
) const

Get the number of matches for the specified hit protein.

Parameters:
hitIdThe protein hit's identifier.
memberNumberThe number of the hits within its family, or zero if it is not in a family.
Returns:
The number of matches associated with the protein hit.
int getNumPeptideStatuses (  ) const

Get the number of peptide statuses.

Returns:
The number of peptides with a status in the quantitation result.
int getNumProteinFamilies (  ) const

Get the number of protein families.

This function can be removed when bug 13150 is fixed

Returns:
the number of protein fmailies that have been quantitated
ms_peptide_quant_key_vector getPeptideQuantKeys ( const std::string &  accession,
int  dbIdx 
) const [inherited]

Look up peptide quant keys associated with a given protein, if any.

In ms_ms2quantitation, the list of peptide quant keys associated with the given protein is immutable, as the keys are derived from q,p values in the Mascot results file. The list does not contain all q,p values, but only those that 1) have component intensities and 2) pass the quality thresholds. Unless the data quality is extremely good, this list will always have fewer elements than the actual peptide matches assigned to the protein hit.

In ms_customquantitation, the peptide-to-protein mapping can be altered with ms_customquantitation::addPeptideQuantKey() and ms_customquantitation::removePeptideQuantKey().

Parameters:
accessionThe protein accession.
dbIdxThe protein database index.
Returns:
A vector of peptide quant keys associated with the protein.
ms_peptide_quant_ratio getPeptideRatio ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) const [virtual, inherited]

Given peptide quant key and ratio name, return the corresponding peptide ratio data.

Often, most peptide matches in a Mascot results file have no ratio data. For example, the peptide match could be non-significant or not quantitable (quality check fails); or with Reporter or Multiplex protocol, the MS/MS spectrum may not contain all component intensities required for ratio calculation.

If hasPeptideRatio(const ms_peptide_quant_key&, std::string) const returns false for the given peptide quant key and ratio name, then the peptide ratio object returned by this method represents an undefined ("missing") value.

Using the Average protocol in ms_customquantitation: If quantitation protocol is Average, peptide ratios are interpreted as raw intensity values. It is usually meaningless to define more than one ratio name in this case.

Parameters:
keyThe peptide quant key of the peptide ratio.
ratioNameThe name of the ratio.
Returns:
The peptide ratio. If hasPeptideRatio() returns false, the field values of the object returned by this method are undefined.

Implements ms_quantitation.

double getPeptideRatioNormalisationBase ( const std::string &  ratioName ) const [inherited]

Get the peptide ratio normalisation base of the given ratio name.

Using the Average protocol in ms_customquantitation: If quantitation protocol is Average, peptide ratio normalisation has no meaning. It is strongly recommended to not set normalisation constants.

Parameters:
ratioNamePeptide ratio name.
Returns:
The current peptide ratio normalisation base, or 1 if it hasn't been set.
matrix_science::ms_ms1quant_peptide_status getPeptideStatus ( int  index ) const

Get a peptide status by its index.

Parameters:
indexThe peptide status's index (1..getNumPeptideStatuses()).
Returns:
The selected peptide status.
const matrix_science::ms_progress_info & getProgressInfo (  ) [inherited]

Get information about the progress of a currently running long operation (e.g. loading from a file).

Returns:
Progress information about the most recent long operation.
matrix_science::ms_protein_quant_ratio getProteinRatio ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName,
const ms_peptide_quant_key_vector includeKeys,
const ms_peptide_quant_key_vector excludeKeys 
) const [virtual]

Overridden from ms_quantitation (via ms_customquantitation) base class.

The list of included and excluded keys are retrieved from the result before being passed to the base class for processing. These will override the lists of keys set by setPeptideRatioExcluded() and setPeptideRatioIncluded() so that the same result can be obtained as was set twhen the results were calculated. To override the lists of peptides from the stored result, call getProteinRatio() on the base class (ms_customquantitation).

Parameters:
accessionThe accession of the protein.
dbIdxThe database the protein is from.
ratioNameThe name of the ratio to calculate.
includeKeysThe keys of peptide matches that are to be included in the protein ratio.
excludeKeysThe keys of peptide matches that are to be excluded in the protein ratio
Returns:
The match from the list of matches associated with the protein hit, or null if the index or match identifiers are invalid.

Reimplemented from ms_customquantitation.

matrix_science::ms_protein_quant_ratio getProteinRatio ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName 
) const [virtual]

Overridden from ms_quantitation (via ms_customquantitation) base class.

See ms_quantitation::getProteinRatio for further details of how the ratio is calculated

The list of included and excluded keys are retrieved from the result before being passed to the base class for processing. These will override the lists of keys set by setPeptideRatioExcluded() and setPeptideRatioIncluded() so that the same result can be obtained as was set twhen the results were calculated. To override the lists of peptides from the stored result, call getProteinRatio() on the base class (ms_customquantitation).

Parameters:
accessionThe accession of the protein.
dbIdxThe database the protein is from.
ratioNameThe name of the ratio to calculate.
Returns:
The match from the list of matches associated with the protein hit, or null if the index or match identifiers are invalid.

Reimplemented from ms_customquantitation.

void getProteinRatioSample ( const std::string &  accession,
int  dbIdx,
const std::string &  ratioName,
const std::vector< ms_peptide_quant_key > &  includeKeys,
const std::vector< ms_peptide_quant_key > &  excludeKeys,
std::vector< double > &  sample,
std::vector< double > &  logSample,
std::vector< double > &  weights,
std::vector< ms_peptide_quant_key > &  activeKeys,
std::map< ms_peptide_quant_key, int > &  inactiveKeys,
double &  normalityPvalue 
) const [protected, inherited]

Find the peptide quant keys associated with the protein, collect their unique peptide ratios, remove outliers (if desired) and return the values as the sample of peptide ratios.

This method uses getSortedFinitePeptideRatioValues() internally to collect the vector of peptide ratios. If there are no peptide quant keys associated with the protein, or if no peptide ratios are associated with with those peptide quant keys, then sample, logSample, activeKeys and inactiveKeys will be empty and normalityPvalue will have an undefined value.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
ratioNameName of the ratio.
includeKeysPrevent these peptide quant keys from being excluded.
excludeKeysPrevent these peptide quant keys from being included.
samplePeptide ratios associated with ratioName and the protein's peptide quant keys, in numerically increasing order.
logSampleLog transform of sample.
weightsWeighting factors corresponding to the order of sample (and logSample).
activeKeysPeptide quant keys corresponding to the order of sample (and logSample).
inactiveKeysPeptide quant keys marked as skipped, excluded or outlier.
normalityPvalueThe p-value that the sample appears to be normally distributed after outlier removal. If less than 0.05, no outliers will have been removed.
std::vector< int > getQuantitationDatasources (  ) const

Get the datasource identifiers of every data source in use for quantitation.

Returns:
A collection of all the datasource identifiers that are in use in all the quantitation matches.
const ms_quant_method & getQuantitationMethod (  ) const [inherited]

Return the current quantitation method.

The current (or effective) quantitation method is the original quantitation method given as argument to the constructor (or loaded from the Mascot results file), with possible later modifications, such as changing normalisation or outlier settings.

For ms_ms2quantitation, you cannot change the protocol settings, component definitions or peptide quality settings. You must create a new object with the new settings instead. You are free to change how protein ratios are calculated and set new normalisation parameters. These changes will be reflected in this method's output value.

For ms_customquantitation, same restrictions apply, although it makes little difference, as the class does not use any protocol settings, component definitions or peptide quality settings.

Returns:
The current quantitation method.
std::string getReadableVarMods ( std::string  varmods )

Get the human-readable format of the given variable modifications.

Parameters:
varmodsThe encoded variable modifications.
Returns:
The human-readable form of the variable modifications.
std::string getReadableVarModsConcise ( std::string  varmods )

Get the concise version of the human-readable format of the given variable modifications.

Parameters:
varmodsThe encoded variable modifications.
Returns:
The concise version of the human-readable form of the variable modifications.
void getSortedFinitePeptideRatioValues ( const std::string &  ratioName,
const std::set< ms_peptide_quant_key > &  keys,
const std::set< ms_peptide_quant_key > &  includeKeys,
const std::set< ms_peptide_quant_key > &  excludeKeys,
std::vector< double > &  values,
std::vector< double > &  weights,
std::vector< ms_peptide_quant_key > &  activeKeys,
std::map< ms_peptide_quant_key, int > &  inactiveKeys 
) const [protected, virtual, inherited]

Given a list of q,p values and ratio name, find the non-infinite peptide ratio values and return them in numerically increasing order.

The method looks up all peptide ratios associated with keys (ignoring duplicates) and returns them in numerically increasing order in values. Infinite and missing ratios are ignored. The vector activeKeys contains active peptide quant keys in the same order as values, and the map inactiveKeys contains peptide quant keys associated with the protein ratio but for indicated reasons not included in ratio calculation.

Parameters:
ratioNameThe name of the peptide ratio.
keysA list of (sorted or unsorted) peptide quant keys for which to look up the ratios.
includeKeysPrevent these peptide quant keys from being excluded.
excludeKeysPrevent these peptide quant keys from being included.
valuesPeptide ratios associated with ratioName and the given peptide quant keys.
weightsWeighting factors of corresponding to the order of values.
activeKeysPeptide quant keys corresponding to the order of values.
inactiveKeysPeptide quant keys skipped or excluded.

Implements ms_quantitation.

const matrix_science::ms_peptidesummary & getSummary (  ) const

The summary is needed to recover the proteins and peptides.

Returns:
The summary that was passed to the constructor.
double getUnnormalisedAveragePeptideRatio ( const std::string &  ratioName,
const std::string &  averageType 
) const [inherited]

Calculate the unnormalised average peptide ratio.

All peptide ratios currently stored in the object are used in calculation. If there are no peptide ratios associated with the ratio name, the method returns 1.0. Negative and infinite values are ignored.

averageType determines the kind of average to compute. Allowed values are described in Type mqm:normaliseType, except that "sum" is not supported. If the kind is "none" or an unsupported value, the method returns 1.0.

Using the Average protocol: If quantitation protocol is average, normalisation has no meaning. It is still possible to get a geometric mean or median of all peptide intensities, but you should not use it for normalisation purposes.

Parameters:
ratioNamePeptide ratio name.
averageTypePeptide ratio normalisation type; one of Type mqm:normaliseType.
Returns:
The average of all peptide ratios currently stored in the object, where averageType controls the kind of average to be calculated. Note that the return value may be 0.0 or very near 0.0.
double getUnnormalisedAveragePeptideRatio ( const std::string &  ratioName,
const std::string &  averageType,
const std::string &  accession,
int  dbIdx 
) const [inherited]

Calculate the unnormalised average of peptide quant keys of a protein accession.

All peptide ratios matching ratioName and associated with the protein accession and database index are chosen for calculation. If there are no such peptide ratios, the method returns 1.0. Negative and infinite values are ignored. You can alter the protein-peptide mapping with addPeptideQuantKey().

averageType determines the kind of average to compute. Allowed values are described in Type mqm:normaliseType, except that "sum" is not supported. If the kind is "none" or an unsupported value, the method returns 1.0.

Using the Average protocol: If quantitation protocol is average, normalisation has no meaning. It is still possible to get a geometric mean or median of all peptide intensities, but you should not use it for normalisation purposes.

Parameters:
ratioNamePeptide ratio name.
averageTypePeptide ratio normalisation type; one of Type mqm:normaliseType.
accessionProtein accession.
dbIdxProtein database index.
Returns:
The average of all selected peptide ratios, where averageType controls the kind of average to be calculated. Note that the return value may be 0.0 or very near 0.0.
double getUnnormalisedAveragePeptideRatio ( const std::string &  ratioName,
const std::string &  averageType,
const ms_peptide_quant_key_vector keys 
) const [inherited]

Calculate the unnormalised average of selected peptide quant keys.

All peptide ratios matching ratioName and whose peptide quant key is in keys are chosen for calculation. If there are no such peptide ratios, the method returns 1.0. Negative and infinite values are ignored.

averageType determines the kind of average to compute. Allowed values are described in Type mqm:normaliseType, except that "sum" is not supported. If the kind is "none" or an unsupported value, the method returns 1.0.

Using the Average protocol: If quantitation protocol is average, normalisation has no meaning. It is still possible to get a geometric mean or median of all peptide intensities, but you should not use it for normalisation purposes.

Parameters:
ratioNamePeptide ratio name.
averageTypePeptide ratio normalisation type; one of Type mqm:normaliseType.
keysPeptide quant keys of peptide ratios to use in calculation.
Returns:
The average of all selected peptide ratios, where averageType controls the kind of average to be calculated. Note that the return value may be 0.0 or very near 0.0.
bool hasPeptideRatio ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) const [virtual, inherited]

Existence check: return true if a peptide ratio with the associated peptide quant key and ratio name exists.

Often, most peptide matches in a Mascot results file have no ratio data. For example, the peptide match could be non-significant or not quantitable (quality check fails); or with Reporter or Multiplex protocol, the MS/MS spectrum may not contain all component intensities required for ratio calculation.

Using the Average protocol in ms_customquantitation: If quantitation protocol is Average, peptide ratios are interpreted as raw intensity values. It is usually meaningless to define more than one ratio name in this case.

Parameters:
keyThe peptide quant key of the peptide ratio.
ratioNameThe name of the ratio.
Returns:
True if the peptide ratio exists; false otherwise.

Implements ms_quantitation.

void initGroupChargeStates ( std::set< int > *  calc_chargestates,
int  iGroup1,
int  minCharge,
int  maxCharge 
)

Add inferred charge states to the group if specified in the method.

Only called if ms_quant_integration::isAllChargeStates() returns true

This extends the mass and time matching to cover contiguous charge states. In other words, if there is a positive match on 2+, the software will look for 1+ and 3+. It will not look for 4+ unless 3+ is found, etc.

Parameters:
[out]calc_chargestateswill contain the list of calculated charges added
[in]iGroup1must be in the range 1..getNumGroups()
[in]minChargewill be the value in the quantitation method: ms_quant_quality::getMinPrecursorCharge
[in]maxChargewill normally be the MDRO processing option: MS->MaxPeakCharge
bool initialiseBaseSettings ( const ms_quant_method qmBase,
const ms_quant_method qmConfig 
) [protected, inherited]

Initialise quantitation method settings from the two method objects.

For any method settings which are not consistent between the passed qmBase and qmConfig, the values from qmConfig will be used.

Parameters:
qmBaseThe base quantitation method as defined on the Mascot server.
qmConfigThe quantitation method to use to calculate quantitation results using.
Returns:
True.
bool isAverageProtocol (  ) const

Return true if the quantitation method uses the Average protocol.

Returns:
True if the quantitation method uses the Average protocol.
bool isPeptideRatioExcluded ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) const [virtual, inherited]

Boolean flag: is the given peptide ratio globally excluded from protein ratio calculation?

(This method is redundant; you could also look up the peptide ratio and use ms_peptide_quant_ratio::isExcluded().)

Parameters:
keyThe peptide quant key of the peptide ratio.
ratioNameThe name of the ratio.
Returns:
True if the peptide ratio should be excluded from protein ratio calculation; false otherwise.

Implements ms_quantitation.

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 if 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.
bool loadCdbFile ( const std::string &  cdbFilename,
const std::string &  cacheFilename,
bool  revalidateQualityThresholds = true 
)

Load the results from a matched pair of files.

Distiller stores these in a project file (*.rov) in streams 3000+n and 8000+n where n is the value in the projectStream attribute of the QuantResult from the Quantitation folder.

If the function fails, any errors are reported in the (base class) ms_errors object.

Parameters:
cdbFilenameThe path and filename of the CDB file containing the quantitation results.
cacheFilenameThe path and filename of the file containing the quantitation cache data.
revalidateQualityThresholdsIf true, the MS/MS peptide match evidence will be retested against the method quality thresholds. If no settings have been changed, this parameter should be set to false as re-evaluating the thresholds can lose user selections. However, if this parameter is incorrectly set to false, then misleading quantitation results may be obtained. [default=true]
Returns:
True if the files were loaded successfully.
bool loadXmlFile ( const std::string &  filename,
const std::string &  xmlSchemaPath 
)

Load quantitation results from an XML file. The schema is loaded from the location known to the.

This uses the ms_mascotresfile attached to the ms_peptidesummary supplied in the constructor. If no schema location was specified to the ms_mascotresfile then loading the XML file will fail.

If the function fails, any errors are reported in the (base class) ms_errors object.

A warning message is added to ms_errors to indicate whenever a protein reference has been changed or removed because the peptide summar results do not match the quantitation results.

If the schema path contains spaces, it should be prefixed with "file:///" and the spaces should be replaced with "%20"

Parameters:
filenameThe path and filename of the file to load.
xmlSchemaPathThe folder where the quantitation XML schema files (XSD) can be found.
Returns:
True if the file was loaded successfully.
bool mergeQuantitationResults ( const std::vector< std::string > &  xmlFilenames,
const MERGE_QUANT_RESULTS_FLAGS  flags,
const std::string &  xmlSchemaPath = "",
const matrix_science::ms_quant_method originalMethod = 0 
)

Merges the quantitation results loaded from xml result files.

This helper method merges the passed xml result files into the current object.

To use it, create a new ms_ms1quantitation::ms_ms1quantitation() object, passing in the ms_peptidesummary object for the merged search results and the quantitation method for the new merged results.

If you have changed the quantitation quality settings, you should pass in a pointer to the original quantitation settings. This method will then compare between the new and original settings. If the changed settings cause a change which cannot be handled within the ms_ms1quantitation class, then error details will be set and the method will return false. For example, if you enabled mass-time-matching when the original dataset has this setting disabled then additional matches would need quantification carrying out from within Mascot Distiller.

Parameters:
xmlFilenamesVector containing the paths and filenames of the Mascot Distiller quantitation result xml files to merge.
xmlSchemaPathPath to the directory containing the Distiller quantitation results xml schema file.
flagsis one or more ms_ms1quantitation::MERGE_QUANT_RESULTS_FLAGS bitwise ORed together
originalMethodOptional pointer to the original quantitation method. Set this only if the passed method is different.
Returns:
true if successful. If false is returned, call getLastError() to see the error that was encountered.
bool mergeQuantitationResults ( const std::vector< std::string > &  cdbFilenames,
const std::vector< std::string > &  cacheFilenames,
const MERGE_QUANT_RESULTS_FLAGS  flags,
const matrix_science::ms_quant_method originalMethod = 0 
)

Merges the quantitation results from matched pairs of cdb files.

This method merges the passed pairs of cdb files into the current object.

To use it, create a new ms_ms1quantitation::ms_ms1quantitation() object, passing in the ms_peptidesummary object for the merged search results and the quantitation method for the new merged results.

If you have changed the quantitation quality settings, you should pass in a pointer to the original quantitation settings. This method will then compare between the new and original settings. If the changed settings cause a change which cannot be handled within the ms_ms1quantitation class, then error details will be set and the method will return false. For example, if you enabled mass-time-matching when the original dataset has this setting disabled then additional matches would need quantification carrying out from within Mascot Distiller.

Parameters:
cdbFilenamesVector containing the paths and filenames of the Mascot Distiller quantitation results cdb files to merge.
cacheFilenamesVector containing the paths and filenames of the Mascot Distiller quantitation cache cdb files to merge.
flagsis one or more ms_ms1quantitation::MERGE_QUANT_RESULTS_FLAGS bitwise ORed together
originalMethodOptional pointer to the original quantitation method. Set this only if the passed method is different.
Returns:
true if successful. If false is returned, call getLastError() to see the error that was encountered.
matrix_science::ms_ms1quantitation * openQuantitationCdbResults ( const matrix_science::ms_peptidesummary summary,
const matrix_science::ms_quant_method method,
const std::string &  cdbFilename,
const std::string &  cacheFilename,
const matrix_science::ms_quant_method originalMethod = 0 
) [static]

Opens and loads quantitation results from a matched pair of cdb files.

This helper method creates, loads and returns an ms_ms1quantitation object for a pair of matched cdb files. If you have changed the quantitation quality settings, you should pass in a pointer to the original quantitation settings. This method will then compare between the new and original settings. If the changed settings cause a change which cannot be handled within the ms_ms1quantitation class, then the error details will be set on the returned ms_ms1quantitation object - For example, if you enabled mass-time-matching when the original dataset has this setting disabled then additional matches would need quantification carrying out from within Mascot Distiller. Use the isValid() method of ms_ms1quantitation to check if the returned quantitation results object is valid.

Note: In unmanaged languages such as C++, this method returns a pointer to a new ms_ms1quantitation method. It is the responsibility of the calling code to delete this when the ms_ms1quantitation object has been finished with.

Parameters:
summaryThe Mascot result peptide summary the quantitation results apply to.
methodThe quantitation settings to generate the report using.
cdbFilenameThe path and filename of the Mascot Distiller quantitation results cdb file to open.
cacheFilenameThe path and filename of the Mascot Distiller quantitation cache file.
originalMethodOptional pointer to the original quantitation method. Set this only if the passed method is different.
Returns:
The calculated ms_ms1quantitation results. If errors were encountered, they will be set to the returned object. Check the value of isValid() and getLastError() to see if an error was encountered.
matrix_science::ms_ms1quantitation * openQuantitationXmlResults ( const matrix_science::ms_peptidesummary summary,
const matrix_science::ms_quant_method method,
const std::string &  filename,
const std::string &  xmlSchemaPath = "",
const matrix_science::ms_quant_method originalMethod = 0 
) [static]

Opens and loads quantitation results from an xml result file.

This helper method creates, loads and returns an ms_ms1quantitation object from an exported Mascot Distiller quantitation results xml file. If you have changed the quantitation quality settings, you should pass in a pointer to the original quantitation settings. This method will then compare between the new and original settings. If the changed settings cause a change which cannot be handled within the ms_ms1quantitation class, then the error details will be set on the returned ms_ms1quantitation object - For example, if you enabled mass-time-matching when the original dataset has this setting disabled then additional matches would need quantification carrying out from within Mascot Distiller. Use the isValid() method of ms_ms1quantitation to check if the returned quantitation results object is valid.

Note: In unmanaged languages such as C++, this method returns a pointer to a new ms_ms1quantitation method. It is the responsibility of the calling code to delete this when the ms_ms1quantitation object has been finished with.

Parameters:
summaryThe Mascot result peptide summary the quantitation results apply to.
methodThe quantitation settings to generate the report using.
filenameThe path and filename of the Mascot Distiller quantitation results xml file to open.
xmlSchemaPathThe path to the directory containing the Distiller quantitation results xml schema file.
originalMethodOptional pointer to the original quantitation method. Set this only if the passed method is different.
Returns:
The calculated ms_ms1quantitation results. If errors were encountered, they will be set to the returned object. Check the value of isValid() and getLastError() to see if an error was encountered.
bool readResultCounters ( const std::string &  cdbFile,
int &  numMatches,
int &  numHits,
int &  numPepGrp,
int &  numPeptideComponents 
) [static]

Reads and returns the Counters information from the cdb result file.

This helper method loads the Counters values from the passed cdbfile and sets the return values. See Multiple return values in Perl, Java, Python and C#.

Parameters:
cdbFileThe cdbfile to load the counters from
[out]numMatchesThe number of peptide quant matches is set to this parameter
[out]numHitsThe number of protein hits quantified
[out]numPepGrpThe number of peptide groups
[out]numPeptideComponentsThe number of peptide components
Returns:
True if the counters have been read and the return values set, false if not
void removeMatch ( matrix_science::ms_peptide_quant_key  matchKey )

Remove the specified peptide match from the results.

Parameters:
matchKeyThe identifier of the peptide quantitation match
void removePeptideQuantKey ( const std::string &  accession,
int  dbIdx,
const ms_peptide_quant_key key 
) [inherited]

Deassociate a peptide quant key from the given protein.

Parameters:
accessionProtein accession.
dbIdxProtein database index.
keyPeptide quant key.
void removePeptideRatio ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) [inherited]

Remove a particular peptide ratio.

However, the protein-peptide mapping related to the peptide quant key will not be changed.

Parameters:
keyPeptide quant key.
ratioNameRatio name.
void removePeptideRatioNormalisationBase ( const std::string &  ratioName ) [inherited]

Reset the peptide ratio normalisation base of the given ratio name.

Resetting means the report ratio normalisation constant is set to 1.0. This has the same effect as calling setPeptideRatioNormalisationBase() with b = 1.

In ms_ms2quantitation, resetting a normalisation constant is possible even if normalisation settings have been configured with setQuantNormalisation() and normalisePeptideRatios() has been called. It is generally not a good idea to reset normalisation bases, because it will lead to inconsistent peptide ratios.

Parameters:
ratioNameRatio name whose normalisation base is to be reset.
void removePeptideRatioNormalisationBases (  ) [inherited]

Reset all peptide ratio normalisation bases.

Resetting all report ratio normalisation bases means all peptide and protein ratios become unnormalised.

In ms_ms2quantitation, resetting a normalisation constant is possible even if normalisation settings have been configured with setQuantNormalisation() and normalisePeptideRatios() has been called. It is generally not a good idea to reset normalisation bases, because it will lead to inconsistent peptide ratios.

bool saveCdbFile ( const std::string &  cdbFilename,
const std::string &  cacheFilename,
bool  createEmptyMissingComponents = false 
)

Save the results to a matched pair of files.

Distiller stores these in an MDRO project file (*.rov) in streams 3000+n and 8000+n where n is the value in the projectStream attribute of the QuantResult from the Quantitation folder.

If cdbFilename already exists and can be opened as a CDB file, then this function just returns true immediately.

Parameters:
cdbFilenameThe path and filename of the CDB file to receive the quantitation results.
cacheFilenameThe path and filename of the CDB file to receive the quantitation cache data.
createEmptyMissingComponentsshould be set to true for cases like the replicate protocol where an individual raw file does not have the other components. The CDB file expects a component for each item component specified in the method.
Returns:
True if the file was saved successfully.
bool saveXmlFile ( const std::string &  xmlFilename,
bool  completeReport 
)

Save the quantitation results to an XML file.

The schema for the XML file is: distiller_quantitation_2.xsd

Some ratios calculations will results in an 'invalid' number, for example, because of no data (NaN) or division by zero. In these cases, the XML will have additional element(s), with ms_ms1quant_match_ratio::ratioStatusCode to describe them.

To simplify code for consumers of the xml, the 'value' saved in the xml is converted to a finite value accordingly:

IEEE 754-2008 Value Standard XML representation Value output to XML ratioStatusCode(s)
qNaN or sNaN "NaN" "0" "RatioUndefined"
+infinity "INF" "999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056.000000" (this value is the text representation of 1e99) "InfiniteRatio"
-infinity; "-INF" "999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056.000000" (this value is the text representation of 1e99) "InfiniteRatio" and "NegativeRatio"
Parameters:
xmlFilenameThe path and filename of the file to save.
completeReportTrue if a complete report of all data is to be generated, or false to generate concise report data.
Returns:
True if the file was saved successfully.
void setAverageNumPeptides ( unsigned int  num = 3 )

Average protocol only: set the number of most intense peptide groups to use.

This method only works when quantitation method protocol is Average. If protocol is not Average, calling the method has no effect.

In the Average protocol, protein intensities are calculated as the sum of the "top \a num" peptide intensities assigned to the protein hit. num is conventionally 3.

Parameters:
numThe number of most intense peptide intensities to use in calculating protein intensities in the Average protocol. If 0, the value is reset to 3.
void setAverageReferenceProtein ( const char *  accession,
int  dbIdx,
bool  isReferenceUserSelected 
)

Average protocol only: select a reference protein accession and database.

This method only works when quantitation method protocol is Average. If protocol is not Average, calling the method has no effect.

In the Average protocol, protein ratios are relative to a specified reference protein, identified by its accession and dbIdx The reference protein should be one that has peptide ratios (intensities) associated with it. If it does not, getProteinRatio() will simply return raw intensity values.

If the quantitation method doesn't specify an accession, then the calling software should find the first protein hit, pass the accession and dbIdx of that hit and pass isReferenceUserSelected as false.

Calling this method does not modify the current quantitation method.

Parameters:
accessionAccession of the reference protein. If null or an empty string, the warning matrix_science::ms_errs::ERR_MSP_QUANT_EMPTY_REF_ACCESSION will be set, and the function does nothing.
dbIdxThe database the protein is from. Must be correct! If the search results don't contain a protein matching the passed accession and dbIdx, then the warning matrix_science::ms_errs::ERR_MSP_QUANT_ACCESSION_NOT_FOUND is set
isReferenceUserSelectedshould be set to true if the reference accession was specified in the method.
void setAverageSelection ( const char *  mode )

Average protocol only: set the method of grouping peptide ratios.

This method only works when quantitation method protocol is Average. If protocol is not Average, calling the method has no effect.

In the Average protocol, protein intensities are calculated as the sum of the "top" peptide intensities assigned to the protein hit. If peptides are _identical_ then they all included but only count as one peptide for the purpose of determining the average. The selection mode determines how the peptides are compared to see if they should be treated as identical or not.

Whether to require the peptides to be used to be unique sequences (unique_sequence), or to accept different modification states of same sequence (unique_mr), or even accept peptides with same sequence and modifications in different charge states (unique_mz).

Parameters:
modeThe way in which peptides are matched when selecting peptide intensities for the protein.
void setMinNumPeptides ( int  value ) [inherited]

Set the minimum number of peptides needed for protein ratio calculation.

Changing the minimum number of peptides changes the current quantitation method. It does not alter the original quantitation method object.

Using the Average protocol in ms_customquantitation: The Average protocol has two settings for minimum number of peptides. This setting defines how many peptide intensities are needed for a protein before its ratio can be calculated. It is usually meaningless to choose a value other than 1. Use ms_customquantitation::setAverageNumPeptides() to define how many intensities should be used in protein ratio calculation.

Parameters:
valueThe minimum number of peptide ratios (the sample size) a protein must have for protein ratio calculation purposes. Values less than 1 are interpreted as 1.
void setPeptideRatioExcluded ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) [virtual, inherited]

Globally exclude a particular peptide ratio from protein ratio calculation.

All peptide matches associated with a protein ratio are used in calculating that protein's ratio, assuming the peptide ratio passes outlier testing (if used). This may not be desirable in some cases; for example, visual inspection could indicate the peptide match is incorrect. You can use setPeptideRatioExcluded() and setPeptideRatioIncluded() to globally exclude or include individual peptide ratios.

Parameters:
keyThe peptide quant key of the peptide ratio.
ratioNameThe name of the ratio.

Implements ms_quantitation.

void setPeptideRatioIncluded ( const ms_peptide_quant_key key,
const std::string &  ratioName 
) [virtual, inherited]

Globally include a particular peptide ratio in protein ratio calculation.

All peptide matches associated with a protein ratio are used in calculating that protein's ratio, assuming the peptide ratio passes outlier testing (if used). This may not be desirable in some cases; for example, visual inspection could indicate the peptide match is incorrect. You can use setPeptideRatioExcluded() and setPeptideRatioIncluded() to globally exclude or include individual peptide ratios.

Parameters:
keyThe peptide quant key of the peptide ratio.
ratioNameThe name of the ratio.

Implements ms_quantitation.

void setPeptideRatioNormalisationBase ( const std::string &  ratioName,
double  b 
) [inherited]

Set the peptide ratio normalisation base of the given ratio name.

Setting peptide ratio normalisation to a particular value means all peptide ratios with ratioName will be divided by b before they are returned by getPeptideRatio(). That is, the underlying peptide ratios remain unaffected, which means this method will always return immediately without computing anything.

In ms_ms2quantitation, normalisation constants can most easily be calculated with ms_ms2quantitation::normalisePeptideRatios(), if normalisation is enabled and configured in the quantitation method. You are free to override this, but keeping track of who calculated which constant is up to you.

It is not a good idea to define both peptide ratio normalisation and component intensity normalisation at the same time. In fact, you can only configure one or the other using setQuantNormalisation(), and neither normalisePeptideRatios() nor normaliseIntensities() will step on each other's toes.

It is possible, but not recommended, to manually set normalisation bases for both peptide ratios and component intensities. The resulting peptide ratios are most likely meaningless.

In ms_customquantitation, you can use ms_customquantitation::getUnnormalisedAveragePeptideRatio() to calculate the mean or median of peptide ratios currently stored in the class, for normalisation purposes.

You can always set b to 1 to disable peptide ratio ratioName normalisation.

Using the Average protocol in ms_customquantitation: If quantitation protocol is Average, peptide ratio normalisation has no meaning. It is strongly recommended to not set normalisation constants.

Parameters:
ratioNamePeptide ratio name to normalise.
bNew normalisation base. If it is zero, the old base will be kept. If this is the first time the base is set, a value of 0 means it is set to 1.0.
void setProteinRatioType ( const char *  value ) [virtual, inherited]

Set the protein ratio type.

Changing the protein ratio type changes the current quantitation method. It does not alter the original quantitation method object.

ms_ms2quantitation supports "median", "average" and "weighted", and ms_customquantitation supports "median" and "average. If the ratio type is not implemented, it is set to "median".

Using the Average protocol in ms_customquantitation: If quantitation protocol is Average, the only supported protein ratio type is "average". Setting it to anything else will result in an error. You should inspect isValid() and use clearAllErrors() should you accidentally do so.

Parameters:
valueProtein ratio type (e.g. median, average, weighted). Accepted values are defined in the quantitation XML schema.

Implements ms_quantitation.

void setQuantOutliers ( const ms_quant_outliers qo ) [virtual, inherited]

Set new peptide ratio outlier settings.

Peptide ratio outlier detection can be configured in several ways. Please consult the quantitation configuration help page for details.

Changing outlier settings changes the current quantitation method. It does not alter the original quantitation method object.

Using the Average protocol in ms_customquantitation: It is an error to define outlier removal if quantitation protocol is Average. You will need to inspect isValid() and clear the error with clearAllErrors() should you accidentally do so.

Parameters:
qoAn outlier configuration object. If this is NULL, outlier detection will be disabled (equivalent to "none").

Implements ms_quantitation.


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

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:35