1 //
2 //  optifitcluster.hpp
3 //  Mothur
4 //
5 //  Created by Sarah Westcott on 5/10/18.
6 //  Copyright © 2018 Schloss Lab. All rights reserved.
7 //
8 
9 #ifndef optifitcluster_hpp
10 #define optifitcluster_hpp
11 
12 #include "cluster.hpp"
13 #include "optimatrix.h"
14 #include "calculator.h"
15 #include "mcc.hpp"
16 #include "sensitivity.hpp"
17 #include "specificity.hpp"
18 #include "fdr.hpp"
19 #include "npv.hpp"
20 #include "ppv.hpp"
21 #include "f1score.hpp"
22 #include "tp.hpp"
23 #include "fp.hpp"
24 #include "fpfn.hpp"
25 #include "tptn.hpp"
26 #include "tn.hpp"
27 #include "fn.hpp"
28 #include "accuracy.hpp"
29 #include "opticluster.h"
30 
31 /***********************************************************************/
32 
33 class OptiFitCluster : public Cluster {
34 
35 public:
36 
37     OptiFitCluster(OptiData* mt, ClusterMetric* met, long long ns, string crit);
~OptiFitCluster()38     ~OptiFitCluster() {}
39 
40     int initialize(double& value, bool randomize, vector<vector< string > > existingBins, vector<string>, string, bool);
41     bool update(double&); //returns whether list changed and MCC
updateDistance(PDistCell & colCell,PDistCell & rowCell)42     bool updateDistance(PDistCell& colCell, PDistCell& rowCell) { return false; } //inheritance compliant
getTag()43     string getTag() { string tag = "optifit_" + metric->getName(); return tag; }
44     long long getNumBins();
45     long long getNumFitBins();
46 
47     vector<double>  getStats( double&, double&,  double&,  double&);  //combo stats
48     vector<double>  getFitStats( double&,  double&,  double&,  double&); //fitted seqs stats
49 
50     ListVector* getList();
51     ListVector* getFittedList(string, bool);
getUnfittedNames()52     set<string> getUnfittedNames() { return unfittedNames; }
53 
54 protected:
55     MothurOut* m;
56     Utils util;
57     ClusterMetric* metric;
58     OptiData* matrix;
59     string criteria;
60 
61     map<long long, long long> seqBin; //sequence# -> bin#
62     vector<long long> randomizeSeqs;
63     vector< vector<long long> > bins; //bin[0] -> seqs in bin[0]
64     map<long long, string> binLabels; //for fitting - maps binNumber to existing reference label
65     long long maxRefBinNumber;
66     bool closed, denovo;
67     set<string> unfittedNames;
68 
69     double fittruePositives, fittrueNegatives, fitfalsePositives, fitfalseNegatives, combotruePositives, combotrueNegatives, combofalsePositives, combofalseNegatives;
70     long long  numFitSeqs, insertLocation, numFitSingletons;
71     long long  numComboSeqs, numComboSingletons;
72 
73     int findInsert();
74     vector<double> getCloseFarCounts(long long seq, long long newBin);
75     vector<double> getCloseFarFitCounts(long long seq, long long newBin);
76     ListVector* clusterUnfitted(OptiData*, string);
77 
78 };
79 
80 
81 #endif /* optifitcluster_hpp */
82