Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches

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_fragmentgetFragmentByNumber (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_fragmentvectoroperator= (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.
 

Detailed Description

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.

Examples
tools_aahelper.cpp.

Member Enumeration Documentation

◆ 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).

◆ 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#.

Enumerator
TOLERANCE_DALTON 

Simple Daltons.

TOLERANCE_MMU 

milli mass units (1000th of a Dalton)

TOLERANCE_PERCENT 

Percentage of the fragment or peptide mass.

TOLERANCE_PPM 

Parts per million of the fragment or peptide mass.

Constructor & Destructor Documentation

◆ ms_fragmentvector() [1/2]

Default constructor.

Create a default empty list of fragments.

◆ ms_fragmentvector() [2/2]

Copying constructor.

Note
This constructor can only be used from C++. Use copyFrom() from other programming languages.
Parameters
srcis the original list to base the new list on.

◆ ~ms_fragmentvector()

~ms_fragmentvector ( )
virtual

Destructor.

No need to call this directly. Frees the list of fragments.

Member Function Documentation

◆ addExperimentalData() [1/2]

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.

Parameters
resfileis 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.
queryis the query number in the range 1..ms_mascotresfilebase::getNumQueries().
flagsis a MATCH_PEAKS value. Currently only MATCH_MOST_INTENSE_PEAK is supported.
peaksUsedFromIons1is 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().
peaksUsedFromIons2is 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().
peaksUsedFromIons3is 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().
Returns
indicates if the function was successful. It will only fail if the results file is invalid or if the query number is invalid.

◆ addExperimentalData() [2/2]

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().

Parameters
peakListwill 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().
numPeaksis 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().
toleranceis the tolerance to be used for matching the ions. This can be found from ms_searchparams::getITOL().
toleranceUnitsmust be "Da", "mmu" or "ppm". This can be found from ms_searchparams::getITOLU().
updateMatchListshould 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.
Returns
indicates if the function was successful. It will only fail if toleranceUnits are invalid.

◆ appendFragment()

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.

Parameters
itemis a new item to add to the list.
Examples
tools_aahelper.cpp.

◆ clearFragments()

void clearFragments ( )

Deletes all fragments from the vector.

After calling this, getNumberOfFragments() will return 0.

◆ copyFrom()

void copyFrom ( const ms_fragmentvector right)

Copies all content from another instance.

Copy everything from right onto this fragment object.

Parameters
rightconst pointer to a valid ms_fragmentvector object
Examples
tools_aahelper.cpp.

◆ getFragmentByNumber()

const ms_fragment * getFragmentByNumber ( const unsigned int  numFrag) const

Return a fragment object by its number.

Parameters
numFragis the fragment to return. This must be in the range 0 to getNumberOfFragments() -1.
Returns
A pointer to the ms_fragment object. See Maintaining object references: two rules of thumb.
Examples
tools_aahelper.cpp.

◆ getMassesWithinTolerance()

void getMassesWithinTolerance ( const double  mass,
const double  toleranceValue,
const TOLERANCE_UNIT  toleranceUnit,
double &  minMass,
double &  maxMass 
)
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#

Parameters
[in]massis the mass of the fragment or peptide or protein
[in]toleranceValuethe tolerance in the units specified by toleranceUnit
[in]toleranceUnitany of the four ms_fragmentvector::TOLERANCE_UNIT values
[out]minMassUsed to return the minimum mass in the range
[out]maxMassUsed to return the maximum mass in the range

◆ getNumberOfFragments()

int getNumberOfFragments ( ) const

Returns a number of fragments currently held in the vector.

See also
getFragmentByNumber().
Returns
number of fragments
Examples
tools_aahelper.cpp.

◆ getVector() [1/2]

ms_fragmentvector::frag_vector * getVector ( )

Return a pointer to the STL vector of ms_fragment objects.

Note
This function would only ever be of use in C++.

This class is just a wrapper for std::vector<ms_fragment> so it possible to get a pointer to the STL vector if required.

Returns
A pointer to the STL vector.

◆ getVector() [2/2]

const ms_fragmentvector::frag_vector * getVector ( ) const

Return a const pointer to the STL vector of ms_fragment objects.

See also
getVector()
Returns
A pointer to the STL vector.

◆ operator=()

ms_fragmentvector & operator= ( const ms_fragmentvector right)

C++ style assignment operator.

Parameters
rightis the original list to copy to the new list.
Returns
reference to the current object

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