]> git.donarmstrong.com Git - mothur.git/blob - fullmatrix.h
fixed some bugs and added mgcluster command
[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 "globaldata.hpp"
15 #include "progress.hpp"
16
17
18 struct Names {
19         string          seqName;
20         string          groupName;
21 };
22
23 class FullMatrix {
24         
25 public:
26         FullMatrix(){};
27         FullMatrix(ifstream&);
28         ~FullMatrix(){};
29         
30         int getNumSeqs();
31         vector<int> getSizes();
32         vector<string> getGroups();
33         void setGroups(vector<string> names) { groups = names;  }
34         void setSizes(vector<int> s)             { sizes = s;           }
35         int getNumGroups();
36         void printMatrix(ostream&);
37         float get(int, int);
38         Names getRowInfo(int row)  {  return index[row];  }
39         
40 private:
41         vector< vector<float> > matrix;  //a 2D distance matrix of all the sequences and their distances to eachother.
42         void readSquareMatrix(ifstream&);  
43         void readLTMatrix(ifstream&);
44         vector<Names> index; // row in vector, sequence group.  need to know this so when we sort it can be updated.
45         vector<int> sizes;
46         vector<string> groups;
47         
48         void sortGroups(int, int);  //this function sorts the sequences within the matrix.
49         void swapRows(int, int);
50         
51         GroupMap* groupmap;  //maps sequences to groups they belong to.
52         int numSeqs;
53         int numGroups;
54         int numUserGroups;
55         GlobalData* globaldata;
56 };
57
58 #endif