CycloBranch
cBrick.h
Go to the documentation of this file.
1
7#ifndef _CBRICK_H
8#define _CBRICK_H
9
10#include <iostream>
11#include <fstream>
12#include <string>
13#include <vector>
14#include <algorithm>
15#include <map>
16#include "core/utilities.h"
17
18using namespace std;
19
20
25 h2o_loss = 0,
26 h2_loss
27};
28
29
35int getNumberOfBricks(const string& composition);
36
37
41class cBrick {
42 string name;
43 vector<string> acronyms;
44 vector<string> references;
45 string summary;
46 map<string, int> summarymap;
47 double mass;
48 string composition;
49 bool artificial;
50 eResidueLossType residuelosstype;
51 string losses;
52 vector<int> lossids;
53
54public:
55
59 cBrick();
60
61
65 void clear();
66
67
72 bool empty();
73
74
79 string& getName();
80
81
86 void setName(const string& name);
87
88
93 string& getSummary();
94
95
100 map<string, int>& getSummaryMap();
101
102
107 vector<string>& getAcronyms();
108
109
114 string& getLosses();
115
116
121 vector<int>& getLossIDs();
122
123
128 vector<string>& getReferences();
129
130
135 string& getComposition();
136
137
142 string getReverseComposition();
143
144
149 double getMass() const;
150
151
156 void setMass(double mass);
157
158
164 void setComposition(const string& composition, bool normalize);
165
166
171 void setSummary(const string& summary);
172
173
177 void createSummaryMap();
178
179
184 void setAcronyms(const string& acronyms);
185
186
191 void setLosses(const string& str);
192
193
198 void setLossIDs(vector<int>& lossids);
199
200
205 void setReferences(const string& references);
206
207
212
213
218 void explodeToIntComposition(vector<int>& bricks);
219
220
225 void explodeToStringComposition(vector<string>& bricks);
226
227
232 string getAcronymsAsString();
233
234
239 string getReferencesAsString();
240
241
247
248
254
255
260 void setArtificial(bool artificial);
261
262
267 bool isArtificial();
268
269
274 void setResidueLossType(eResidueLossType residuelosstype);
275
276
282
283
288 void store(ofstream& os);
289
290
295 void load(ifstream& is);
296
297};
298
299
300#endif
301
int getNumberOfBricks(const string &composition)
Get the number of bricks in a composition.
Definition: cBrick.cpp:6
eResidueLossType
Residue loss types.
Definition: cBrick.h:24
The class representing a building block (brick).
Definition: cBrick.h:41
string getReverseComposition()
Reverse the composition of the brick.
Definition: cBrick.cpp:92
void setAcronyms(const string &acronyms)
Set acronyms of all izomers corresponding to the brick.
Definition: cBrick.cpp:135
void setArtificial(bool artificial)
Set a flag determining whether the brick is a calculated mass block or a regular brick.
Definition: cBrick.cpp:385
void setMass(double mass)
Set the mass of the brick.
Definition: cBrick.cpp:111
void setResidueLossType(eResidueLossType residuelosstype)
Set the residue loss type.
Definition: cBrick.cpp:395
string & getLosses()
Access to a string variable which stores a list of neutral losses.
Definition: cBrick.cpp:72
string & getName()
Access to a string variable which stores a full name of the brick.
Definition: cBrick.cpp:47
void createSummaryMap()
Create a map of atoms from the molecular formula.
Definition: cBrick.cpp:129
double getMass() const
Get the mass of the brick.
Definition: cBrick.cpp:106
string getReferencesAsString()
Get all references.
Definition: cBrick.cpp:256
cBrick()
The constructor.
Definition: cBrick.cpp:21
void setLosses(const string &str)
Set the list of losses.
Definition: cBrick.cpp:157
void normalizeComposition()
Normalize the composition of the brick (ids of bricks are sorted in ascending order).
Definition: cBrick.cpp:189
void clear()
Clear all variables.
Definition: cBrick.cpp:26
void explodeToStringComposition(vector< string > &bricks)
Explode the composition of the brick into a vector of strings (ids of subbricks).
Definition: cBrick.cpp:224
string & getComposition()
Access to a string containing composition of the brick (ids of bricks separated by '-')
Definition: cBrick.cpp:87
vector< string > & getAcronyms()
Access to a vector of strings which stores acronyms of all izomers corresponding to the brick.
Definition: cBrick.cpp:67
string getFirstAcronymAsString()
Get the first acronym.
Definition: cBrick.cpp:268
map< string, int > & getSummaryMap()
Access to a map which stores a molecular formula of the brick.
Definition: cBrick.cpp:62
void setName(const string &name)
Set a full name of the brick.
Definition: cBrick.cpp:52
void setReferences(const string &references)
Set references (e.g., to ChemSpider) of all izomers corresponding to the brick.
Definition: cBrick.cpp:167
bool empty()
Test whether the brick is empty.
Definition: cBrick.cpp:41
void load(ifstream &is)
Load the structure from an input stream.
Definition: cBrick.cpp:420
string getAcronymsWithReferencesAsHTMLString()
Get all acronyms with HTML links to theirs references.
Definition: cBrick.cpp:276
string getAcronymsAsString()
Get all acronyms.
Definition: cBrick.cpp:244
void store(ofstream &os)
Store the structure into an output stream.
Definition: cBrick.cpp:405
void setComposition(const string &composition, bool normalize)
Set the composition of the brick.
Definition: cBrick.cpp:116
vector< int > & getLossIDs()
Access to a vector of identifiers of neutral losses.
Definition: cBrick.cpp:77
void setSummary(const string &summary)
Set the summary molecular formula of the brick.
Definition: cBrick.cpp:124
string & getSummary()
Access to a string variable which stores a molecular formula of the brick.
Definition: cBrick.cpp:57
bool isArtificial()
Get a flag determining whether the brick is a calculated mass block or a regular brick.
Definition: cBrick.cpp:390
vector< string > & getReferences()
Access to a vector of strings which stores references (e.g., to ChemSpider) of all izomers correspond...
Definition: cBrick.cpp:82
void explodeToIntComposition(vector< int > &bricks)
Explode the composition of the brick into a vector of intergers (ids of subbricks).
Definition: cBrick.cpp:204
void setLossIDs(vector< int > &lossids)
Set a vector of identifiers of neutral losses.
Definition: cBrick.cpp:162
eResidueLossType getResidueLossType()
Get the residue loss type.
Definition: cBrick.cpp:400
Auxiliary funtions and structures.