]> git.donarmstrong.com Git - mothur.git/blob - fullmatrix.h
changes while testing
[mothur.git] / fullmatrix.h
1 #ifndef FULLMATRIX_H
2 #define FULLMATRIX_H
3 /*
4  *  fullmatrix.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 3/6/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 #include "mothur.h"
13 #include "groupmap.h"
14 #include "progress.hpp"
15
16
17 struct Names {
18         string          seqName;
19         string          groupName;
20 };
21
22 class FullMatrix {
23         
24 public:
25         //FullMatrix(){ m = MothurOut::getInstance(); }
26         FullMatrix(ifstream&, GroupMap*, bool);
27         ~FullMatrix(){};
28         
29         int getNumSeqs();
30         vector<int> getSizes();
31         vector<string> getGroups();
32         void setGroups(vector<string> names) { groups = names;  }
33         void setSizes(vector<int> s)             { sizes = s;           }
34         int getNumGroups();
35         void printMatrix(ostream&);
36         float get(int, int);
37         Names getRowInfo(int row)  {  return index[row];  }
38         
39 private:
40         vector< vector<float> > matrix;  //a 2D distance matrix of all the sequences and their distances to eachother.
41         int readSquareMatrix(ifstream&);  
42         int readLTMatrix(ifstream&);
43         vector<Names> index; // row in vector, sequence group.  need to know this so when we sort it can be updated.
44         vector<int> sizes;
45         vector<string> groups;
46         
47         void sortGroups(int, int);  //this function sorts the sequences within the matrix.
48         void swapRows(int, int);
49         
50         GroupMap* groupmap;  //maps sequences to groups they belong to.
51         int numSeqs;
52         int numGroups;
53         int numUserGroups;
54         bool sim;
55         MothurOut* m;
56 };
57
58 #endif