CycloBranch
cPeaksList.h
Go to the documentation of this file.
1
7#ifndef _CPEAKSLIST_H
8#define _CPEAKSLIST_H
9
10#include <iostream>
11#include <fstream>
12#include <vector>
13#include <string>
14#include <algorithm>
15
16#include "core/cPeak.h"
17#include "core/cMzML.h"
18#include "core/cImzML.h"
19
20
21using namespace std;
22
23
24class cMainThread;
25
26
33bool compareRelativePeakIntensitiesDesc(const cPeak& a, const cPeak& b);
34
35
43bool isInPpmMassErrorTolerance(double experimentalmass, double theoreticalmass, double tolerance);
44
45
52double ppmError(double experimentalmass, double theoreticalmass);
53
54
62bool searchHint(double mzratio, cPeaksList& experimentalpeaks, double fragmentmasserrortolerance);
63
64
69
70 vector<cPeak> peaks;
71
72 double rt;
73
74 int rtunit;
75
76 int x, y;
77
78 string title;
79
80public:
81
82
86 cPeaksList();
87
88
93 cPeaksList(const cPeaksList& peakslist);
94
95
100 cPeaksList& operator=(const cPeaksList& peakslist);
101
102
106 void clear();
107
108
113 void attach(cPeaksList& peaklist);
114
115
120 void add(cPeak& peak);
121
122
127 void loadFromPlainTextStream(ifstream &stream);
128
129
134 void loadFromBAFStream(ifstream &stream);
135
136
144 void loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision);
145
146
153 void storeToIBDStream(ofstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision);
154
155
161 void loadFromMGFStream(ifstream &stream, int timeunit);
162
163
168 int size();
169
170
177 string print(bool htmlterminatelines = false, bool printgroupid = false);
178
179
184 void sortbyMass(int limit = -1);
185
186
191
192
197
198
202 void sortbyGroupId();
203
204
208 void sortbyOrderId();
209
210
215 int normalizeIntenzity();
216
217
222 void normalizeIntenzityByValue(double value);
223
224
229 void cropRelativeIntenzity(double minimumrelativeintensitythreshold);
230
231
236 void cropAbsoluteIntenzity(unsigned minimumabsoluteintensitythreshold);
237
238
244 void cropMinimumMZRatio(double minimummz, double errortolerance);
245
246
252 void cropMaximumMZRatio(double maximummz, double errortolerance);
253
254
260 cPeak& operator[](int position);
261
262
267 void resize(int size);
268
269
274 double getMinimumMZRatio();
275
276
281 double getMaximumMZRatio();
282
283
290 void removeIsotopes(int maximumcharge, double fragmentmasserrortolerance, cMainThread* os = 0);
291
292
299 int find(double mzratio, double fragmentmasserrortolerance);
300
301
306 void remove(int position);
307
308
314 void removeChargeVariants(int maximumcharge, double fragmentmasserrortolerance);
315
316
323 void removeNeutralLoss(double loss, int maximumcharge, double fragmentmasserrortolerance);
324
325
329 void removeObsolete();
330
331
337 void maxHighestPeaksInWindow(int maximumnumberofpeaksinwindow, double windowsize);
338
339
350 double getMaximumRelativeIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled);
351
352
363 double getMaximumAbsoluteIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled);
364
365
371
372
378
379
384 void setRetentionTime(double rt);
385
386
391 double getRetentionTime();
392
393
398 void setRetentionTimeUnit(int unit);
399
400
406
407
413 void setCoordinates(int x, int y);
414
415
420 int getCoordinateX();
421
422
427 int getCoordinateY();
428
429
434 void store(ofstream& os);
435
436
444 void load(ifstream& is, int fileversionpart1, int fileversionpart2, int fileversionpart3);
445
446
451 string& getTitle();
452
453
458 void setTitle(string& title);
459
460
465 void reducePeakDescriptions(unordered_map<string, int>& peakdesctoid);
466
467
472 void reduceIsotopeFormulaDescriptions(unordered_map<string, int>& isotopeformuladesctoid);
473
474
478 void fillOrderIDs();
479
480
485 void setIsotopeFlags(bool value);
486
487
491 void markIsotopes();
492
493
499 bool equals(cPeaksList& secondpeaklist);
500
501};
502
503
508
509#endif
imzML parser.
mzML parser.
The representation of a peak in a mass spectrum.
double ppmError(double experimentalmass, double theoreticalmass)
Compute a ppm error between two masses.
Definition: cPeaksList.cpp:16
bool compareRelativePeakIntensitiesDesc(const cPeak &a, const cPeak &b)
Compare two peaks by relative intensities.
Definition: cPeaksList.cpp:5
bool searchHint(double mzratio, cPeaksList &experimentalpeaks, double fragmentmasserrortolerance)
Check if an m/z ratio exists in an experimental spectrum.
Definition: cPeaksList.cpp:21
Q_DECLARE_METATYPE(cPeaksList)
Register cPeaksList by Qt.
bool isInPpmMassErrorTolerance(double experimentalmass, double theoreticalmass, double tolerance)
Check whether two masses are inside a ppm mass error tolerance.
Definition: cPeaksList.cpp:10
The class representing a thread launched by the command 'Search->Run'.
Definition: cMainThread.h:34
The class representing a peak list.
Definition: cPeaksList.h:68
double getMinimumMZRatio()
Get the minimum mz ratio.
Definition: cPeaksList.cpp:483
void clear()
Clear the peak list.
Definition: cPeaksList.cpp:64
void sortbyOrderId()
Sort the peaks by order id.
Definition: cPeaksList.cpp:374
void removeObsolete()
Remove peaks having set up the flag removeme == true.
Definition: cPeaksList.cpp:633
int find(double mzratio, double fragmentmasserrortolerance)
Get a position of a peak with specified mzratio.
Definition: cPeaksList.cpp:552
void sortbyGroupId()
Sort the peaks by group id.
Definition: cPeaksList.cpp:365
void sortbyRelativeIntensityDesc()
Sort the peaks by relative intensity in the descending order.
Definition: cPeaksList.cpp:351
cPeaksList & operator=(const cPeaksList &peakslist)
Overloaded operator=.
Definition: cPeaksList.cpp:53
double getMaximumMZRatio()
Get the maximum mz ratio.
Definition: cPeaksList.cpp:498
void setRetentionTime(double rt)
Set the retention time.
Definition: cPeaksList.cpp:775
void load(ifstream &is, int fileversionpart1, int fileversionpart2, int fileversionpart3)
Load the structure from an input stream.
Definition: cPeaksList.cpp:833
void loadFromIBDStream(cImzMLItem &imzmlitem, ifstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision)
Load the spectrum from .ibd file.
Definition: cPeaksList.cpp:143
void normalizeIntenzityByValue(double value)
Normalize intensities of peaks using a value.
Definition: cPeaksList.cpp:406
void cropMinimumMZRatio(double minimummz, double errortolerance)
Crop mz ratio lower than a threshold.
Definition: cPeaksList.cpp:445
void removeIsotopes(int maximumcharge, double fragmentmasserrortolerance, cMainThread *os=0)
Remove isotopic peaks.
Definition: cPeaksList.cpp:509
void cropMaximumMZRatio(double maximummz, double errortolerance)
Crop mz ratio bigger than a threshold.
Definition: cPeaksList.cpp:461
int getRetentionTimeUnit()
Get the retention time unit.
Definition: cPeaksList.cpp:791
void loadFromPlainTextStream(ifstream &stream)
Load the spectrum from a plain text stream (tab separated values m/z ratio and intensity).
Definition: cPeaksList.cpp:84
double getMaximumRelativeIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled)
Get the maximum relative intensity from an m/z interval.
Definition: cPeaksList.cpp:690
void reducePeakDescriptions(unordered_map< string, int > &peakdesctoid)
Reduce redundant descriptions of peaks.
Definition: cPeaksList.cpp:869
void attach(cPeaksList &peaklist)
Attach a peak list.
Definition: cPeaksList.cpp:74
void setCoordinates(int x, int y)
Set the coordinates.
Definition: cPeaksList.cpp:796
int normalizeIntenzity()
Normalize intensities of peaks.
Definition: cPeaksList.cpp:383
double getMaximumAbsoluteIntensity()
Get the maximum absolute intensity.
Definition: cPeaksList.cpp:764
int getCoordinateX()
Get the X coordinate.
Definition: cPeaksList.cpp:802
double getMaximumAbsoluteIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled)
Get the maximum absolute intensity from an m/z interval.
Definition: cPeaksList.cpp:722
string & getTitle()
Get the title.
Definition: cPeaksList.cpp:859
void resize(int size)
Resize the peak list.
Definition: cPeaksList.cpp:478
void remove(int position)
Remove a peak.
Definition: cPeaksList.cpp:574
void reduceIsotopeFormulaDescriptions(unordered_map< string, int > &isotopeformuladesctoid)
Reduce redundant descriptions of isotope formulas.
Definition: cPeaksList.cpp:888
string print(bool htmlterminatelines=false, bool printgroupid=false)
Print the spectrum.
Definition: cPeaksList.cpp:297
void setIsotopeFlags(bool value)
Set isotope flags.
Definition: cPeaksList.cpp:915
void sortbyAbsoluteIntensityDesc()
Sort the peaks by absolute intensity in the descending order.
Definition: cPeaksList.cpp:356
void store(ofstream &os)
Store the structure into an output stream.
Definition: cPeaksList.cpp:812
void fillOrderIDs()
Define order ids of peaks.
Definition: cPeaksList.cpp:907
int size()
The number of peaks.
Definition: cPeaksList.cpp:292
void maxHighestPeaksInWindow(int maximumnumberofpeaksinwindow, double windowsize)
Keep only n highest peaks in a window of a specified size.
Definition: cPeaksList.cpp:654
bool equals(cPeaksList &secondpeaklist)
Check if the object equals to another object.
Definition: cPeaksList.cpp:970
void storeToIBDStream(ofstream &ibdstream, bool use_64bit_float_mz_precision, bool use_64bit_float_intensity_precision)
Store the spectrum into .ibd file.
Definition: cPeaksList.cpp:200
void loadFromMGFStream(ifstream &stream, int timeunit)
Load the spectrum from a .mgf file.
Definition: cPeaksList.cpp:231
double getRetentionTime()
Get the retention time.
Definition: cPeaksList.cpp:781
double getMaximumRelativeIntensity()
Get the maximum relative intensity.
Definition: cPeaksList.cpp:753
int getCoordinateY()
Get the Y coordinate.
Definition: cPeaksList.cpp:807
void setRetentionTimeUnit(int unit)
Set the retention time unit.
Definition: cPeaksList.cpp:786
cPeak & operator[](int position)
Overloaded operator [].
Definition: cPeaksList.cpp:473
void add(cPeak &peak)
Add a peak.
Definition: cPeaksList.cpp:79
void removeChargeVariants(int maximumcharge, double fragmentmasserrortolerance)
Perform a deconvolution.
Definition: cPeaksList.cpp:581
void setTitle(string &title)
Set the title.
Definition: cPeaksList.cpp:864
void cropAbsoluteIntenzity(unsigned minimumabsoluteintensitythreshold)
Remove peaks with absolute intensities lower than the threshold.
Definition: cPeaksList.cpp:432
void loadFromBAFStream(ifstream &stream)
Load the spectrum from a .csv file converted from a .baf file by CompassXport.
Definition: cPeaksList.cpp:112
void markIsotopes()
Mark isotopic peaks in isotopic patterns.
Definition: cPeaksList.cpp:923
void removeNeutralLoss(double loss, int maximumcharge, double fragmentmasserrortolerance)
Remove neutral losses.
Definition: cPeaksList.cpp:616
void sortbyMass(int limit=-1)
Sort the peaks by mass.
Definition: cPeaksList.cpp:337
cPeaksList()
The constructor.
Definition: cPeaksList.cpp:43
void cropRelativeIntenzity(double minimumrelativeintensitythreshold)
Remove peaks with relative intensities lower than the threshold.
Definition: cPeaksList.cpp:419
A parsed imzML item.
Definition: cImzML.h:31
A structure representing a peak in a mass spectrum.
Definition: cPeak.h:22
ePeptideType
The types of peptides supported by the application.
Definition: utilities.h:104