]> git.donarmstrong.com Git - mothur.git/blob - readblast.h
fixed some bugs and added mgcluster command
[mothur.git] / readblast.h
1 #ifndef READBLAST_H
2 #define READBLAST_H
3 /*
4  *  readblast.h
5  *  Mothur
6  *
7  *  Created by westcott on 12/10/09.
8  *  Copyright 2009 Schloss Lab. All rights reserved.
9  *
10  */
11
12 #include "mothur.h"
13 #include "sparsematrix.hpp"
14 #include "nameassignment.hpp"
15
16 /****************************************************************************************/
17 struct DistNode {
18         int seq1;
19         int seq2;
20         float dist;
21         DistNode(int s1, int s2, float d) : seq1(s1), seq2(s2), dist(d) {}
22         DistNode() {}
23         ~DistNode() {}
24 };
25 /****************************************************************************************/
26
27 //Note: this class creates a sparsematrix and list if the read is executed, but does not delete them on deconstruction.
28 //the user of this object is responsible for deleting the matrix and list if they call the read or there will be a memory leak
29 //it is done this way so the read can be deleted and the information still used.
30
31 class ReadBlast {
32         
33 public:
34         ReadBlast(string, float, float, int, bool, bool); //blastfile, cutoff, penalty, length of overlap, min or max bsr, hclusterWanted
35         ~ReadBlast() {}
36         
37         void read(NameAssignment*);
38         SparseMatrix* getDistMatrix()           {       return matrix;          }
39         vector<DistNode> getOverlapMatrix()     {       return overlap;         }
40         string getOverlapFile()                         {       return overlapFile;     }
41         string getDistFile()                            {       return distFile;        }
42         
43 private:
44         string blastfile, overlapFile, distFile;
45         int length;     //number of amino acids overlapped
46         float penalty, cutoff;  //penalty is used to adjust error rate
47         bool minWanted;  //if true choose min bsr, if false choose max bsr
48         bool hclusterWanted;
49         
50         SparseMatrix* matrix;
51         vector<DistNode> overlap;
52         
53         void readNames(NameAssignment*);
54 };
55
56 /*******************************************************************************************/
57
58 #endif
59