-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSpectrum.h
184 lines (150 loc) · 5.73 KB
/
MSpectrum.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
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 _MSPECTRUM_H
#define _MSPECTRUM_H
#include <algorithm>
#include <cmath>
#include <list>
#include <vector>
#include "MHistogram.h"
#include "MStructs.h"
#include "MTopPeps.h"
#include "CometDecoys.h"
#define HISTOSZ 152
typedef struct sHistoPep {
int pepIndex;
int topScore;
} sHistoPep;
class MSpectrum {
public:
//Constructors & Destructors
//MSpectrum(const int& i, const double& bs, const double& os, const int& th);
MSpectrum(mParams& p);
MSpectrum(const MSpectrum& p);
~MSpectrum();
//Operators
MSpectrum& operator=(const MSpectrum& p);
mSpecPoint& operator[](const int& i);
//Data Members
mSparseMatrix* xCorrSparseArray;
int xCorrSparseArraySize;
char** kojakSparseArray;
int kojakBins;
int peakCounts;
double lowScore;
int cc;
int sc;
//Accessors
double getBinOffset ();
int getCharge ();
bool getInstrumentPrecursor();
double getInvBinSize ();
float getMaxIntensity ();
double getMZ ();
mPrecursor& getPrecursor (int i);
mPrecursor* getPrecursor2 (int i);
float getRTime ();
int getScanNumber ();
mScoreCard& getScoreCard (int i);
int getSingletCount ();
mScoreCard& getSingletScoreCard (int i);
MTopPeps* getTopPeps (int index);
int size ();
int sizePrecursor ();
mScoreCard* singletFirst; //pointer to start of linked list
mScoreCard* singletLast; //pointer to end of linked list
int singletMax;
int hpSize;
sHistoPep* hp;
int histogram[HISTOSZ];
int histogramCount;
int histoMaxIndex;
//** temporary
//int hX[60][HISTOSZ];
//int hXCount[60];
//void tHistogram(double score, int len);
//void exportHisto();
//**
MHistogram** mHisto;
MDecoys* decoys;
double computeE(double score, int len);
bool ionSeries[6];
int maxHistogramCount;
double minAdductMass;
int maxPepLen;
double bigMonoMass;
int bigZ;
//Modifiers
void addPoint (mSpecPoint& s);
void addPrecursor (mPrecursor& p, int sz);
void clear ();
void clearPrecursors();
void erasePrecursor (int i);
void setCharge (int i);
void setInstrumentPrecursor (bool b);
void setMaxIntensity (float f);
void setMZ (double d);
void setNativeID(std::string s);
void setPrecursor (double d, int i);
void setRTime (float f);
void setScanNumber (int i);
//Functions
bool calcEValue(mParams* params, MDecoys& decoys);
bool checkReporterIon(double mz,mParams* params);
void checkScore(mScoreCard& s, int th);
//void checkSingletScore (mScoreCard& s);
bool generateXcorrDecoys(mParams* params, MDecoys& decoys);
bool generateXcorrDecoys2(int maxPepLen);
bool generateXcorrDecoys3(int minP, int maxP, int depth);
void linearRegression(double& slope, double& intercept, int& iMaxXcorr, int& iStartXcorr, int& iNextXcorr);
void linearRegression2(double& slope, double& intercept, int& iMaxXcorr, int& iStartXcorr, int& iNextXcorr, double& rSquared);
void linearRegression3(double& slope, double& intercept, double& rSquared);
void linearRegression4(int* h, int sz, double& slope, double& intercept, double& rSquared);
double makeXCorrB(int decoyIndex, double modMass, int maxZ, int len, int offset=0);
double makeXCorrY(int decoyIndex, double modMass, int maxZ, int len, int offset=0);
void resetSingletList ();
void shortResults(std::vector<mScoreCard2>& v);
void shortResults2(std::vector<mScoreCard3>& v);
void sortMZ ();
void sortIntensityRev() { sort(spec->begin(), spec->end(), compareIntensityRev); }
//void xCorrScore ();
void kojakXCorr(double* pdTempRawData, double* pdTmpFastXcorrData, float* pfFastXcorrData, mPreprocessStruct*& pPre);
private:
//Data members
double binOffset;
double binSize;
int charge;
bool instrumentPrecursor;
double invBinSize;
float maxIntensity;
double mz;
std::string nativeID;
std::vector<mPrecursor>* precursor;
float rTime;
int scanNumber;
int singletCount;
int maxX;
std::vector<MTopPeps>* singlets;
std::vector<mSpecPoint>* spec;
mScoreCard topHit[20];
int xCorrArraySize;
//Functions
void BinIons (mPreprocessStruct *pPre);
void MakeCorrData (double *pdTempRawData, mPreprocessStruct *pPre, double scale);
bool matchMods (mPepMod2& v1, std::vector<mPepMod>& v2);
//Utilities
static int compareIntensity (const void *p1,const void *p2);
static bool compareIntensityRev(const mSpecPoint& p1, const mSpecPoint& p2) { return p1.intensity>p2.intensity; }
static int compareMZ (const void *p1,const void *p2);
};
#endif