forked from mothur/mothur
/
seqnoise.h
71 lines (52 loc) · 2.84 KB
/
seqnoise.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
#ifndef SEQNOISE
#define SEQNOISE
/*
* mySeqNoise.h
*
*
* Created by Pat Schloss on 8/31/11.
* Copyright 2011 Patrick D. Schloss. All rights reserved.
*
*/
/*****************************************************************************************************************************/
/*****************************************************************************************************************************/
/* NOTE: Order matters in this class. If you are going to use it, make sure your files have the sequences in the same order. */
/*****************************************************************************************************************************/
/*****************************************************************************************************************************/
#include "mothurout.h"
/**************************************************************************************************/
struct freqData {
freqData(int i, int freq) : frequency(freq), index(i){ }
bool operator<( freqData const& rhs ) const {
return frequency < rhs.frequency;
}
int frequency;
int index;
};
/**************************************************************************************************/
class seqNoise {
public:
seqNoise() { m = MothurOut::getInstance(); }
~seqNoise(){}
int getSequenceData(string, vector<string>&);
int addSeq(string, vector<string>&);
int getRedundantNames(string, vector<string>&, vector<string>&, vector<int>&);
int addRedundantName(string, string, vector<string>&, vector<string>&, vector<int>&);
int getDistanceData(string, vector<double>&);
int getListData(string, double, vector<int>&, vector<int>&, vector<vector<int> >&);
int updateOTUCountData(vector<int>, vector<vector<int> >, vector<vector<int> >, vector<int>&, vector<int>&, vector<int>&);
double calcNewWeights(vector<double>&,vector<int>,vector<int>,vector<int>,vector<int>,vector<int>,vector<double>);
int calcCentroids(vector<int>,vector<int>,vector<int>&,vector<int>&,vector<int>,vector<double>,vector<int>,vector<int>,vector<double>);
int checkCentroids(vector<double>&, vector<int>);
int setUpOTUData(vector<int>&, vector<double>&, vector<int>, vector<double>, vector<int>, vector<int>, vector<int>);
int finishOTUData(vector<int>, vector<int>&, vector<int>&, vector<int>&, vector<int>&, vector<vector<int> >&, vector<vector<int> >&, vector<double>&);
int writeOutput(string, string, string, vector<int>, vector<int>, vector<int>, vector<string>, vector<string>, vector<string>, vector<int>, vector<double>&);
private:
MothurOut* m;
int getLastMatch(char, vector<vector<char> >&, int, int, vector<int>&, vector<int>&);
int countDiffs(vector<int>, vector<int>);
vector<int> convertSeq(string);
string degapSeq(string);
};
/**************************************************************************************************/
#endif