CycloBranch
cCandidate.h
Go to the documentation of this file.
1
7#ifndef _CCANDIDATE_H
8#define _CCANDIDATE_H
9
10#include <vector>
11#include <unordered_set>
12#include <string>
13
14#include "core/cParameters.h"
18
19class cCandidateSet;
20class cDeNovoGraph;
21
22
23using namespace std;
24using namespace boost;
25
26
31
35 int id;
36
37
41 vector<int> bricks;
42
43
48
49
54
55
60
61
66
67
72
73
78
79
84 clear();
85 }
86
87
91 void clear() {
92 id = 0;
93 bricks.clear();
96 startmodifID = 0;
97 endmodifID = 0;
98 middlemodifID = 0;
99 tcomposition = "";
100 }
101
102
108 if (tcomposition.size() == 0) {
109 return false;
110 }
111 return tcomposition[0] == '(';
112 }
113
119 if (tcomposition.size() == 0) {
120 return false;
121 }
122 return tcomposition.back() == ')';
123 }
124
125};
126
127
132
133 int startmodifID;
134 int endmodifID;
135 int middlemodifID;
136 int branchstart;
137 int branchend;
138 vector<nodeEdge> path;
139 eFragmentIonType startiontype;
140 string name;
141 cSummaryFormula summary;
142
143 vector<string> composition;
144 string internalcomposition;
145 int numberofinternalbricks;
146
147 string realpeptidename;
148 string acronympeptidename;
149 vector<string> acronyms;
150 vector<string> backboneacronyms;
151 vector<string> branchacronyms;
152 string stringpath;
153
154 void updateInternalComposition();
155
156 void getPermutationsIter(cCandidateSet& permutations, vector<string>& currentcandidate, int position, bool* terminatecomputation);
157
158 void attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation);
159
160 void attachAllBranches(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation);
161
162 void getPartialRotations(const string& composition, vector<string>& rotations);
163
164 void getPartialBranchCyclicRotations(const string& composition, vector<cCandidate>& branchcyclicrotations, int branchstart, int branchend);
165
166public:
167
171 cCandidate();
172
173
184 cCandidate(vector<string>& composition, vector<nodeEdge>& path, eFragmentIonType startiontype, int startmodifID, int endmodifID, int middlemodifID, int middlepos);
185
186
198 cCandidate(vector<string>& composition, vector<nodeEdge>& path, eFragmentIonType startiontype, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend);
199
200
211 void setCandidate(vector<string>& composition, vector<nodeEdge>& path, eFragmentIonType startiontype, int startmodifID, int endmodifID, int middlemodifID, int middlepos);
212
213
225 void setCandidate(vector<string>& composition, vector<nodeEdge>& path, eFragmentIonType startiontype, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend);
226
227
231 void clear();
232
233
238 string& getComposition();
239
240
244 void revertComposition();
245
246
253 void prepareBranchedCandidates(cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation);
254
255
260 string getTComposition();
261
262
268 string getRevertedTComposition(bool usebrackets);
269
270
276 string getAcronymsTComposition(cBricksDatabase& brickdatabase);
277
278
284 string getRealNameTComposition(cBricksDatabase& brickdatabase);
285
286
291 int getBranchSize();
292
293
298 int getBranchStart();
299
300
305 int getBranchEnd();
306
307
312 void getPermutationsOfBranches(vector<TRotationInfo>& tpermutations);
313
314
321 double calculatePrecursorMassFromBricks(cBricksDatabase& brickdatabasewithcombinations, cParameters* parameters);
322
323
329 bool isEqualTo(cCandidate& candidate);
330
331
337 void getPermutations(cCandidateSet& permutations, bool* terminatecomputation);
338
339
344 int getStartModifID();
345
346
351 void setStartModifID(int id);
352
353
358 int getEndModifID();
359
360
365 void setEndModifID(int id);
366
367
372 int getMiddleModifID();
373
374
379 void setMiddleModifID(int id);
380
381
387 bool compare(cCandidate& candidate);
388
389
394 vector<nodeEdge>& getPath();
395
396
402 bool hasEqualTPermutations(cCandidate& candidate);
403
404
410 bool hasOnlyArtificialBricks(cBricksDatabase& brickdatabasewithcombinations);
411
412
418 bool hasFirstBrickArtificial(cBricksDatabase& brickdatabasewithcombinations);
419
420
426 bool hasLastBrickArtificial(cBricksDatabase& brickdatabasewithcombinations);
427
428
434 bool hasLastBrickInvalid(cBricksDatabase& brickdatabasewithcombinations);
435
436
442 void getRotations(vector<string>& rotations, bool includerevertedrotations);
443
444
450 void getBranchCyclicRotations(vector<cCandidate>& branchcyclicrotations, bool includerevertedrotations);
451
452
460 cSummaryFormula calculateSummaryFormulaFromBricks(cParameters& parameters, ePeptideType peptidetype, double precursormass = 0);
461
462
468
469
474 void setSummaryFormula(cSummaryFormula& summary);
475
476
481 void store(ofstream& os);
482
483
488 void load(ifstream& is);
489
490
495 void setName(string& name);
496
497
502 string& getName();
503
504
509 void setAcronyms(cBricksDatabase& bricksdatabase);
510
511
516 void setBackboneAcronyms(cBricksDatabase& bricksdatabase);
517
518
523 void setBranchAcronyms(cBricksDatabase& bricksdatabase);
524
525
530 vector<string>& getAcronyms();
531
532
537 vector<string>& getBackboneAcronyms();
538
539
544 vector<string>& getBranchAcronyms();
545
546
552 void setPath(cDeNovoGraph& graph, cParameters* parameters);
553
554
559 string& getPathAsString();
560
561
567 void setRealPeptideName(cBricksDatabase& bricksdatabase, ePeptideType peptidetype);
568
569
576
577
582 string& getRealPeptideName();
583
584
590
591
596 void setStartIonType(eFragmentIonType iontype);
597
598
604
605
613 bool checkKetideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype, bool regularblocksorder);
614
615
622
623
630
631
639 bool checkKetideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype, bool regularblocksorder);
640
641
642};
643
644
649
655 size_t operator()(const cCandidate& candidate) const {
656 return std::hash<string>()(((cCandidate&)candidate).getComposition());
657 }
658
659};
660
661
668bool operator == (cCandidate const& a, cCandidate const& b);
669
670
671#endif
672
eResidueLossType
Residue loss types.
Definition: cBrick.h:24
The database of building blocks.
bool operator==(cCandidate const &a, cCandidate const &b)
Overloaded operator ==.
Definition: cCandidate.cpp:1496
The representation of a node in the de novo graph.
eFragmentIonType
The types of supported fragment ions.
Definition: cFragmentIons.h:944
Definitions of program parameters.
The representation of a summary formula.
The class representing a database of building blocks (bricks).
Definition: cBricksDatabase.h:66
The class representing a peptide sequence candidate.
Definition: cCandidate.h:131
int getBranchStart()
Get starting position of a branch.
Definition: cCandidate.cpp:541
void setStartIonType(eFragmentIonType iontype)
Set start ion type used in the de novo graph.
Definition: cCandidate.cpp:1364
void setMiddleModifID(int id)
Set id of a terminal modification of a branched peptide (in the middle of a spectrum).
Definition: cCandidate.cpp:836
string & getRealPeptideName()
Get a real peptide name.
Definition: cCandidate.cpp:1354
void getBranchCyclicRotations(vector< cCandidate > &branchcyclicrotations, bool includerevertedrotations)
Get branch-cyclic rotations of a branch-cyclic peptide sequence.
Definition: cCandidate.cpp:980
void setStartModifID(int id)
Set id of a terminal modification (at the beginning of a spectrum).
Definition: cCandidate.cpp:815
int getBranchSize()
Get a number of blocks forming a branch.
Definition: cCandidate.cpp:533
bool isEqualTo(cCandidate &candidate)
Compare two candidates.
Definition: cCandidate.cpp:785
bool hasEqualTPermutations(cCandidate &candidate)
compare TPermutations of two candidates.
Definition: cCandidate.cpp:893
int getMiddleModifID()
Get id of a terminal modification of a branched peptide (in the middle of a spectrum).
Definition: cCandidate.cpp:831
int getBranchEnd()
Get end position of a branch.
Definition: cCandidate.cpp:546
vector< string > & getBackboneAcronyms()
Get a vector of acronyms corresponding to a backbone of a peptide sequence candidate.
Definition: cCandidate.cpp:1251
vector< string > & getAcronyms()
Get a vector of acronyms corresponding to a peptide sequence candidate.
Definition: cCandidate.cpp:1246
bool checkKetideSequence(cBricksDatabase &bricksdatabase, ePeptideType peptidetype, bool regularblocksorder)
Check if the order of blocks is correct.
Definition: cCandidate.cpp:1374
void prepareBranchedCandidates(cCandidateSet &result, ePeptideType peptidetype, bool *terminatecomputation)
Prepare candidates of a branched or a branch-cyclic peptide.
Definition: cCandidate.cpp:306
cSummaryFormula calculateSummaryFormulaFromBricks(cParameters &parameters, ePeptideType peptidetype, double precursormass=0)
Calculate the summary formula of the peptide sequence candidate.
Definition: cCandidate.cpp:989
void setPath(cDeNovoGraph &graph, cParameters *parameters)
Set a path in the de novo graph corresponding to the candidate.
Definition: cCandidate.cpp:1261
bool compare(cCandidate &candidate)
Compare two candidates.
Definition: cCandidate.cpp:841
vector< string > & getBranchAcronyms()
Get a vector of acronyms corresponding to a branch of a peptide sequence candidate.
Definition: cCandidate.cpp:1256
string & getName()
Get the name of peptide.
Definition: cCandidate.cpp:1195
void getPermutationsOfBranches(vector< TRotationInfo > &tpermutations)
Get permutations of branches a branched peptide.
Definition: cCandidate.cpp:551
void setEndModifID(int id)
Set id of a terminal modification (at the end of a spectrum).
Definition: cCandidate.cpp:825
bool checkKetideBlocks(cBricksDatabase &bricksdatabase, ePeptideType peptidetype, bool regularblocksorder)
Check if the numbers of H2 loss and H2O loss blocks are correct.
Definition: cCandidate.cpp:1455
void getPermutations(cCandidateSet &permutations, bool *terminatecomputation)
Get a set of candidates with permutations of bricks.
Definition: cCandidate.cpp:802
cSummaryFormula & getSummaryFormula()
Get the summary formula of the peptide sequence candidate.
Definition: cCandidate.cpp:1115
int getEndModifID()
Get id of a terminal modification (at the end of a spectrum).
Definition: cCandidate.cpp:820
string getRealNameTComposition(cBricksDatabase &brickdatabase)
Get a T-composition of a branched peptide composed from real names of bricks.
Definition: cCandidate.cpp:507
string & getComposition()
Access to the composition of the peptide sequence candidate.
Definition: cCandidate.cpp:270
void setBackboneAcronyms(cBricksDatabase &bricksdatabase)
Set a vector of acronyms corresponding to a backbone of a peptide sequence candidate.
Definition: cCandidate.cpp:1214
string & getPathAsString()
Get a path in the de novo graph corresponding to the candidate as a string.
Definition: cCandidate.cpp:1305
void clear()
Clear the candidate.
Definition: cCandidate.cpp:247
string getRevertedTComposition(bool usebrackets)
Get a reverted T-composition of a branched peptide.
Definition: cCandidate.cpp:431
bool hasLastBrickArtificial(cBricksDatabase &brickdatabasewithcombinations)
Check if the last brick is artificial.
Definition: cCandidate.cpp:942
eResidueLossType getRightResidueType(cBricksDatabase &bricksdatabase)
Get the residue type of the right-most building block.
Definition: cCandidate.cpp:1441
void load(ifstream &is)
Load the structure from an input stream.
Definition: cCandidate.cpp:1158
vector< nodeEdge > & getPath()
Get a path in the de novo graph corresponding to the peptide sequence candidate.
Definition: cCandidate.cpp:888
string getTComposition()
Get a T-composition of a branched peptide.
Definition: cCandidate.cpp:405
void setAcronymPeptideNameWithHTMLReferences(cBricksDatabase &bricksdatabase, ePeptideType peptidetype)
Set an acronym peptide name.
Definition: cCandidate.cpp:1332
cCandidate()
The default constructor.
Definition: cCandidate.cpp:187
void setSummaryFormula(cSummaryFormula &summary)
Set the summary formula of the peptide sequence candidate.
Definition: cCandidate.cpp:1121
void setAcronyms(cBricksDatabase &bricksdatabase)
Set a vector of acronyms corresponding to a peptide sequence candidate.
Definition: cCandidate.cpp:1200
void setRealPeptideName(cBricksDatabase &bricksdatabase, ePeptideType peptidetype)
Set a real peptide name.
Definition: cCandidate.cpp:1310
void revertComposition()
Reverse the bricks composition of the candidate.
Definition: cCandidate.cpp:275
eResidueLossType getLeftResidueType(cBricksDatabase &bricksdatabase)
Get the residue type of the left-most building block.
Definition: cCandidate.cpp:1427
bool hasOnlyArtificialBricks(cBricksDatabase &brickdatabasewithcombinations)
Check whether the candidate is composed exclusively from artificial bricks.
Definition: cCandidate.cpp:913
void setName(string &name)
Set the name of peptide.
Definition: cCandidate.cpp:1190
void store(ofstream &os)
Store the structure into an output stream.
Definition: cCandidate.cpp:1126
double calculatePrecursorMassFromBricks(cBricksDatabase &brickdatabasewithcombinations, cParameters *parameters)
Calculate the precursor mass of the peptide sequence candidate from bricks.
Definition: cCandidate.cpp:741
string getAcronymsTComposition(cBricksDatabase &brickdatabase)
Get a T-composition of a branched peptide composed from acronyms of bricks.
Definition: cCandidate.cpp:481
bool hasLastBrickInvalid(cBricksDatabase &brickdatabasewithcombinations)
Check if the last brick is invalid.
Definition: cCandidate.cpp:954
string & getAcronymPeptideNameWithHTMLReferences()
Get an acronym peptide name.
Definition: cCandidate.cpp:1359
int getStartModifID()
Get id of a terminal modification (at the beginning of a spectrum).
Definition: cCandidate.cpp:810
eFragmentIonType getStartIonType()
Get start ion type used in the de novo graph.
Definition: cCandidate.cpp:1369
void setBranchAcronyms(cBricksDatabase &bricksdatabase)
Set a vector of acronyms corresponding to a branch of a peptide sequence candidate.
Definition: cCandidate.cpp:1230
void setCandidate(vector< string > &composition, vector< nodeEdge > &path, eFragmentIonType startiontype, int startmodifID, int endmodifID, int middlemodifID, int middlepos)
Set a peptide sequence candidate.
Definition: cCandidate.cpp:204
void getRotations(vector< string > &rotations, bool includerevertedrotations)
Get rotations of a cyclic peptide sequence.
Definition: cCandidate.cpp:966
bool hasFirstBrickArtificial(cBricksDatabase &brickdatabasewithcombinations)
Check if the first brick is artificial.
Definition: cCandidate.cpp:930
The class representing a set of peptide sequence candidates.
Definition: cCandidateSet.h:18
The class implementing the de novo graph.
Definition: cDeNovoGraph.h:46
The class storing parameters of the application.
Definition: cParameters.h:82
The representation of a summary formula.
Definition: cSummaryFormula.h:59
An auxiliary structure representing a branch permutation of a branched peptide.
Definition: cCandidate.h:30
int startmodifID
Id of a terminal modification (at the beginning of a spectrum).
Definition: cCandidate.h:59
vector< int > bricks
Vector of ids of bricks.
Definition: cCandidate.h:41
string tcomposition
Ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7.
Definition: cCandidate.h:77
int middlebranchend
Position of a brick where a branch of a branched peptide ends.
Definition: cCandidate.h:53
int middlebranchstart
Position of a brick where a branch of a branched peptide starts.
Definition: cCandidate.h:47
bool endsWithBracket()
Test whether tcomposition ends with a bracket.
Definition: cCandidate.h:118
void clear()
Clear the structure.
Definition: cCandidate.h:91
bool startsWithBracket()
Test whether tcomposition starts with a bracket.
Definition: cCandidate.h:107
int id
Id of the rotation.
Definition: cCandidate.h:35
TRotationInfo()
The constructor.
Definition: cCandidate.h:83
int endmodifID
Id of a terminal modification (at the end of a spectrum).
Definition: cCandidate.h:65
int middlemodifID
Id of a terminal modification of a branched peptide (in the middle of a spectrum).
Definition: cCandidate.h:71
The structure defining a hash function of cCandidate.
Definition: cCandidate.h:648
size_t operator()(const cCandidate &candidate) const
Hash a peptide sequence candidate.
Definition: cCandidate.h:655
ePeptideType
The types of peptides supported by the application.
Definition: utilities.h:104