The result of quantitation calculations applied to peptide summary. More...
#include <ms_ms1quantitation.hpp>
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, const int thisSubProjectId=matrix_science::ms_quant_file_index::file_index_value_not_set) |
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 ms_peptide_quant_key_vector &activeKeys) const |
Bring across base class member that we don't overload, otherwise it will be hidden. | |
virtual int | countDistinctPeptides (const std::vector< ms_peptide_quant_key > &activeKeys) const |
Bring across base class member that we don't overload, otherwise it will be hidden. | |
virtual int | countDistinctPeptides (const std::vector< ms_peptide_quant_key > &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_results * | getAverageResults () const |
Return the results from an 'average' protocol. | |
const ms_errs * | getErrorHandler () const |
Retrive the error object using this function to get access to all errors and error parameters. | |
ms_protein * | getHit (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 (const ms_peptide_quant_key &key) const |
Get a match by its key. | |
ms_ms1quant_match | getMatch (int index) const |
Get a match by its index (1..getNumMatches()). | |
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_peptidesummary & | getPeptideSummary () const |
The summary is needed to recover the proteins and peptides. | |
const ms_progress_info & | getProgressInfo () |
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_method & | getQuantitationMethod () 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_peptidesummary & | getSummary () const |
The summary is needed to recover the proteins and peptides. | |
matrix_science::ms_ms1quant_time_align & | getTimeAlignmentData () |
Returns the time alignment data for label free quantitation. | |
const matrix_science::ms_ms1quant_time_align & | getTimeAlignmentData () const |
Returns the time alignment data for label free quantitation. | |
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 > &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. | |
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. | |
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, bool saveTimeAlignmentData=false) |
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. | |
void | setTimeAlignmentData (matrix_science::ms_ms1quant_time_align &alignmentData) |
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. | |
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; } } } }
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. |
enum MS1QUANT_BUGFIX_NUM |
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(),
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().
summary | Mascot 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_mascotresfilebase constructor or use ms_mascotresfilebase::setXMLschemaFilePath(). |
method | Quantitation 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. |
matrix_science::ms_ms1quant_match addMatchInferred | ( | const ms_ms1quant_match & | siblingMatch, |
int | newCharge | ||
) |
Add an inferred peptide match to the quantitation results.
siblingMatch | The identified match the inferred match is derived from |
newCharge | The charge state of the inferred match |
void addMatchPeptide | ( | matrix_science::ms_protein * | hit, |
matrix_science::ms_peptide * | peptide, | ||
const matrix_science::ms_quant_component & | component, | ||
const std::string & | matchBelongsToComponent, | ||
const int | thisSubProjectId = matrix_science::ms_quant_file_index::file_index_value_not_set |
||
) |
Add a quantitation peptide match to a protein hit.
For Replicate, this is only called from the subproject quantitation, so only add a 'file_index' for thisSubProjectId, and therefore only use perFileIndex_[0]
hit | The protein hit the peptide quantitation match is associated with |
peptide | The peptide |
component | The quantitation component the match is associated with |
matchBelongsToComponent | is 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 |
thisSubProjectId | defaults to matrix_science::ms_quant_file_index::file_index_value_not_set and is used to set the file_index in the ms_ms1quant_match_component |
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.
Adds the status of a peptide match assigned to the specified protein to the quantitation results
peptide | The peptide associated with the quantitation match |
status | The peptide quantitation match status |
hit | The protein hit the peptide match is associated with. Do not pass this parameter for unassigned peptide matches |
|
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.
accession | Protein accession. |
dbIdx | Protein database index. |
key | Peptide quant key. |
|
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.
accession | Protein accession. |
dbIdx | Protein database index. |
keys | Peptide quant 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.
accession | Protein accession. |
dbIdx | Protein database index. |
keys | Peptide quant keys. |
|
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.
ratio | Peptide ratio to add. |
|
inherited |
Copies all errors from another instance and appends them at the end of own list.
src | The object to copy the errors across from. See Maintaining object references: two rules of thumb. |
|
protectedinherited |
Given a sample of peptide ratios, calculate the geometric mean and standard deviation.
accession | Protein accession. This is returned verbatim in the returned object and not used otherwise. |
dbIdx | Protein database index. This is returned verbatim in the returned object and not used otherwise. |
ratioName | Ratio name. This is returned verbatim in the returned object and not used otherwise. |
sample | Sample of peptide ratios in increasing numerical order. Sample size must be at least 1. |
logSample | Log transform of sample. |
normalityPvalue | The p-value that logSample looks normally distributed. |
activeKeys | Peptide quant keys for which sample values are present. |
inactiveKeys | Peptide quant keys ignored due to being skipped, excluded or detected as outliers. |
|
protectedinherited |
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.
accession | Protein accession. This is returned verbatim in the returned object and not used otherwise. |
dbIdx | Protein database index. This is returned verbatim in the returned object and not used otherwise. |
ratioName | Ratio name. This is returned verbatim in the returned object and not used otherwise. |
sample | Sample of peptide ratios in increasing numerical order. Sample size must be at least 1. |
logSample | Log transform of sample. |
normalityPvalue | The p-value that logSample looks normally distributed. |
activeKeys | Peptide quant keys for which sample values are present. |
inactiveKeys | Peptide quant keys ignored due to being skipped, excluded or detected as outliers. |
|
protectedinherited |
Given a sample of peptide ratios, calculate the weighted geometric mean and standard deviation.
accession | Protein accession. This is returned verbatim in the returned object and not used otherwise. |
dbIdx | Protein database index. This is returned verbatim in the returned object and not used otherwise. |
ratioName | Ratio name. This is returned verbatim in the returned object and not used otherwise. |
sample | Sample of peptide ratios in increasing numerical order. Sample size must be at least 1. |
logSample | Log transform of sample. |
weights | Weighting factors corresponding to the order of sample (and logSample). |
normalityPvalue | The p-value that logSample looks normally distributed. |
activeKeys | Peptide quant keys for which sample values are present. |
inactiveKeys | Peptide quant keys ignored due to being skipped, excluded or detected as outliers. |
|
inherited |
Remove all errors from the current list of errors.
The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.
All messages are accumulated into a list in this object, until clearAllErrors() is called.
See Error Handling.
|
inherited |
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.
accession | Protein accession. |
dbIdx | Protein database index. |
|
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.
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
|
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.
activeKeys | Peptide quant keys that are included in the quantitation of a protein. |
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.
matchKey | The ms_peptide_quant_key to search for in the results' matches. |
match | An ms_ms1quant_match to receive the found match information. |
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.
query | The query number of the peptide. |
rank | The rank of the peptide within the query. |
peptideStatus | An ms_ms1quant_peptide_status to receive the found peptide information. |
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#.
[in] | accession | The protein accession. |
[in] | dbIdx | The protein database index. |
[out] | averageIntensity | Returns the average of the peptide intenties that are selected. |
[out] | sampleSize | Returns the number of different peptide groups available; after grouping by selection type. |
[out] | includeKeys | The peptide quant ratio keys in the peptide groups that were selected; this may be greater than sampleSize. |
[out] | excludeKeys | The peptide quant ratio keys in the peptide groups that were not selected. |
const matrix_science::ms_ms1quant_average_results * getAverageResults | ( | ) | const |
Return the results from an 'average' protocol.
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
See Error Handling.
matrix_science::ms_protein * getHit | ( | int | index1 | ) | const |
Get a quantitated protein.
index1 | The quantitated protein's index (1..getNumHits()). |
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
peptideStr | The peptide sequence string. |
varMods | The encoded variable modifications. |
summedMods | The encoded summed modifications. |
comp | The 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. |
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
ms_ms1quant_match getMatch | ( | const ms_peptide_quant_key & | key | ) | const |
Get a match by its key.
key | The match's key |
ms_ms1quant_match getMatch | ( | int | index | ) | const |
Get a match by its index (1..getNumMatches()).
index | The match's index (1..getNumMatches()). |
ms_ms1quant_match getMatchForHit | ( | int | index, |
int | hitId, | ||
int | memberNumber | ||
) | const |
Get a match for the specified hit protein (index is 1..numberOfMatchesForHit).
index | The index (1..getNumMatches()) of the required match. |
hitId | The protein hit's identifier. |
memberNumber | The number of the hits within its family, or zero if it is not in a family. |
|
protectedinherited |
Get 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
.
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.
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.
groupIndex1 | should be in the range 1..getNumGroups() |
int getNumMatchesForHit | ( | int | hitId, |
int | memberNumber | ||
) | const |
Get the number of matches for the specified hit protein.
hitId | The protein hit's identifier. |
memberNumber | The number of the hits within its family, or zero if it is not in a family. |
int getNumPeptideStatuses | ( | ) | const |
Get the number of peptide statuses.
int getNumProteinFamilies | ( | ) | const |
Get the number of protein families.
This function can be removed when bug 13150 is fixed
|
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().
accession | The protein accession. |
dbIdx | The protein database index. |
|
virtualinherited |
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.
key | The peptide quant key of the peptide ratio. |
ratioName | The name of the ratio. |
Implements ms_quantitation.
|
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.
ratioName | Peptide ratio name. |
matrix_science::ms_ms1quant_peptide_status getPeptideStatus | ( | int | index | ) | const |
Get a peptide status by its index.
index | The peptide status's index (1..getNumPeptideStatuses()). |
const matrix_science::ms_peptidesummary & getPeptideSummary | ( | ) | const |
The summary is needed to recover the proteins and peptides.
|
inherited |
Get information about the progress of a currently running long operation (e.g. loading from a file).
|
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).
accession | The accession of the protein. |
dbIdx | The database the protein is from. |
ratioName | The name of the ratio to calculate. |
Reimplemented from ms_customquantitation.
|
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).
accession | The accession of the protein. |
dbIdx | The database the protein is from. |
ratioName | The name of the ratio to calculate. |
includeKeys | The keys of peptide matches that are to be included in the protein ratio. |
excludeKeys | The keys of peptide matches that are to be excluded in the protein ratio |
Reimplemented from ms_customquantitation.
|
protectedinherited |
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.
accession | Protein accession. |
dbIdx | Protein database index. |
ratioName | Name of the ratio. |
includeKeys | Prevent these peptide quant keys from being excluded. |
excludeKeys | Prevent these peptide quant keys from being included. |
sample | Peptide ratios associated with ratioName and the protein's peptide quant keys, in numerically increasing order. |
logSample | Log transform of sample. |
weights | Weighting factors corresponding to the order of sample (and logSample). |
activeKeys | Peptide quant keys corresponding to the order of sample (and logSample). |
inactiveKeys | Peptide quant keys marked as skipped, excluded or outlier. |
normalityPvalue | The 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.
|
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.
std::string getReadableVarMods | ( | std::string | varmods | ) |
Get the human-readable format of the given variable modifications.
varmods | The encoded variable modifications. |
std::string getReadableVarModsConcise | ( | std::string | varmods | ) |
Get the concise version of the human-readable format of the given variable modifications.
varmods | The encoded variable modifications. |
|
protectedvirtualinherited |
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.
ratioName | The name of the peptide ratio. |
keys | A list of (sorted or unsorted) peptide quant keys for which to look up the ratios. |
includeKeys | Prevent these peptide quant keys from being excluded. |
excludeKeys | Prevent these peptide quant keys from being included. |
values | Peptide ratios associated with ratioName and the given peptide quant keys. |
weights | Weighting factors of corresponding to the order of values. |
activeKeys | Peptide quant keys corresponding to the order of values. |
inactiveKeys | Peptide 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.
matrix_science::ms_ms1quant_time_align & getTimeAlignmentData | ( | ) |
Returns the time alignment data for label free quantitation.
Only available for label free quantitation using the Replicate protocol
For other protocols, calling getStatus() on the return value of this function will return ms_ms1quant_time_align::ST_TA_NO_DATA
const matrix_science::ms_ms1quant_time_align & getTimeAlignmentData | ( | ) | const |
Returns the time alignment data for label free quantitation.
Only available for label free quantitation using the Replicate protocol.
For other protocols, calling getStatus() on the return value of this function will return ms_ms1quant_time_align::ST_TA_NO_DATA
|
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.
ratioName | Peptide ratio name. |
averageType | Peptide ratio normalisation type; one of Type mqm:normaliseType. |
|
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.
ratioName | Peptide ratio name. |
averageType | Peptide ratio normalisation type; one of Type mqm:normaliseType. |
keys | Peptide quant keys of peptide ratios to use in calculation. |
|
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.
ratioName | Peptide ratio name. |
averageType | Peptide ratio normalisation type; one of Type mqm:normaliseType. |
accession | Protein accession. |
dbIdx | Protein database index. |
|
virtualinherited |
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.
key | The peptide quant key of the peptide ratio. |
ratioName | The name of the ratio. |
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.
[out] | calc_chargestates | will contain the list of calculated charges added |
[in] | iGroup1 | must be in the range 1..getNumGroups() |
[in] | minCharge | will be the value in the quantitation method: ms_quant_quality::getMinPrecursorCharge |
[in] | maxCharge | will normally be the MDRO processing option: MS->MaxPeakCharge |
|
protectedinherited |
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.
qmBase | The base quantitation method as defined on the Mascot server. |
qmConfig | The quantitation method to use to calculate quantitation results using. |
bool isAverageProtocol | ( | ) | const |
Return true if the quantitation method uses the Average protocol.
|
virtualinherited |
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().)
key | The peptide quant key of the peptide ratio. |
ratioName | The name of the ratio. |
Implements ms_quantitation.
|
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.
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.
cdbFilename | The path and filename of the CDB file containing the quantitation results. |
cacheFilename | The path and filename of the file containing the quantitation cache data. |
revalidateQualityThresholds | If 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] |
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_mascotresfilebase attached to the ms_peptidesummary supplied in the constructor. If no schema location was specified to the ms_mascotresfilebase 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"
filename | The path and filename of the file to load. |
xmlSchemaPath | The folder where the quantitation XML schema files (XSD) can be found. |
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.
cdbFilenames | Vector containing the paths and filenames of the Mascot Distiller quantitation results cdb files to merge. |
cacheFilenames | Vector containing the paths and filenames of the Mascot Distiller quantitation cache cdb files to merge. |
flags | is one or more ms_ms1quantitation::MERGE_QUANT_RESULTS_FLAGS bitwise ORed together |
originalMethod | Optional pointer to the original quantitation method. Set this only if the passed method is different. |
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.
xmlFilenames | Vector containing the paths and filenames of the Mascot Distiller quantitation result xml files to merge. |
xmlSchemaPath | Path to the directory containing the Distiller quantitation results xml schema file. |
flags | is one or more ms_ms1quantitation::MERGE_QUANT_RESULTS_FLAGS bitwise ORed together |
originalMethod | Optional pointer to the original quantitation method. Set this only if the passed method is different. |
|
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.
summary | The Mascot result peptide summary the quantitation results apply to. |
method | The quantitation settings to generate the report using. |
cdbFilename | The path and filename of the Mascot Distiller quantitation results cdb file to open. |
cacheFilename | The path and filename of the Mascot Distiller quantitation cache file. |
originalMethod | Optional pointer to the original quantitation method. Set this only if the passed method is different. |
|
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.
summary | The Mascot result peptide summary the quantitation results apply to. |
method | The quantitation settings to generate the report using. |
filename | The path and filename of the Mascot Distiller quantitation results xml file to open. |
xmlSchemaPath | The path to the directory containing the Distiller quantitation results xml schema file. |
originalMethod | Optional pointer to the original quantitation method. Set this only if the passed method is different. |
|
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#.
cdbFile | The cdbfile to load the counters from | |
[out] | numMatches | The number of peptide quant matches is set to this parameter |
[out] | numHits | The number of protein hits quantified |
[out] | numPepGrp | The number of peptide groups |
[out] | numPeptideComponents | The number of peptide components |
void removeMatch | ( | matrix_science::ms_peptide_quant_key | matchKey | ) |
Remove the specified peptide match from the results.
matchKey | The identifier of the peptide quantitation match |
|
inherited |
Deassociate a peptide quant key from the given protein.
accession | Protein accession. |
dbIdx | Protein database index. |
key | Peptide quant key. |
|
inherited |
Remove a particular peptide ratio.
However, the protein-peptide mapping related to the peptide quant key will not be changed.
key | Peptide quant key. |
ratioName | Ratio name. |
|
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.
ratioName | Ratio name whose normalisation base is to be reset. |
|
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.
cdbFilename | The path and filename of the CDB file to receive the quantitation results. |
cacheFilename | The path and filename of the CDB file to receive the quantitation cache data. |
createEmptyMissingComponents | should 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. |
bool saveXmlFile | ( | const std::string & | xmlFilename, |
bool | completeReport, | ||
bool | saveTimeAlignmentData = false |
||
) |
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" |
xmlFilename | The path and filename of the file to save. |
completeReport | True if a complete report of all data is to be generated, or false to generate concise report data. |
saveTimeAlignmentData | should be set to true to save the data from the matrix_science::ms_ms1quant_time_align object. The data saved in the xml will be identical to that as saved by ms_ms1quant_time_align::saveXmlFile but within a <timeAlignment> element and using a "ta" namespace |
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.
num | The 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.
accession | Accession 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. |
dbIdx | The 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 |
isReferenceUserSelected | should 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).
mode | The way in which peptides are matched when selecting peptide intensities for the protein. |
|
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.
value | The 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. |
|
virtualinherited |
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.
key | The peptide quant key of the peptide ratio. |
ratioName | The name of the ratio. |
Implements ms_quantitation.
|
virtualinherited |
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.
key | The peptide quant key of the peptide ratio. |
ratioName | The name of the ratio. |
Implements ms_quantitation.
|
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.
ratioName | Peptide ratio name to normalise. |
b | New 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. |
|
virtualinherited |
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". <strong>Using the Average protocol in ms_customquantitation</strong>: 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.
value | Protein ratio type (e.g. median, average, weighted). Accepted values are defined in the quantitation XML schema. |
Implements ms_quantitation.
|
virtualinherited |
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.
qo | An outlier configuration object. If this is NULL , outlier detection will be disabled (equivalent to "none"). |
Implements ms_quantitation.
void setTimeAlignmentData | ( | matrix_science::ms_ms1quant_time_align & | alignmentData | ) |
Only available for label free quantitation using the Replicate protocol
alignmentData | is the new time alignment data |