Class for holding a list of ms_fragment objects. More...
#include <ms_fragmentvector.hpp>
Public Types | |
enum | MATCH_PEAKS { MATCH_MOST_INTENSE_PEAK = 0x0000 , MATCH_CLOSEST_PEAK = 0x0001 } |
Flags for matching experimental peaks to calculated peaks. More... | |
enum | TOLERANCE_UNIT { TOLERANCE_DALTON , TOLERANCE_MMU , TOLERANCE_PERCENT , TOLERANCE_PPM } |
Flags for tolerance units used for matching peaks. More... | |
Public Member Functions | |
ms_fragmentvector () | |
Default constructor. | |
ms_fragmentvector (const ms_fragmentvector &src) | |
Copying constructor. | |
virtual | ~ms_fragmentvector () |
Destructor. | |
bool | addExperimentalData (const ms_mascotresfilebase *resfile, const int query, const int flags=MATCH_MOST_INTENSE_PEAK, const int peaksUsedFromIons1=-1, const int peaksUsedFromIons2=-1, const int peaksUsedFromIons3=-1) |
Find matches to peaks lists from a Mascot results file. | |
bool | addExperimentalData (const peaklist_t &peakList, const double tolerance, const std::string &toleranceUnits, const bool updateMatchList=true) |
Find matches to peak list. | |
bool | addExperimentalData (const std::string &peakList, const int numPeaks, const double tolerance, const std::string &toleranceUnits, const bool updateMatchList=true) |
Find matches to peak list. | |
void | appendFragment (const ms_fragment *item) |
Adds a new fragment to the end of the vector. | |
void | clearFragments () |
Deletes all fragments from the vector. | |
void | copyFrom (const ms_fragmentvector *right) |
Copies all content from another instance. | |
const ms_fragment * | getFragmentByNumber (const unsigned int numFrag) const |
Return a fragment object by its number. | |
int | getNumberOfFragments () const |
Returns a number of fragments currently held in the vector. | |
frag_vector * | getVector () |
Return a pointer to the STL vector of ms_fragment objects. | |
const frag_vector * | getVector () const |
Return a const pointer to the STL vector of ms_fragment objects. | |
ms_fragmentvector & | operator= (const ms_fragmentvector &right) |
C++ style assignment operator. | |
Static Public Member Functions | |
static void | getMassesWithinTolerance (const double mass, const double toleranceValue, const TOLERANCE_UNIT toleranceUnit, double &minMass, double &maxMass) |
Get minimum and maximum masses within tolerance for a specified mass. | |
Class for holding a list of ms_fragment objects.
This class is necessary when using Mascot Parser from programming language other than C++. It is used when calling ms_aahelper::calcFragments().
C++ users will generally just want to use a std::vector<ms_fragment> as it is easier.
enum MATCH_PEAKS |
Flags for matching experimental peaks to calculated peaks.
Used as flags for addExperimentalData() when passing a ms_mascotresfilebase object.
See Using enumerated values and static const ints in Perl, Java, Python and C#.
Enumerator | |
---|---|
MATCH_MOST_INTENSE_PEAK | Match the most intense peak in the region. |
MATCH_CLOSEST_PEAK | Match the peak with the closest m/z value (not currently supported). |
enum TOLERANCE_UNIT |
Flags for tolerance units used for matching peaks.
Used as flags for getMassesWithinTolerance()
See Using enumerated values and static const ints in Perl, Java, Python and C#.
Default constructor.
Create a default empty list of fragments.
ms_fragmentvector | ( | const ms_fragmentvector & | src | ) |
Copying constructor.
src | is the original list to base the new list on. |
|
virtual |
Destructor.
No need to call this directly. Frees the list of fragments.
bool addExperimentalData | ( | const ms_mascotresfilebase * | resfile, |
const int | query, | ||
const int | flags = MATCH_MOST_INTENSE_PEAK , |
||
const int | peaksUsedFromIons1 = -1 , |
||
const int | peaksUsedFromIons2 = -1 , |
||
const int | peaksUsedFromIons3 = -1 |
||
) |
Find matches to peaks lists from a Mascot results file.
This function matches experimental data to the calculated fragment matches. To find which peaks are matched, use ms_fragment::getMatchedIonMass() and ms_fragment::getMatchedIonIntensity(). The peak list is extracted from the results file using the query number specified.
resfile | is the Mascot results file from which the fragments were initially calculated. The results file is used to find the peak list and the tolerances to be used for matching. |
query | is the query number in the range 1..ms_mascotresfilebase::getNumQueries(). |
flags | is a MATCH_PEAKS value. Currently only MATCH_MOST_INTENSE_PEAK is supported. |
peaksUsedFromIons1 | is the number of peaks from the peak list in the passed the results file to be used for matching. Use -1 to indicate all peaks. See also ms_peptide::getPeaksUsedFromIons1() and ms_inputquery::getStringIons1(). |
peaksUsedFromIons2 | is the number of peaks from the peak list in the passed the results file to be used for matching. Use -1 to indicate all peaks. See also ms_peptide::getPeaksUsedFromIons2() and ms_inputquery::getStringIons2(). |
peaksUsedFromIons3 | is the number of peaks from the peak list in the passed the results file to be used for matching. Use -1 to indicate all peaks. See also ms_peptide::getPeaksUsedFromIons3() and ms_inputquery::getStringIons3(). |
bool addExperimentalData | ( | const std::string & | peakList, |
const int | numPeaks, | ||
const double | tolerance, | ||
const std::string & | toleranceUnits, | ||
const bool | updateMatchList = true |
||
) |
Find matches to peak list.
This function matches the peakList to the calculated fragment matches. To find which peaks are matched, use ms_fragment::getMatchedIonMass() and ms_fragment::getMatchedIonIntensity().
peakList | will be of the form 136.070000:42.95,175.110000:133.1, 299.060000:710.1,415.030000:144.6 . and may be retrieved using ms_inputquery::getStringIons1(). |
numPeaks | is the number of peaks to be used from the list. If this is -1, then all peaks are used. To only match peaks used for matching by the search engine, pass ms_peptide::getPeaksUsedFromIons1(). |
tolerance | is the tolerance to be used for matching the ions. This can be found from ms_searchparams::getITOL(). |
toleranceUnits | must be "Da", "mmu" or "ppm". This can be found from ms_searchparams::getITOLU(). |
updateMatchList | should be set to true if you want to recalculate the list of matches. If this function is to be called multiple times, then set it to false except for the last call. |
void appendFragment | ( | const ms_fragment * | item | ) |
Adds a new fragment to the end of the vector.
A copy of the ms_fragment is made and added to the list, so there is no requirement to keep the original in memory.
item | is a new item to add to the list. |
void clearFragments | ( | ) |
Deletes all fragments from the vector.
After calling this, getNumberOfFragments() will return 0.
void copyFrom | ( | const ms_fragmentvector * | right | ) |
Copies all content from another instance.
Copy everything from right onto this fragment object.
right | const pointer to a valid ms_fragmentvector object |
const ms_fragment * getFragmentByNumber | ( | const unsigned int | numFrag | ) | const |
Return a fragment object by its number.
numFrag | is the fragment to return. This must be in the range 0 to getNumberOfFragments() -1. |
|
static |
Get minimum and maximum masses within tolerance for a specified mass.
This function can be used with any masses - fragments or peptides, and works with relative masses or m/z values. Mascot server applies tolerances to observed m/z values.
See Static functions in Perl, Java, Python and C#
[in] | mass | is the mass of the fragment or peptide or protein |
[in] | toleranceValue | the tolerance in the units specified by toleranceUnit |
[in] | toleranceUnit | any of the four ms_fragmentvector::TOLERANCE_UNIT values |
[out] | minMass | Used to return the minimum mass in the range |
[out] | maxMass | Used to return the maximum mass in the range |
int getNumberOfFragments | ( | ) | const |
Returns a number of fragments currently held in the vector.
ms_fragmentvector::frag_vector * getVector | ( | ) |
Return a pointer to the STL vector of ms_fragment objects.
This class is just a wrapper for std::vector<ms_fragment> so it possible to get a pointer to the STL vector if required.
const ms_fragmentvector::frag_vector * getVector | ( | ) | const |
Return a const pointer to the STL vector of ms_fragment objects.
ms_fragmentvector & operator= | ( | const ms_fragmentvector & | right | ) |
C++ style assignment operator.
right | is the original list to copy to the new list. |