From: Pat Schloss Date: Wed, 12 Dec 2012 20:27:47 +0000 (-0500) Subject: edits to cooccurrence command X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=b8a1ac74d3d4f9cd53f2a98cc6ea95f50860044b edits to cooccurrence command --- 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) {