From: Kathryn Iverson Date: Wed, 16 May 2012 20:30:08 +0000 (-0400) Subject: added check for numOTUS, will skip if < 2. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8d809b3a13ee742f78613af4b8535ad8efae90a8;hp=bdd77df6a7df8a5775b57d0a7ec8b55de45e7b5b;p=mothur.git added check for numOTUS, will skip if < 2. --- diff --git a/cooccurrencecommand.cpp b/cooccurrencecommand.cpp index aa553b4..9d298fb 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);