From 8d809b3a13ee742f78613af4b8535ad8efae90a8 Mon Sep 17 00:00:00 2001 From: Kathryn Iverson Date: Wed, 16 May 2012 16:30:08 -0400 Subject: [PATCH] added check for numOTUS, will skip if < 2. --- cooccurrencecommand.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.39.2