1 // 2 // ppv.cpp 3 // Mothur 4 // 5 // Created by Sarah Westcott on 4/11/17. 6 // Copyright © 2017 Schloss Lab. All rights reserved. 7 // 8 9 #include "ppv.hpp" 10 11 /***********************************************************************/ getValue(double tp,double tn,double fp,double fn)12double PPV::getValue(double tp, double tn, double fp, double fn) { 13 try { 14 long long pPrime = tp + fp; 15 double positivePredictiveValue = tp / (double) pPrime; 16 17 if(pPrime == 0) { positivePredictiveValue = 0; } 18 19 if (isnan(positivePredictiveValue) || isinf(positivePredictiveValue)) { positivePredictiveValue = 0; } 20 21 return positivePredictiveValue; 22 } 23 catch(exception& e) { 24 m->errorOut(e, "PPV", "getValue"); 25 exit(1); 26 } 27 } 28 /***********************************************************************/ 29 30