1 /* massXpert - the true massist's program.
2    --------------------------------------
3    Copyright(C) 2006,2007 Filippo Rusconi
4 
5    http://www.massxpert.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 
38 #ifndef FRAGMENTER_HPP
39 #define FRAGMENTER_HPP
40 
41 
42 /////////////////////// Local includes
43 #include "fragSpec.hpp"
44 #include "fragOptions.hpp"
45 #include "calcOptions.hpp"
46 #include "polymer.hpp"
47 #include "ionizeRule.hpp"
48 #include "oligomerList.hpp"
49 #include "crossLinkedRegion.hpp"
50 
51 namespace massXpert
52 {
53 
54   class Fragmenter
55   {
56   private:
57     const QPointer<Polymer> mp_polymer;
58     const PolChemDef *mp_polChemDef;
59     QList<FragOptions *> m_fragOptionList;
60     CalcOptions m_calcOptions;
61     IonizeRule m_ionizeRule;
62 
63     // Pointer to an oligomer list which WE DO NOT OWN.
64     OligomerList *mp_oligomerList;
65 
66     // A list of CrossLinkedRegion instances that we compute in case
67     // there are cross-links in the fragmented sequence.
68     QList<CrossLinkedRegion *> m_crossLinkedRegionList;
69 
70 
71   public:
72     Fragmenter(Polymer *, const PolChemDef *,
73 		const QList<FragOptions *> &fragOptionList,
74 		const CalcOptions &, const IonizeRule &);
75 
76     Fragmenter(const Fragmenter &);
77     ~Fragmenter();
78 
79     void addFragOptions(FragOptions *);
80 
81     void setOligomerList(OligomerList *);
82     OligomerList * oligomerList();
83 
84     bool fragment();
85     int fragmentEndNone(FragOptions &);
86     int fragmentEndLeft(FragOptions &);
87     int fragmentEndRight(FragOptions &);
88 
89     bool accountFragRule(FragRule *, bool, int, int, Ponderable *);
90     int accountFormulas(OligomerList *, FragOptions &, QString, int);
91     OligomerList *accountIonizationLevels(OligomerList *, FragOptions &);
92 
93     void emptyOligomerList();
94   };
95 
96 } // namespace massXpert
97 
98 
99 #endif // FRAGMENTER_HPP
100