forked from mhoopmann/kojak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KIons.h
134 lines (107 loc) · 3.9 KB
/
KIons.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
/*
Copyright 2014, 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 _KIONS_H
#define _KIONS_H
#include "KStructs.h"
#include "KIonSet.h"
#include <vector>
typedef struct kModPos{
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
} kModPos;
typedef struct kModType{
bool xl;
double mass;
} kModType;
//max 10 mods per amino acid
typedef struct kMod{
int count;
kModType mod[10];
} kMod;
class KIons {
public:
KIons();
~KIons();
//Functions
void addFixedMod (char mod, double mass);
void addMod (char mod, bool xl, double mass);
void buildIons ();
void buildLoopIons (double linkMass, int link1, int link2);
void buildSingletIons (int link);
double getAAMass (char aa, bool n15=false);
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 modLoopIonsRec (int start, int link, int link2, int index, int depth, bool xl);
void modLoopIonsRec2 (int start, int link, int link2, int index, int depth, bool xl);
void reset ();
//Accessors
KIonSet& operator[ ] (const int& i);
KIonSet* at (const int& i);
int getIonCount ();
double getModMass (int index);
int getModMassSize();
double* getMods ();
void getPeptide (bool bPepOne, char* seq);
int getPeptideLen ();
void getPeptideMods(std::vector<kPepMod>& v);
int size ();
//Modifiers
void setAAMass (char aa, double mass, bool n15=false);
void setMaxModCount (int i);
void setModFlags (bool monoMods, bool difMods);
void setPeptide (bool bPepOne, char* seq, int len, double mass, bool nTerm, bool cTerm, bool n15);
//Data Members
double* modList;
bool site[128]; //possible sites of linkage based on parameters
//bool linkN;
//bool linkC;
private:
void addModIonSet(int index, char aa, int pos, int modIndex, int loopPos=-1);
void buildSeries(int setNum);
void clearSeries();
double aaMass[128];
double aaMassn15[128];
double aaFixedModMass[128];
kMod aaMod[128]; //inefficient memory usage, but not by much in the grand scheme.
double protFixedModMassC;
double protFixedModMassN;
kMod protModMassC;
kMod protModMassN;
bool monoModsOnXL;
bool diffModsOnXL;
double pep1Mass;
double pep2Mass;
int modIndex;
int ionCount;
int maxModCount;
int pep1Len;
int pep2Len;
char* pep1;
char* pep2;
bool n15Pep1; //if peptide is of the 15N-labeled variety;
bool n15Pep2;
bool nPep1; //peptide has protein n-terminus
bool nPep2; //peptide has protein n-terminus
bool cPep1; //peptide has protein c-terminus
bool cPep2; //peptide has protein c-terminus
std::vector<kModPos> modQueue;
std::vector<double> modMassArray;
std::vector<KIonSet> sets;
//Utilities
static int compareD(const void *p1,const void *p2);
};
#endif