]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed rowtotal and columntotal
authorKathryn Iverson <kd.iverson@gmail.com>
Mon, 30 Apr 2012 17:33:04 +0000 (13:33 -0400)
committerKathryn Iverson <kd.iverson@gmail.com>
Mon, 30 Apr 2012 17:33:04 +0000 (13:33 -0400)
cooccurrencecommand.cpp
trialSwap2.cpp
trialswap2.h

index f9db5be5691f424f70874f0f318b968c186df7bb..465ddced27b92345392d2752657bc1e3b7453f58 100644 (file)
@@ -277,8 +277,8 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
         vector<int> columntotal; columntotal.resize(thisLookUp.size(), 0);
         vector<int> rowtotal; rowtotal.resize(numOTUS, 0);
         
-        for (int i = 0; i < thisLookUp.size(); i++) {
-            for (int j = 0; j < thisLookUp[i]->getNumBins(); j++) {
+        for (int i = 0; i < thisLookUp.size(); i++) { //nrows in the shared file
+            for (int j = 0; j < thisLookUp[i]->getNumBins(); j++) { //cols of original shared file
                 if (m->control_pressed) { return 0; }
                 int abund = thisLookUp[i]->getAbundance(j);
                 
@@ -296,8 +296,6 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
         int ncols = thisLookUp.size();//groups
         double initscore = 0.0;
         
-        vector<int> columntotal; columntotal.resize(ncols, 0);
-        vector<int> rowtotal; rowtotal.resize(nrows, 0);
         vector<double> stats;
         double probabilityMatrix[ncols * nrows];
         vector<vector<int> > nullmatrix(nrows, vector<int>(ncols, 0));
index 3822f542e3ec57f0d7d52903bb2a4ec1ab19fb01..c51a5b7c0be1d3048851325da8be9cb26b414949 100644 (file)
@@ -192,7 +192,7 @@ int TrialSwap2::calc_combo (int nrows, int ncols, vector<vector<int> > &nullmatr
     }
 }
 /**************************************************************************************************/
-int TrialSwap2::swap_checkerboards (vector<vector<int> > &co_matrix)
+int TrialSwap2::swap_checkerboards (vector<vector<int> > &co_matrix,  vector<int> rowtotal, vector<int> columntotal, int ncols, int nrows)
 {
     try {
         int ncols = co_matrix[0].size(); int nrows = co_matrix.size();
index 7b90663a333b1476758462f7ab58ca7d023e1e7a..2bd6939482e962ac02332154ce459fac68c644ed 100644 (file)
@@ -21,7 +21,7 @@ public:
     
     double calc_pvalue_lessthan (vector<double>, double);
     double calc_pvalue_greaterthan (vector<double>, double);
-    void swap_checkerboards (vector<vector<int> > &co_matrix, vector<int> rowtotal, vector<int> columntotal, int ncols, int nrows);
+    void swap_checkerboards (vector<vector<int> > &, vector<int>, vector<int>, int, int);
     int calc_combo (int, int, vector<vector<int> > &);
     double calc_vratio (int, int, vector<int>, vector<int>);
     int calc_checker (vector<vector<int> > &, vector<int>, int, int);