1 /* massXpert - the true massist's program. 2 -------------------------------------- 3 Copyright(C) 2006,2007 Filippo Rusconi 4 5 http://www.filomace.org/massXpert 6 7 This file is part of the massXpert project. 8 9 The massxpert project is the successor to the "GNU polyxmass" 10 project that is an official GNU project package(see 11 www.gnu.org). The massXpert project is not endorsed by the GNU 12 project, although it is released ---in its entirety--- under the 13 GNU General Public License. A huge part of the code in massXpert 14 is actually a C++ rewrite of code in GNU polyxmass. As such 15 massXpert was started at the Centre National de la Recherche 16 Scientifique(FRANCE), that granted me the formal authorization to 17 publish it under this Free Software License. 18 19 This software is free software; you can redistribute it and/or 20 modify it under the terms of the GNU General Public 21 License version 3, as published by the Free Software Foundation. 22 23 24 This software is distributed in the hope that it will be useful, 25 but WITHOUT ANY WARRANTY; without even the implied warranty of 26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 General Public License for more details. 28 29 You should have received a copy of the GNU General Public License 30 along with this software; if not, write to the 31 32 Free Software Foundation, Inc., 33 34 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 35 */ 36 37 #ifndef ISOTOPIC_PATTERN_CALCULATOR_HPP 38 #define ISOTOPIC_PATTERN_CALCULATOR_HPP 39 40 /////////////////////// Local includes 41 #include "peakCentroid.hpp" 42 #include "formula.hpp" 43 #include "peakShape.hpp" 44 #include "peakShapeConfig.hpp" 45 46 namespace massXpert 47 { 48 49 class IsotopicPatternCalculator : public QObject 50 { 51 Q_OBJECT 52 53 private: 54 Formula m_formula; 55 int m_charge; 56 57 int m_maxPeakCentroids; 58 double m_minProb; 59 60 const QList<Atom *> &m_atomRefList; 61 62 QList<QPointF *> m_pointList; 63 64 PeakShapeConfig m_config; 65 66 QList<PeakCentroid *> m_peakCentroidList; 67 QList<PeakCentroid *> m_tempPeakCentroidList; 68 QList<PeakShape *> m_peakShapeList; 69 70 bool m_aborted; 71 int m_abortCheckCount; 72 int m_progressValueNew; 73 int m_progressValueOld; 74 75 double m_sumProbabilities; 76 double m_greatestProbability; 77 78 bool seedPeakCentroidList(); 79 80 void freeClearPeakCentroidList(); 81 void freeClearTempPeakCentroidList(); 82 void freeClearPeakShapeList(); 83 void freeClearPointList(); 84 85 int accountAtomCount(const AtomCount *); 86 int updatePeakCentroidListWithAtom(const Atom *); 87 int updatePeakCentroidWithIsotope(PeakCentroid *, const Isotope *); 88 int mergePeakCentroidsWithSameMz(); 89 int removePeakCentroidsInExcess(); 90 int calculateSumOfProbabilities(); 91 int calculateRelativeIntensity(); 92 int removeTooLowProbPeaks(); 93 94 95 public: 96 IsotopicPatternCalculator(Formula /* formula */, 97 int /* charge */, 98 int /* maxPeaks */, 99 double /* minProb */, 100 const QList<Atom *> & /* atomRefList */, 101 PeakShapeConfig = PeakShapeConfig()); 102 103 ~IsotopicPatternCalculator(); 104 105 const QList<PeakCentroid *> &peakCentroidList() const; 106 QString *peakCentroidListAsString() const; 107 108 const QList<QPointF *> &pointList() const; 109 QString *pointListAsString() const; 110 QList<QPointF *> *duplicatePointList() const; 111 int transferPoints(QList<QPointF *> *); 112 113 QPointF *firstPoint() const; 114 QPointF *lastPoint() const; 115 116 int calculatePeakCentroids(); 117 int calculatePeakShapes(); 118 const QList<QPointF *> &sumPeakShapes(); 119 120 121 signals: 122 void isotopicCalculationProgressValueChanged(int); 123 void isotopicCalculationMessageChanged(QString); 124 125 public slots: 126 void isotopicCalculationAborted(); 127 }; 128 129 }// namespace massXpert 130 131 #endif // ISOTOPIC_PATTERN_CALCULATOR_HPP 132 133