-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMIons.h
139 lines (113 loc) · 4.53 KB
/
MIons.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
Copyright 2018, Michael R. Hoopmann, Institute for Systems Biology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MIONS_H
#define _MIONS_H
#include "MStructs.h"
//#include "MIonSet.h"
#include <map>
#include <vector>
typedef struct mModPos{
int pos; //position of aa to add
int mod; //index of mods at this position
int modCount; //total mods prior to this position
double mass; //total mass prior to this position
double modMass; //total mod mass prior to this position
} mModPos;
typedef struct mModType{
bool xl;
double mass;
} mModType;
//max 10 mods per amino acid
typedef struct mMod{
int count;
mModType mod[10];
} mMod;
class MIons {
public:
MIons();
~MIons();
//Functions
void addFixedMod (char mod, double mass);
void addMod (char mod, bool xl, double mass);
void addPeak (double mass, bool adduct, size_t& node, bool& ar, size_t& index); //could be private?
void addPeakRev (double mass, bool adduct, size_t& node, bool& ar, size_t& index); //could be private?
//void buildIons ();
//void buildModIons (int modSite);
void buildModIons2 (bool bAdduct=true);
double getAAMass (char aa);
double getFixedModMass (char aa);
//void modIonsRec (int start, int link, int index, int depth, bool xl);
//void modIonsRec2 (int start, int link, int index, int depth, bool xl);
void modIonsRec4 (int pos, double mMass, int oSite, size_t pepNum, int depth, int modSite, size_t linkNode, bool linkAr, size_t linkIndex, std::string mask); //could be private?
void modIonsRec4Rev (int pos, double mMass, int oSite, size_t pepNum, int depth, int modSite, size_t linkNode, bool linkAr, size_t linkIndex, std::string mask); //could be private?
void modIonsRec5 (int pos, double mMass, size_t pepNum, int depth, int modSite, size_t linkNode, bool linkAr, size_t linkIndex, std::string mask);
void modIonsRec5Rev (int pos, double mMass, size_t pepNum, int depth, int modSite, size_t linkNode, bool linkAr, size_t linkIndex, std::string mask);
//void reset ();
//Accessors
//MIonSet& operator[ ] (const int& i);
//MIonSet* at (const int& i);
int getIonCount ();
double getModMass (int index);
int getModMassSize();
double* getMods ();
void getPeptide (char* seq);
int getPeptideLen ();
void getPeptideMods(std::vector<mPepMod>& v);
//int size ();
//Modifiers
void setAAMass (char aa, double mass);
void setMaxModCount (int i);
void setPeptide (char* seq, int len, double mass, bool nTerm, bool cTerm);
//Data Members
double* modList;
bool site[128]; //possible sites of linkage based on parameters
//New data members for tree search
std::vector<sNode2>* peaks;
std::vector<sNode2>* peaksRev;
std::map<int, size_t> mP; //could be private
std::map<int, size_t> mPRev; //could be private
std::map<std::string,size_t> mPrecursor;
std::string modMask; //could be private
size_t pepCount;
std::vector<int> pepLinks;
std::vector<double> pepMass;
std::vector<sPepModSet> pepMods;
double pepMassMin;
double pepMassMax;
int maxLink;
private:
void addModIonSet(int index, char aa, int pos, int modIndex, int loopPos=-1);
void buildSeries(int setNum);
void clearSeries();
double aaMass[128];
double aaFixedModMass[128];
mMod aaMod[128]; //inefficient memory usage, but not by much in the grand scheme.
double protFixedModMassC;
double protFixedModMassN;
mMod protModMassC;
mMod protModMassN;
double pep1Mass;
int modIndex;
int ionCount;
int maxModCount;
int pep1Len;
char* pep1;
bool nPep1; //peptide has protein n-terminus
bool cPep1; //peptide has protein c-terminus
std::vector<mModPos> modQueue;
std::vector<double> modMassArray;
//std::vector<MIonSet> sets;
//Utilities
static int compareD(const void *p1,const void *p2);
};
#endif