X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cooccurrencecommand.cpp;h=e4c915d6a14e4a9755a17d64c073fdda1440803b;hb=e7ae6e6b27c45b5691c19f423ec56faae8e2f255;hp=aa553b4903c10cecc582bd33dab6a130f25e4787;hpb=40b3324ee4fcb80efb3459e78efbc3140d5e739a;p=mothur.git diff --git a/cooccurrencecommand.cpp b/cooccurrencecommand.cpp index aa553b4..e4c915d 100644 --- a/cooccurrencecommand.cpp +++ b/cooccurrencecommand.cpp @@ -272,6 +272,12 @@ int CooccurrenceCommand::execute(){ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp, ofstream& out){ try { int numOTUS = thisLookUp[0]->getNumBins(); + + if(numOTUS < 2) { + m->mothurOut("Not enough OTUs for co-occurrence analysis, skipping"); m->mothurOutEndLine(); + return 0; + } + vector< vector > co_matrix; co_matrix.resize(thisLookUp[0]->getNumBins()); for (int i = 0; i < thisLookUp[0]->getNumBins(); i++) { co_matrix[i].resize((thisLookUp.size()), 0); } vector columntotal; columntotal.resize(thisLookUp.size(), 0); @@ -543,7 +549,7 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp m->mothurOut("zscore: " + toString(zscore)); m->mothurOutEndLine(); m->mothurOut("standard deviation: " + toString(sd)); m->mothurOutEndLine(); - out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore '\t' << sd << endl; + out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore << '\t' << sd << endl; return 0; }