Skip to content

Commit

Permalink
Cleaned up the namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoopmann committed Oct 31, 2019
1 parent 7dc42a8 commit bc1d152
Show file tree
Hide file tree
Showing 33 changed files with 162 additions and 176 deletions.
30 changes: 11 additions & 19 deletions CAveragine.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ limitations under the License.
#include "CHardklorVariant.h"
#include "CPeriodicTable.h"

#include <cstdlib>
//#include <cstdlib>
#include <fstream>
#include <vector>
#include <cstring>

using namespace std;
#include <string>

/*
const double AVE_MASS = 111.1254;
Expand All @@ -47,22 +45,19 @@ const double AVE_S = 0.0390;
typedef struct atomInfo {
char symbol[3];
int numIsotopes;
vector<double> *mass;
vector<double> *abundance;
std::vector<double> *mass;
std::vector<double> *abundance;
atomInfo(){
strcpy(symbol,"X");
numIsotopes=0;
mass = new vector<double>;
abundance = new vector<double>;
mass = new std::vector<double>;
abundance = new std::vector<double>;
}
atomInfo(const atomInfo& a){
strcpy(symbol,a.symbol);
numIsotopes=a.numIsotopes;
mass = new vector<double>;
abundance = new vector<double>;
unsigned int i;
for(i=0;i<a.mass->size();i++) mass->push_back(a.mass->at(i));
for(i=0;i<a.abundance->size();i++) abundance->push_back(a.abundance->at(i));
mass = new std::vector<double>(*a.mass);
abundance = new std::vector<double>(*a.abundance);
}
~atomInfo(){
delete mass;
Expand All @@ -74,11 +69,8 @@ typedef struct atomInfo {
numIsotopes=a.numIsotopes;
delete mass;
delete abundance;
mass = new vector<double>;
abundance = new vector<double>;
unsigned int i;
for(i=0;i<a.mass->size();i++) mass->push_back(a.mass->at(i));
for(i=0;i<a.abundance->size();i++) abundance->push_back(a.abundance->at(i));
mass = new std::vector<double>(*a.mass);
abundance = new std::vector<double>(*a.abundance);
}
return *this;
}
Expand Down Expand Up @@ -110,7 +102,7 @@ class CAveragine {
//Data Members:
int *atoms;
CPeriodicTable *PT;
vector<atomInfo> *enrich;
std::vector<atomInfo> *enrich;

};

Expand Down
3 changes: 2 additions & 1 deletion CHardklor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ limitations under the License.
#include "CSpecAnalyze.h"
#include "Smooth.h"
#include <iomanip>
using namespace std;

using namespace std;
using namespace MSToolkit;

SSObject::SSObject(){
pepVar = new vector<sInt>;
Expand Down
20 changes: 9 additions & 11 deletions CHardklor.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ limitations under the License.
#include <sys/time.h>
#endif

using namespace std;

#define PminusE 1.00672791

class SSObject {
public:
//Data members
vector<sInt> *pepVar;
std::vector<sInt> *pepVar;
double corr;

//Constructors & Destructors
Expand Down Expand Up @@ -76,7 +74,7 @@ class CHardklor{

//Methods:
void Echo(bool b);
int GoHardklor(CHardklorSetting sett, Spectrum* s=NULL);
int GoHardklor(CHardklorSetting sett, MSToolkit::Spectrum* s=NULL);
void SetAveragine(CAveragine *a);
void SetMercury(CMercury8 *m);
void SetResultsToMemory(bool b);
Expand All @@ -86,14 +84,14 @@ class CHardklor{

private:
//Methods:
void Analyze(Spectrum* s=NULL);
void Analyze(MSToolkit::Spectrum* s=NULL);
bool AnalyzePeaks(CSpecAnalyze& sa);
int compareData(const void*, const void*);
double LinReg(float *match, float *mismatch);
void ResultToMem(SSObject& obj, CPeriodicTable* PT);
void WriteParams(fstream& fptr, int format=1);
void WritePepLine(SSObject& obj, CPeriodicTable* PT, fstream& fptr, int format=0);
void WriteScanLine(Spectrum& s, fstream& fptr, int format=0);
void WriteParams(std::fstream& fptr, int format = 1);
void WritePepLine(SSObject& obj, CPeriodicTable* PT, std::fstream& fptr, int format = 0);
void WriteScanLine(MSToolkit::Spectrum& s, std::fstream& fptr, int format = 0);

//Finished analysis algorithms
void BasicMethod(float *match, float *mismatch,SSObject* combo, int depth, int maxDepth, int start);
Expand All @@ -120,13 +118,13 @@ class CHardklor{
bool bEcho;
bool bMem;
int currentScanNumber;
fstream fptr; //TODO: Get rid of this and use FILE* instead.
std::fstream fptr; //TODO: Get rid of this and use FILE* instead.

//Vector for holding peptide list of distribution
vector<CHardklorVariant> pepVariants;
std::vector<CHardklorVariant> pepVariants;

//Vector for holding results in memory should that be needed
vector<hkMem> vResults;
std::vector<hkMem> vResults;

//Temporary Data Members:
char bestCh[200];
Expand Down
4 changes: 4 additions & 0 deletions CHardklor2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ 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.
*/

#include "CHardklor2.h"

using namespace std;
using namespace MSToolkit;

CHardklor2::CHardklor2(CAveragine *a, CMercury8 *m, CModelLibrary *lib){
averagine=a;
mercury=m;
Expand Down
52 changes: 25 additions & 27 deletions CHardklor2.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ limitations under the License.
#include <sys/time.h>
#endif

using namespace std;

class CHardklor2{

public:
Expand All @@ -52,46 +50,46 @@ class CHardklor2{

//Methods:
void Echo(bool b);
int GoHardklor(CHardklorSetting sett, Spectrum* s=NULL);
void QuickCharge(Spectrum& s, int index, vector<int>& v);
int GoHardklor(CHardklorSetting sett, MSToolkit::Spectrum* s=NULL);
void QuickCharge(MSToolkit::Spectrum& s, int index, std::vector<int>& v);
void SetResultsToMemory(bool b);
int Size();

protected:

private:
//Methods:
int BinarySearch(Spectrum& s, double mz, bool floor);
int BinarySearch(MSToolkit::Spectrum& s, double mz, bool floor);
double CalcFWHM(double mz,double res,int iType);
void Centroid(Spectrum& s, Spectrum& out);
bool CheckForPeak(vector<Result>& vMR, Spectrum& s, int index);
void Centroid(MSToolkit::Spectrum& s, MSToolkit::Spectrum& out);
bool CheckForPeak(std::vector<Result>& vMR, MSToolkit::Spectrum& s, int index);
int CompareData(const void*, const void*);
double LinReg(vector<float>& mer, vector<float>& obs);
bool MatchSubSpectrum(Spectrum& s, int peakIndex, pepHit& pep);
double PeakMatcher(vector<Result>& vMR, Spectrum& s, double lower, double upper, double deltaM, int matchIndex, int& matchCount, int& indexOverlap, vector<int>& vMatchIndex, vector<float>& vMatchIntensity);
double PeakMatcherB(vector<Result>& vMR, Spectrum& s, double lower, double upper, double deltaM, int matchIndex, int& matchCount, vector<int>& vMatchIndex, vector<float>& vMatchIntensity);
void QuickHardklor(Spectrum& s, vector<pepHit>& vPeps);
void RefineHits(vector<pepHit>& vPeps, Spectrum& s);
void ResultToMem(pepHit& ph, Spectrum& s);
void WritePepLine(pepHit& ph, Spectrum& s, FILE* fptr, int format=0);
void WriteScanLine(Spectrum& s, FILE* fptr, int format=0);
double LinReg(std::vector<float>& mer, std::vector<float>& obs);
bool MatchSubSpectrum(MSToolkit::Spectrum& s, int peakIndex, pepHit& pep);
double PeakMatcher(std::vector<Result>& vMR, MSToolkit::Spectrum& s, double lower, double upper, double deltaM, int matchIndex, int& matchCount, int& indexOverlap, std::vector<int>& vMatchIndex, std::vector<float>& vMatchIntensity);
double PeakMatcherB(std::vector<Result>& vMR, MSToolkit::Spectrum& s, double lower, double upper, double deltaM, int matchIndex, int& matchCount, std::vector<int>& vMatchIndex, std::vector<float>& vMatchIntensity);
void QuickHardklor(MSToolkit::Spectrum& s, std::vector<pepHit>& vPeps);
void RefineHits(std::vector<pepHit>& vPeps, MSToolkit::Spectrum& s);
void ResultToMem(pepHit& ph, MSToolkit::Spectrum& s);
void WritePepLine(pepHit& ph, MSToolkit::Spectrum& s, FILE* fptr, int format=0);
void WriteScanLine(MSToolkit::Spectrum& s, FILE* fptr, int format=0);

static int CompareBPI(const void *p1, const void *p2);

//Data Members:
CHardklorSetting cs;
CAveragine* averagine;
CMercury8* mercury;
CModelLibrary* models;
CPeriodicTable* PT;
Spectrum mask;
hkMem hkm;
bool bEcho;
bool bMem;
int currentScanNumber;
CHardklorSetting cs;
CAveragine* averagine;
CMercury8* mercury;
CModelLibrary* models;
CPeriodicTable* PT;
MSToolkit::Spectrum mask;
hkMem hkm;
bool bEcho;
bool bMem;
int currentScanNumber;

//Vector for holding results in memory should that be needed
vector<hkMem> vResults;
std::vector<hkMem> vResults;

//Temporary Data Members:
char bestCh[200];
Expand Down
10 changes: 5 additions & 5 deletions CHardklorFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class CHardklorFileReader {
int posNR;
CHardklorSetting cs;
CNoiseReduction nr;
MSReader r;
deque<Spectrum> sNative;
deque<Spectrum> sNR;
MSToolkit::MSReader r;
std::deque<MSToolkit::Spectrum> sNative;
std::deque<MSToolkit::Spectrum> sNR;

deque<cpar> dc;
std::deque<cpar> dc;

vector<int> vScans;
std::vector<int> vScans;

};
2 changes: 2 additions & 0 deletions CHardklorOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.
*/
#include "CHardklorOutput.h"

using namespace std;

bool CHardklorOutput::openFile(char* fileName, hkOutputFormat format){

if(outFile!=NULL) closeFile();
Expand Down
2 changes: 0 additions & 2 deletions CHardklorOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ limitations under the License.
#include "HardklorTypes.h"
#include <iostream>

using namespace std;

class CHardklorOutput {
public:

Expand Down
1 change: 1 addition & 0 deletions CHardklorParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#include "CHardklorParser.h"

using namespace std;
using namespace MSToolkit;

CHardklorParser::CHardklorParser(){
vQueue = new vector<CHardklorSetting>;
Expand Down
6 changes: 2 additions & 4 deletions CHardklorParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ limitations under the License.
#include "CPeriodicTable.h"
#include "MSToolkitTypes.h"

using namespace std;

class CHardklorParser {

public:
Expand All @@ -38,7 +36,7 @@ class CHardklorParser {
void parse(char*);
bool parseCMD(int argc, char* argv[]);
bool parseConfig(char*);
MSFileFormat getFileFormat(char* c);
MSToolkit::MSFileFormat getFileFormat(char* c);
CHardklorSetting& queue(int);
int size();

Expand All @@ -51,7 +49,7 @@ class CHardklorParser {

//Data Members
CHardklorSetting global;
vector<CHardklorSetting> *vQueue;
std::vector<CHardklorSetting> *vQueue;
};


Expand Down
4 changes: 1 addition & 3 deletions CHardklorProtein.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ limitations under the License.

#include "HardklorTypes.h"

using namespace std;

class CHardklorProtein {
public:
//Constructors & Destructors:
Expand Down Expand Up @@ -51,7 +49,7 @@ class CHardklorProtein {
protected:
private:
//Data Members:
vector<sEnrichMercury> *enrich;
std::vector<sEnrichMercury> *enrich;

};

Expand Down
1 change: 1 addition & 0 deletions CHardklorSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
#include "CHardklorSetting.h"

using namespace std;
using namespace MSToolkit;

CHardklorSetting::CHardklorSetting(){
noBase=false;
Expand Down
9 changes: 3 additions & 6 deletions CHardklorSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ limitations under the License.
#define _CHARDKLORSETTING_H

#include <cstdio>
#include <cstring>
#include <string>
#include <vector>

#include "HardklorTypes.h"
#include "CHardklorVariant.h"

using namespace std;

/*
Defined as a class instead of a struct so
that default parameters are used. Data access
Expand Down Expand Up @@ -94,9 +91,9 @@ class CHardklorSetting {

specType msType; //Type of mass spectrometer used to acquire data
hkAlgorithm algorithm; //Deconvolving algorithm to use
vector<CHardklorVariant> *variant; //Variants to make to averagine
MSFileFormat fileFormat; //File format
MSSpectrumType mzXMLFilter; //Filter for mzXML files
std::vector<CHardklorVariant> *variant; //Variants to make to averagine
MSToolkit::MSFileFormat fileFormat; //File format
MSToolkit::MSSpectrumType mzXMLFilter; //Filter for mzXML files

protected:
private:
Expand Down
8 changes: 3 additions & 5 deletions CHardklorVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ limitations under the License.

#include "HardklorTypes.h"

using namespace std;

class CHardklorVariant {
public:
//Constructors & Destructors:
Expand Down Expand Up @@ -50,9 +48,9 @@ class CHardklorVariant {
protected:

private:
//Data Members:
vector<sInt> *atoms;
vector<sEnrichMercury> *enrich;
//Data Members:
std::vector<sInt> *atoms;
std::vector<sEnrichMercury> *enrich;

};

Expand Down
Loading

0 comments on commit bc1d152

Please sign in to comment.