X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sharedcommand.cpp;h=91bb8e19604d3d9446016c4b9eaf82f566172c0a;hb=762b3e4c83e1e8e8392c1199b6482d36ee89e50f;hp=213fd49588bbf8a9278bc04c14d474bd11ccb278;hpb=1dc7ed939c314b3057dad3a834e9739fb7ecfbe6;p=mothur.git diff --git a/sharedcommand.cpp b/sharedcommand.cpp index 213fd49..91bb8e1 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -8,7 +8,11 @@ */ #include "sharedcommand.h" - +//******************************************************************************************************************** +//sorts lowest to highest +inline bool compareSharedRabunds(SharedRAbundVector* left, SharedRAbundVector* right){ + return (left->getGroup() < right->getGroup()); +} //********************************************************************************************************************** SharedCommand::SharedCommand(string o) : outputDir(o) { @@ -143,6 +147,7 @@ int SharedCommand::execute(){ if(globaldata->allLines == 1 || globaldata->labels.count(SharedList->getLabel()) == 1){ lookup = SharedList->getSharedRAbundVector(); + m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine(); if (pickedGroups) { //check for otus with no seqs in them eliminateZeroOTUS(lookup); @@ -275,6 +280,8 @@ int SharedCommand::execute(){ void SharedCommand::printSharedData(vector thislookup) { try { + sort(thislookup.begin(), thislookup.end(), compareSharedRabunds); + //initialize bin values for (int i = 0; i < thislookup.size(); i++) { //cout << "in printData " << thislookup[i]->getLabel() << '\t' << thislookup[i]->getGroup() << endl;