From b8a1ac74d3d4f9cd53f2a98cc6ea95f50860044b Mon Sep 17 00:00:00 2001 From: Pat Schloss Date: Wed, 12 Dec 2012 15:27:47 -0500 Subject: [PATCH] edits to cooccurrence command --- cooccurrencecommand.cpp | 5 +++-- trialSwap2.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cooccurrencecommand.cpp b/cooccurrencecommand.cpp index ef8c9ed..881e2f3 100644 --- a/cooccurrencecommand.cpp +++ b/cooccurrencecommand.cpp @@ -200,7 +200,7 @@ int CooccurrenceCommand::execute(){ m->openOutputFile(outputFileName, out); outputNames.push_back(outputFileName); outputTypes["summary"].push_back(outputFileName); out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint); - out << "metric\tlabel\tScore\tzScore\tstandardDeviation\n"; + out << "metric\tlabel\tScore\tzScore\tstandardDeviation\tnp_Pvalue\n"; //as long as you are not at the end of the file or done wih the lines you want while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { @@ -569,7 +569,8 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp m->mothurOut("zscore: " + toString(zscore)); m->mothurOutEndLine(); m->mothurOut("standard deviation: " + toString(sd)); m->mothurOutEndLine(); - out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore << '\t' << sd << endl; + m->mothurOut("non-parametric p-value: " + toString(pvalue)); m->mothurOutEndLine(); + out << metric << '\t' << thisLookUp[0]->getLabel() << '\t' << nullMean << '\t' << zscore << '\t' << sd << '\t' << pvalue << endl; return 0; } diff --git a/trialSwap2.cpp b/trialSwap2.cpp index 71c3027..4cff426 100644 --- a/trialSwap2.cpp +++ b/trialSwap2.cpp @@ -50,9 +50,10 @@ double TrialSwap2::calc_c_score (vector > &co_matrix, vector ro } } - cscore = cscore/(double)(nrows*(nrows-1)/2); + //cscore = cscore/(double)(nrows*(nrows-1)/2); //not normalized //cout << "normalized c score: " << normcscore/nonzeros << endl; - + cscore = normcscore/(double)nonzeros; + return cscore; } catch(exception& e) { -- 2.39.2