8 * Created by Pat Schloss on 12/27/10.
9 * Copyright 2010 Schloss Lab. All rights reserved.
14 #include "command.hpp"
17 class ShhherCommand : public Command {
20 ShhherCommand(string);
24 vector<string> setParameters();
25 string getCommandName() { return "shhh.seqs"; }
26 string getCommandCategory() { return "Hidden"; }
27 string getHelpString();
28 string getCitation() { return "no citation"; }
29 string getDescription() { return "shhh.seqs"; }
33 void help() { m->mothurOut(getHelpString()); }
38 string outputDir, flowFileName, flowFilesFileName, lookupFileName, compositeFASTAFileName, compositeNamesFileName;
40 int processors, maxIters;
41 float cutoff, sigma, minDelta;
44 vector<int> nSeqsBreaks;
45 vector<int> nOTUsBreaks;
46 vector<double> singleLookUp;
47 vector<double> jointLookUp;
49 vector<string> seqNameVector;
51 vector<short> flowDataIntI;
52 vector<double> flowDataPrI;
53 map<string, int> nameMap;
55 vector<int> cumNumSeqs;
56 vector<int> nSeqsPerOTU;
57 vector<vector<int> > aaP; //tMaster->aanP: each row is a different otu / each col contains the sequence indices
58 vector<vector<int> > aaI; //tMaster->aanI: that are in each otu - can't differentiate between aaP and aaI
59 vector<int> seqNumber; //tMaster->anP: the sequence id number sorted by OTU
60 vector<int> seqIndex; //tMaster->anI; the index that corresponds to seqNumber
61 vector<double> dist; //adDist - distance of sequences to centroids
62 vector<short> change; //did the centroid sequence change? 0 = no; 1 = yes
63 vector<int> centroids; //the representative flowgram for each cluster m
64 vector<double> weight;
65 vector<double> singleTau; //tMaster->adTau: 1-D Tau vector (1xnumSeqs)
66 vector<short> uniqueFlowgrams;
67 vector<int> uniqueCount;
68 vector<int> mapSeqToUnique;
69 vector<int> mapUniqueToSeq;
70 vector<int> uniqueLengths;
72 vector<string> outputNames;
74 int numSeqs, numUniques, numOTUs, numFlowCells;
76 void getSingleLookUp();
77 void getJointLookUp();
80 double getProbIntensity(int);
81 float calcPairwiseDist(int, int);
82 void flowDistParentFork(string, int, int);
84 string createDistFile(int);
85 string createNamesFile();
86 string cluster(string, string);
88 void getOTUData(string);
89 void initPyroCluster();
92 void calcCentroidsDriver(int, int);
93 double getDistToCentroid(int, int, int);
94 double getNewWeights();
95 double getLikelihood();
96 void checkCentroids();
97 void calcNewDistances();
98 void calcNewDistancesParent(int, int);
99 void calcNewDistancesChild(int, int, vector<int>&, vector<int>&, vector<double>&);
103 void writeQualities(vector<int>);
104 void writeSequences(vector<int>);
105 void writeNames(vector<int>);
107 void writeClusters(vector<int>);
111 string flowDistMPI(int, int);
112 void calcNewDistancesChildMPI(int, int, vector<int>&);