- vector<string> names;
- vector<vector<double> > D;
-
- fbase = filename;
- if(fbase.find_last_of(".")!=string::npos){
- fbase.erase(fbase.find_last_of(".")+1);
- }
- else{
- fbase += ".";
- }
- read(filename, names, D);
-
- double offset = 0.0000;
- vector<double> d;
- vector<double> e;
- vector<vector<double> > G = D;
- vector<vector<double> > copy_G;
- //int rank = D.size();
-
- cout << "\nProcessing...\n";
-
- for(int count=0;count<2;count++){
- recenter(offset, D, G);
- tred2(G, d, e);
- qtli(d, e, G);
- offset = d[d.size()-1];
- if(offset > 0.0) break;
- }
-
-
- output(fbase, names, G, d);
-
- return 0;
- }
- catch(exception& e) {
- errorOut(e, "PCACommand", "execute");
- exit(1);
- }
-}
-/*********************************************************************************************************************************/
-
-inline double SIGN(const double a, const double b)
-{
- return b>=0 ? (a>=0 ? a:-a) : (a>=0 ? -a:a);
-}
-
-/*********************************************************************************************************************************/
-
-void PCACommand::get_comment(istream& f, char begin, char end){
- try {
- char d=f.get();
- while(d != end){ d = f.get(); }
- d = f.peek();
- }
- catch(exception& e) {
- errorOut(e, "PCACommand", "get_comment");
- exit(1);
- }
-}
-
-/*********************************************************************************************************************************/
-
-void PCACommand::read_mega(istream& f, vector<string>& name_list, vector<vector<double> >& d){
- try {
- get_comment(f, '#', '\n');
-
- char test = f.peek();
+ //get first line of shared file
+ vector< vector<double> > matrix;
+ InputData* input;
+ if (mode == "shared") {
+ input = new InputData(inputFile, "sharedfile");
+ }else if (mode == "relabund") {
+ input = new InputData(inputFile, "relabund");
+ }else { m->mothurOut("[ERROR]: filetype not recognized."); m->mothurOutEndLine(); return 0; }
+
+ vector<SharedRAbundFloatVector*> lookupFloat = input->getSharedRAbundFloatVectors();
+ string lastLabel = lookupFloat[0]->getLabel();
+
+ set<string> processedLabels;
+ set<string> userLabels = labels;