]> git.donarmstrong.com Git - mothur.git/commitdiff
added check for numOTUS, will skip if < 2.
authorKathryn Iverson <kd.iverson@gmail.com>
Wed, 16 May 2012 20:30:08 +0000 (16:30 -0400)
committerKathryn Iverson <kd.iverson@gmail.com>
Wed, 16 May 2012 20:30:08 +0000 (16:30 -0400)
cooccurrencecommand.cpp

index aa553b4903c10cecc582bd33dab6a130f25e4787..9d298fb0af7e3910857d0c6f2d6f7c9d0b2d2a41 100644 (file)
@@ -272,6 +272,12 @@ int CooccurrenceCommand::execute(){
 int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& 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<int> > 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<int> columntotal; columntotal.resize(thisLookUp.size(), 0);