X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=pcacommand.cpp;h=c9fecd58ca08d9103770dd5f0e3afd7f2274c89d;hb=7a8fc1115b3871107c09a4b9b307b1f2ab7d3fcf;hp=644473a8baa2b86253118e7b766b0e965fcb80a8;hpb=74844a60d80c6dd06e3fb02ee9b928424f9019b0;p=mothur.git diff --git a/pcacommand.cpp b/pcacommand.cpp index 644473a..c9fecd5 100644 --- a/pcacommand.cpp +++ b/pcacommand.cpp @@ -97,17 +97,11 @@ int PCACommand::execute(){ vector names; vector > D; - //fbase = filename; - //if(fbase.find_last_of(".")!=string::npos){ - // fbase.erase(fbase.find_last_of(".")+1); - //} - //else{ - // fbase += "."; - //} - fbase = outputDir + getRootName(getSimpleName(filename)); read(filename, names, D); + + if (m->control_pressed) { return 0; } double offset = 0.0000; vector d; @@ -116,19 +110,22 @@ int PCACommand::execute(){ vector > copy_G; //int rank = D.size(); - cout << "\nProcessing...\n"; + m->mothurOut("\nProcessing...\n"); for(int count=0;count<2;count++){ - recenter(offset, D, G); - tred2(G, d, e); - qtli(d, e, G); + recenter(offset, D, G); if (m->control_pressed) { return 0; } + tred2(G, d, e); if (m->control_pressed) { return 0; } + qtli(d, e, G); if (m->control_pressed) { return 0; } offset = d[d.size()-1]; if(offset > 0.0) break; } + if (m->control_pressed) { return 0; } output(fbase, names, G, d); + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } + m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); } @@ -164,7 +161,7 @@ void PCACommand::get_comment(istream& f, char begin, char end){ /*********************************************************************************************************************************/ -void PCACommand::read_phylip(istream& f, int square_m, vector& name_list, vector >& d){ +int PCACommand::read_phylip(istream& f, int square_m, vector& name_list, vector >& d){ try { // int count1=0; // int count2=0; @@ -181,6 +178,8 @@ void PCACommand::read_phylip(istream& f, int square_m, vector& name_list f >> name_list[i]; // cout << i << "\t" << name_list[i] << endl; for(int j=0;jcontrol_pressed) { return 0; } + f >> d[i][j]; if (d[i][j] == -0.0000) d[i][j] = 0.0000; @@ -197,6 +196,7 @@ void PCACommand::read_phylip(istream& f, int square_m, vector& name_list f >> name_list[i]; d[i][i]=0.0000; for(int j=0;jcontrol_pressed) { return 0; } f >> d[i][j]; if (d[i][j] == -0.0000) d[i][j] = 0.0000; @@ -204,6 +204,8 @@ void PCACommand::read_phylip(istream& f, int square_m, vector& name_list } } } + + return 0; } catch(exception& e) { m->errorOut(e, "PCACommand", "read_phylip");