From: Kathryn Iverson Date: Mon, 30 Apr 2012 17:33:04 +0000 (-0400) Subject: fixed rowtotal and columntotal X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=5d5ce917adda39d712a4d5ac0932671db1426393 fixed rowtotal and columntotal --- diff --git a/cooccurrencecommand.cpp b/cooccurrencecommand.cpp index f9db5be..465ddce 100644 --- a/cooccurrencecommand.cpp +++ b/cooccurrencecommand.cpp @@ -277,8 +277,8 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp vector columntotal; columntotal.resize(thisLookUp.size(), 0); vector 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& thisLookUp int ncols = thisLookUp.size();//groups double initscore = 0.0; - vector columntotal; columntotal.resize(ncols, 0); - vector rowtotal; rowtotal.resize(nrows, 0); vector stats; double probabilityMatrix[ncols * nrows]; vector > nullmatrix(nrows, vector(ncols, 0)); diff --git a/trialSwap2.cpp b/trialSwap2.cpp index 3822f54..c51a5b7 100644 --- a/trialSwap2.cpp +++ b/trialSwap2.cpp @@ -192,7 +192,7 @@ int TrialSwap2::calc_combo (int nrows, int ncols, vector > &nullmatr } } /**************************************************************************************************/ -int TrialSwap2::swap_checkerboards (vector > &co_matrix) +int TrialSwap2::swap_checkerboards (vector > &co_matrix, vector rowtotal, vector columntotal, int ncols, int nrows) { try { int ncols = co_matrix[0].size(); int nrows = co_matrix.size(); diff --git a/trialswap2.h b/trialswap2.h index 7b90663..2bd6939 100644 --- a/trialswap2.h +++ b/trialswap2.h @@ -21,7 +21,7 @@ public: double calc_pvalue_lessthan (vector, double); double calc_pvalue_greaterthan (vector, double); - void swap_checkerboards (vector > &co_matrix, vector rowtotal, vector columntotal, int ncols, int nrows); + void swap_checkerboards (vector > &, vector, vector, int, int); int calc_combo (int, int, vector > &); double calc_vratio (int, int, vector, vector); int calc_checker (vector > &, vector, int, int);