]> git.donarmstrong.com Git - mothur.git/commitdiff
changed sim2 to random_shuffle
authorKathryn Iverson <kd.iverson@gmail.com>
Mon, 30 Apr 2012 19:19:36 +0000 (15:19 -0400)
committerKathryn Iverson <kd.iverson@gmail.com>
Mon, 30 Apr 2012 19:19:36 +0000 (15:19 -0400)
cooccurrencecommand.cpp

index 1c683ac3db77389587cb1c907fdc47c23630eafa..b4965f5a91a2d12e4101aadc3b7258741de4945f 100644 (file)
@@ -317,15 +317,16 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
                 }
             }
         }
-        else if (matrix == "sim2") {
-            for(int i=0;i<nrows;i++) {
-                start = 0.0;
-                for(int j=0;j<ncols;j++) {
-                    probabilityMatrix[ncols * i + j] = start + 1/double(ncols);
-                    start = start + 1/double(ncols);
-                }
-            }
-        }
+        //don't need a prob matrix because we just shuffle the rows, may use this in the future
+//        else if (matrix == "sim2") {
+//            for(int i=0;i<nrows;i++) {
+//                start = 0.0;
+//                for(int j=0;j<ncols;j++) {
+//                    probabilityMatrix[ncols * i + j] = start + 1/double(ncols);
+//                    start = start + 1/double(ncols);
+//                }
+//            }
+//        }
         
         else if (matrix == "sim3") {
             for(int j=0;j<ncols;j++) {
@@ -438,7 +439,16 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
                 }
             }
             
-            else if(matrix == "sim2" || matrix == "sim4") {
+            else if (matrix == "sim2") {
+                for(int i=0;i<nrows;i++) {
+                    random_shuffle( co_matrix[i].begin(), co_matrix[i].end() ); 
+                }
+                //do this for the scoring since those all have nullmatrix as a parameter
+                //nullmatrix gets cleared at the begining of each run
+                nullmatrix = co_matrix;
+            }
+            
+            else if(matrix == "sim4") {
                 for(int i=0;i<nrows;i++) {
                     previous = 0.0;
                     count = 0;