]> git.donarmstrong.com Git - mothur.git/commitdiff
edits to cooccurrence command
authorPat Schloss <pschloss@umich.edu>
Wed, 12 Dec 2012 20:27:47 +0000 (15:27 -0500)
committerPat Schloss <pschloss@umich.edu>
Wed, 12 Dec 2012 20:27:47 +0000 (15:27 -0500)
cooccurrencecommand.cpp
trialSwap2.cpp

index ef8c9eddce64e93092df8ed1031b37684f09fe38..881e2f39dcd9c2fa104953a1712c04575b19278f 100644 (file)
@@ -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<SharedRAbundVector*>& 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;
     }
index 71c3027db2c8bbe97265cb40af839c6a81a17b33..4cff4260ad5754fb4c0347747d20d0439df3f5d6 100644 (file)
@@ -50,9 +50,10 @@ double TrialSwap2::calc_c_score (vector<vector<int> > &co_matrix, vector<int> 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) {