CycloBranch
cPeaksList Class Reference

The class representing a peak list. More...

#include <cPeaksList.h>

Public Member Functions

 cPeaksList ()
 The constructor.
 
 cPeaksList (const cPeaksList &peakslist)
 The copy constructor. More...
 
cPeaksListoperator= (const cPeaksList &peakslist)
 Overloaded operator=. More...
 
void clear ()
 Clear the peak list.
 
void attach (cPeaksList &peaklist)
 Attach a peak list. More...
 
void add (cPeak &peak)
 Add a peak. More...
 
void loadFromPlainTextStream (ifstream &stream)
 Load the spectrum from a plain text stream (tab separated values m/z ratio and intensity). More...
 
void loadFromBAFStream (ifstream &stream)
 Load the spectrum from a .csv file converted from a .baf file by CompassXport. More...
 
void loadFromIBDStream (cImzMLItem &imzmlitem, ifstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision)
 Load the spectrum from .ibd file. More...
 
void storeToIBDStream (ofstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision)
 Store the spectrum into .ibd file. More...
 
void loadFromMGFStream (ifstream &stream, int timeunit)
 Load the spectrum from a .mgf file. More...
 
int size ()
 The number of peaks. More...
 
string print (bool htmlterminatelines=false, bool printgroupid=false)
 Print the spectrum. More...
 
void sortbyMass (int limit=-1)
 Sort the peaks by mass. More...
 
void sortbyRelativeIntensityDesc ()
 Sort the peaks by relative intensity in the descending order.
 
void sortbyAbsoluteIntensityDesc ()
 Sort the peaks by absolute intensity in the descending order.
 
void sortbyGroupId ()
 Sort the peaks by group id.
 
void sortbyOrderId ()
 Sort the peaks by order id.
 
int normalizeIntenzity ()
 Normalize intensities of peaks. More...
 
void normalizeIntenzityByValue (double value)
 Normalize intensities of peaks using a value. More...
 
void cropRelativeIntenzity (double minimumrelativeintensitythreshold)
 Remove peaks with relative intensities lower than the threshold. More...
 
void cropAbsoluteIntenzity (unsigned minimumabsoluteintensitythreshold)
 Remove peaks with absolute intensities lower than the threshold. More...
 
void cropMinimumMZRatio (double minimummz, double errortolerance)
 Crop mz ratio lower than a threshold. More...
 
void cropMaximumMZRatio (double maximummz, double errortolerance)
 Crop mz ratio bigger than a threshold. More...
 
cPeakoperator[] (int position)
 Overloaded operator []. More...
 
void resize (int size)
 Resize the peak list. More...
 
double getMinimumMZRatio ()
 Get the minimum mz ratio. More...
 
double getMaximumMZRatio ()
 Get the maximum mz ratio. More...
 
void removeIsotopes (int maximumcharge, double fragmentmasserrortolerance, cMainThread *os=0)
 Remove isotopic peaks. More...
 
int find (double mzratio, double fragmentmasserrortolerance)
 Get a position of a peak with specified mzratio. More...
 
void remove (int position)
 Remove a peak. More...
 
void removeChargeVariants (int maximumcharge, double fragmentmasserrortolerance)
 Perform a deconvolution. More...
 
void removeNeutralLoss (double loss, int maximumcharge, double fragmentmasserrortolerance)
 Remove neutral losses. More...
 
void removeObsolete ()
 Remove peaks having set up the flag removeme == true.
 
void maxHighestPeaksInWindow (int maximumnumberofpeaksinwindow, double windowsize)
 Keep only n highest peaks in a window of a specified size. More...
 
double getMaximumRelativeIntensityFromMZInterval (double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled)
 Get the maximum relative intensity from an m/z interval. More...
 
double getMaximumAbsoluteIntensityFromMZInterval (double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled)
 Get the maximum absolute intensity from an m/z interval. More...
 
double getMaximumRelativeIntensity ()
 Get the maximum relative intensity. More...
 
double getMaximumAbsoluteIntensity ()
 Get the maximum absolute intensity. More...
 
void setRetentionTime (double rt)
 Set the retention time. More...
 
double getRetentionTime ()
 Get the retention time. More...
 
void setRetentionTimeUnit (int unit)
 Set the retention time unit. More...
 
int getRetentionTimeUnit ()
 Get the retention time unit. More...
 
void setCoordinates (int x, int y)
 Set the coordinates. More...
 
int getCoordinateX ()
 Get the X coordinate. More...
 
int getCoordinateY ()
 Get the Y coordinate. More...
 
void store (ofstream &os)
 Store the structure into an output stream. More...
 
void load (ifstream &is, int fileversionpart1, int fileversionpart2, int fileversionpart3)
 Load the structure from an input stream. More...
 
string & getTitle ()
 Get the title. More...
 
void setTitle (string &title)
 Set the title. More...
 
void reducePeakDescriptions (unordered_map< string, int > &peakdesctoid)
 Reduce redundant descriptions of peaks. More...
 
void reduceIsotopeFormulaDescriptions (unordered_map< string, int > &isotopeformuladesctoid)
 Reduce redundant descriptions of isotope formulas. More...
 
void fillOrderIDs ()
 Define order ids of peaks.
 
void setIsotopeFlags (bool value)
 Set isotope flags. More...
 
void markIsotopes ()
 Mark isotopic peaks in isotopic patterns.
 
bool equals (cPeaksList &secondpeaklist)
 Check if the object equals to another object. More...
 

Detailed Description

The class representing a peak list.

Constructor & Destructor Documentation

◆ cPeaksList()

cPeaksList::cPeaksList ( const cPeaksList peakslist)

The copy constructor.

Parameters
peakslistreference to a cPeaksList

Member Function Documentation

◆ add()

void cPeaksList::add ( cPeak peak)

Add a peak.

Parameters
peakpeak which will be added

◆ attach()

void cPeaksList::attach ( cPeaksList peaklist)

Attach a peak list.

Parameters
peaklistpeaklist which will be attached

◆ cropAbsoluteIntenzity()

void cPeaksList::cropAbsoluteIntenzity ( unsigned  minimumabsoluteintensitythreshold)

Remove peaks with absolute intensities lower than the threshold.

Parameters
minimumabsoluteintensitythresholdminimum threshold of absolute intensity

◆ cropMaximumMZRatio()

void cPeaksList::cropMaximumMZRatio ( double  maximummz,
double  errortolerance 
)

Crop mz ratio bigger than a threshold.

Parameters
maximummzmaximum threshold of mz ratio
errortolerancemz error tolerance in ppm

◆ cropMinimumMZRatio()

void cPeaksList::cropMinimumMZRatio ( double  minimummz,
double  errortolerance 
)

Crop mz ratio lower than a threshold.

Parameters
minimummzminimum threshold of mz ratio
errortolerancemz error tolerance in ppm

◆ cropRelativeIntenzity()

void cPeaksList::cropRelativeIntenzity ( double  minimumrelativeintensitythreshold)

Remove peaks with relative intensities lower than the threshold.

Parameters
minimumrelativeintensitythresholdminimum threshold of relative intensity

◆ equals()

bool cPeaksList::equals ( cPeaksList secondpeaklist)

Check if the object equals to another object.

Parameters
secondpeaklistobject for comparison
Return values
booltrue if the objects are equals

◆ find()

int cPeaksList::find ( double  mzratio,
double  fragmentmasserrortolerance 
)

Get a position of a peak with specified mzratio.

Parameters
mzratioof searched peak
fragmentmasserrortolerancemz error tolerance
Return values
intposition; -1 when the peak is not found

◆ getCoordinateX()

int cPeaksList::getCoordinateX ( )

Get the X coordinate.

Return values
intX coordinate

◆ getCoordinateY()

int cPeaksList::getCoordinateY ( )

Get the Y coordinate.

Return values
intY coordinate

◆ getMaximumAbsoluteIntensity()

double cPeaksList::getMaximumAbsoluteIntensity ( )

Get the maximum absolute intensity.

Return values
doublemaximum absolute intensity

◆ getMaximumAbsoluteIntensityFromMZInterval()

double cPeaksList::getMaximumAbsoluteIntensityFromMZInterval ( double  minmz,
double  maxmz,
bool  hidematched,
bool  hideunmatched,
ePeptideType  peptidetype,
bool  hidescrambled 
)

Get the maximum absolute intensity from an m/z interval.

Parameters
minmzminimum mz ratio
maxmzmaximum mz ratio
hidematchedtrue, if matched peaks are hidden
hideunmatchedtrue, if unmatched peaks are hidden
peptidetypethe type of peptide
hidescrambledtrue, if scrambled peaks are hidden
Return values
doublemaximum absolute intensity

◆ getMaximumMZRatio()

double cPeaksList::getMaximumMZRatio ( )

Get the maximum mz ratio.

Return values
doublemaximum mz ratio

◆ getMaximumRelativeIntensity()

double cPeaksList::getMaximumRelativeIntensity ( )

Get the maximum relative intensity.

Return values
doublemaximum relative intensity

◆ getMaximumRelativeIntensityFromMZInterval()

double cPeaksList::getMaximumRelativeIntensityFromMZInterval ( double  minmz,
double  maxmz,
bool  hidematched,
bool  hideunmatched,
ePeptideType  peptidetype,
bool  hidescrambled 
)

Get the maximum relative intensity from an m/z interval.

Parameters
minmzminimum mz ratio
maxmzmaximum mz ratio
hidematchedtrue, if matched peaks are hidden
hideunmatchedtrue, if unmatched peaks are hidden
peptidetypethe type of peptide
hidescrambledtrue, if scrambled peaks are hidden
Return values
doublemaximum relative intensity

◆ getMinimumMZRatio()

double cPeaksList::getMinimumMZRatio ( )

Get the minimum mz ratio.

Return values
doubleminimum mz ratio

◆ getRetentionTime()

double cPeaksList::getRetentionTime ( )

Get the retention time.

Return values
doubleretention time

◆ getRetentionTimeUnit()

int cPeaksList::getRetentionTimeUnit ( )

Get the retention time unit.

Return values
int0 == second, 1 == minute

◆ getTitle()

string & cPeaksList::getTitle ( )

Get the title.

Return values
stringtitle

◆ load()

void cPeaksList::load ( ifstream &  is,
int  fileversionpart1,
int  fileversionpart2,
int  fileversionpart3 
)

Load the structure from an input stream.

Parameters
isan input stream
fileversionpart1first number of .res the file version
fileversionpart2second number of .res the file version
fileversionpart3third number of .res the file version

◆ loadFromBAFStream()

void cPeaksList::loadFromBAFStream ( ifstream &  stream)

Load the spectrum from a .csv file converted from a .baf file by CompassXport.

Parameters
streamsource stream

◆ loadFromIBDStream()

void cPeaksList::loadFromIBDStream ( cImzMLItem imzmlitem,
ifstream &  ibdstream,
bool  use_64bit_float_mz_precision,
bool  use_64bit_float_intensity_precision 
)

Load the spectrum from .ibd file.

Parameters
imzmlitemcImzML containing the offset in the ibd file
ibdstreaman input binary file stream
use_64bit_float_mz_precisionif true, 64bit mz precision is used; if false, 32bit precision is used
use_64bit_float_intensity_precisionif true, 64bit intensity precision is used; if false, 32bit precision is used

◆ loadFromMGFStream()

void cPeaksList::loadFromMGFStream ( ifstream &  stream,
int  timeunit 
)

Load the spectrum from a .mgf file.

Parameters
streamsource stream
timeunitrt unit

◆ loadFromPlainTextStream()

void cPeaksList::loadFromPlainTextStream ( ifstream &  stream)

Load the spectrum from a plain text stream (tab separated values m/z ratio and intensity).

Parameters
streamsource stream

◆ maxHighestPeaksInWindow()

void cPeaksList::maxHighestPeaksInWindow ( int  maximumnumberofpeaksinwindow,
double  windowsize 
)

Keep only n highest peaks in a window of a specified size.

Parameters
maximumnumberofpeaksinwindowmaximum number of peaks in a window
windowsizesize of a window

◆ normalizeIntenzity()

int cPeaksList::normalizeIntenzity ( )

Normalize intensities of peaks.

Return values
int0 == success, -1 == maximum intensity <= 0

◆ normalizeIntenzityByValue()

void cPeaksList::normalizeIntenzityByValue ( double  value)

Normalize intensities of peaks using a value.

Parameters
valuenormalization value

◆ operator=()

cPeaksList & cPeaksList::operator= ( const cPeaksList peakslist)

Overloaded operator=.

Parameters
peakslistreference to a cPeaksList

◆ operator[]()

cPeak & cPeaksList::operator[] ( int  position)

Overloaded operator [].

Parameters
positionposition of a peak in the peak list
Return values
cPeakreference to the peak

◆ print()

string cPeaksList::print ( bool  htmlterminatelines = false,
bool  printgroupid = false 
)

Print the spectrum.

Parameters
htmlterminatelinestrue if the html line endings should be used
printgroupidtrue if the groupid should be printed
Return values
stringstring with a printed spectrum

◆ reduceIsotopeFormulaDescriptions()

void cPeaksList::reduceIsotopeFormulaDescriptions ( unordered_map< string, int > &  isotopeformuladesctoid)

Reduce redundant descriptions of isotope formulas.

Parameters
isotopeformuladesctoidmap of isotope formula descriptions to ids

◆ reducePeakDescriptions()

void cPeaksList::reducePeakDescriptions ( unordered_map< string, int > &  peakdesctoid)

Reduce redundant descriptions of peaks.

Parameters
peakdesctoidmap of peak descriptions to ids

◆ remove()

void cPeaksList::remove ( int  position)

Remove a peak.

Parameters
positionposition of a peak

◆ removeChargeVariants()

void cPeaksList::removeChargeVariants ( int  maximumcharge,
double  fragmentmasserrortolerance 
)

Perform a deconvolution.

Parameters
maximumchargecharge of the precursor
fragmentmasserrortolerancemz error tolerance

◆ removeIsotopes()

void cPeaksList::removeIsotopes ( int  maximumcharge,
double  fragmentmasserrortolerance,
cMainThread os = 0 
)

Remove isotopic peaks.

Parameters
maximumchargecharge of the precursor
fragmentmasserrortolerancemz error tolerance
osreference to a main thread of the application (stream, respectively)

◆ removeNeutralLoss()

void cPeaksList::removeNeutralLoss ( double  loss,
int  maximumcharge,
double  fragmentmasserrortolerance 
)

Remove neutral losses.

Parameters
lossmass change
maximumchargecharge of the precursor
fragmentmasserrortolerancemz error tolerance

◆ resize()

void cPeaksList::resize ( int  size)

Resize the peak list.

Parameters
sizenumber of peaks

◆ setCoordinates()

void cPeaksList::setCoordinates ( int  x,
int  y 
)

Set the coordinates.

Parameters
xX coordinate
yY coordinate

◆ setIsotopeFlags()

void cPeaksList::setIsotopeFlags ( bool  value)

Set isotope flags.

Parameters
valueflag value

◆ setRetentionTime()

void cPeaksList::setRetentionTime ( double  rt)

Set the retention time.

Parameters
rtretention time

◆ setRetentionTimeUnit()

void cPeaksList::setRetentionTimeUnit ( int  unit)

Set the retention time unit.

Parameters
unit0 == second, 1 == minute

◆ setTitle()

void cPeaksList::setTitle ( string &  title)

Set the title.

Parameters
titletitle

◆ size()

int cPeaksList::size ( )

The number of peaks.

Return values
intnumber of peaks

◆ sortbyMass()

void cPeaksList::sortbyMass ( int  limit = -1)

Sort the peaks by mass.

Parameters
limitsort first limit peaks only; if limit == -1 then all peaks are sorted

◆ store()

void cPeaksList::store ( ofstream &  os)

Store the structure into an output stream.

Parameters
osan output stream

◆ storeToIBDStream()

void cPeaksList::storeToIBDStream ( ofstream &  ibdstream,
bool  use_64bit_float_mz_precision,
bool  use_64bit_float_intensity_precision 
)

Store the spectrum into .ibd file.

Parameters
ibdstreaman output binary file stream
use_64bit_float_mz_precisionif true, 64bit mz precision is used; if false, 32bit precision is used
use_64bit_float_intensity_precisionif true, 64bit intensity precision is used; if false, 32bit precision is used

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