]> git.donarmstrong.com Git - mothur.git/blob - shhhercommand.h
mods to shhh.seqs command
[mothur.git] / shhhercommand.h
1 #ifndef SHHHER_H
2 #define SHHHER_H
3
4 /*
5  *  shhher.h
6  *  Mothur
7  *
8  *  Created by Pat Schloss on 12/27/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14 #include "command.hpp"
15 #include "globaldata.hpp"
16
17 class ShhherCommand : public Command {
18         
19 public:
20         ShhherCommand(string);
21         ShhherCommand();
22         ~ShhherCommand();
23         vector<string> getRequiredParameters();
24         vector<string> getValidParameters();
25         vector<string> getRequiredFiles();
26         map<string, vector<string> > getOutputFiles() { return outputTypes; }
27         int execute();
28         void help();
29         
30 private:
31         GlobalData* globaldata;
32         
33         int abort;
34         map<string, vector<string> > outputTypes;
35         
36         string outputDir, flowFileName, flowFilesFileName, lookupFileName, compositeFASTAFileName;
37
38         int processors, maxIters;
39         float cutoff, sigma, minDelta;
40         
41         vector<int> nSeqsBreaks;
42         vector<int> nOTUsBreaks;
43         vector<double> singleLookUp;
44         vector<double> jointLookUp;
45         
46         vector<string> seqNameVector;
47         vector<int> lengths;
48         vector<short> flowDataIntI;
49         vector<double> flowDataPrI;
50         map<string, int> nameMap;
51         vector<int> otuData;
52         vector<int> cumNumSeqs;
53         vector<int> nSeqsPerOTU;
54         vector<vector<int> > aaP;       //tMaster->aanP:        each row is a different otu / each col contains the sequence indices
55         vector<vector<int> > aaI;       //tMaster->aanI:        that are in each otu - can't differentiate between aaP and aaI 
56         vector<int> seqNumber;          //tMaster->anP:         the sequence id number sorted by OTU
57         vector<int> seqIndex;           //tMaster->anI;         the index that corresponds to seqNumber
58         vector<double> dist;            //adDist - distance of sequences to centroids
59         vector<short> change;           //did the centroid sequence change? 0 = no; 1 = yes
60         vector<int> centroids;          //the representative flowgram for each cluster m
61         vector<double> weight;
62         vector<double> singleTau;       //tMaster->adTau:       1-D Tau vector (1xnumSeqs)
63         vector<short> uniqueFlowgrams;
64         vector<int> uniqueCount;
65         vector<int> mapSeqToUnique;
66         vector<int> mapUniqueToSeq;
67         vector<int> uniqueLengths;
68         
69         int numSeqs, numUniques, numOTUs, numFlowCells;
70         
71         void getSingleLookUp();
72         void getJointLookUp();
73         void getFlowData();
74         void getUniques();
75         double getProbIntensity(int);
76         float calcPairwiseDist(int, int);
77         void flowDistParentFork(string, int, int);
78         
79         string createDistFile(int);
80         string createNamesFile();
81         string cluster(string, string);
82         
83         void getOTUData(string);
84         void initPyroCluster();
85         void fill();
86         void calcCentroids();
87         void calcCentroidsDriver(int, int);
88         double getDistToCentroid(int, int, int);
89         double getNewWeights();
90         double getLikelihood();
91         void checkCentroids();
92         void calcNewDistances();
93         void calcNewDistancesParent(int, int);
94         void calcNewDistancesChild(int, int, vector<int>&, vector<int>&, vector<double>&);
95
96
97         void setOTUs();
98         void writeQualities(vector<int>);
99         void writeSequences(vector<int>);
100         void writeNames(vector<int>);
101         void writeGroups();
102         void writeClusters(vector<int>);
103
104         
105 #ifdef USE_MPI
106         string flowDistMPI(int, int);
107         void calcNewDistancesChildMPI(int, int, vector<int>&);
108
109         int pid, ncpus; 
110 #endif
111         
112 };
113
114
115 #endif
116