From: David S. <ds...@us...> - 2007-06-28 18:53:38
|
Update of /cvsroot/sashimi/trans_proteomic_pipeline/src/Validation/MixtureModel In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7678 Modified Files: MixtureModel.cxx Log Message: Now using adjusted probability to compute the total probability in a given charge state. Index: MixtureModel.cxx =================================================================== RCS file: /cvsroot/sashimi/trans_proteomic_pipeline/src/Validation/MixtureModel/MixtureModel.cxx,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** MixtureModel.cxx 28 Jun 2007 17:15:19 -0000 1.33 --- MixtureModel.cxx 28 Jun 2007 18:53:35 -0000 1.34 *************** *** 780,786 **** --- 780,812 ---- } double tot = 0.0; + for(int k = 0; k < (*probs_)[charge]->size(); k++) { tot += (*(*probs_)[charge])[k]; } + + return tot; + } + + double MixtureModel::getTotalAdjProb(int charge) { + if(negOnly_[charge]) { + return 0.0; + } + + double tot = 0.0; + if(charge > 0 && charge < 3 && use_adj_probs_) { + if (pairedspecs_ == NULL) { + computeAdjDoubleTriplySpectraProbs(); + } + for(int k = 0; k < num_pairs_; k+=2) { + if(! negOnly_[atoi(pairedspecs_[k].name_ + strlen(pairedspecs_[k].name_)-1)-1]) { + tot += pairedspecs_[k+charge-1].prob_; + } + } + } + else { + for(int k = 0; k < (*probs_)[charge]->size(); k++) { + tot += (*(*probs_)[charge])[k]; + } + } return tot; } *************** *** 1528,1532 **** Tag* nexttag = NULL; char text[500]; ! nexttag = new Tag("analysis_summary", True, False); nexttag->setAttributeValue("analysis", prog_name); --- 1554,1558 ---- Tag* nexttag = NULL; char text[500]; ! nexttag = new Tag("analysis_summary", True, False); nexttag->setAttributeValue("analysis", prog_name); *************** *** 1544,1548 **** nexttag->setAttributeValue("options", options); ! sprintf(text, "%0.1f", getTotalProb(0)+getTotalProb(1)+getTotalProb(2)+getTotalProb(3)+getTotalProb(4)); nexttag->setAttributeValue("est_tot_num_correct", text); output->insertAtEnd(nexttag); --- 1570,1574 ---- nexttag->setAttributeValue("options", options); ! sprintf(text, "%0.1f", getTotalAdjProb(0)+getTotalAdjProb(1)+getTotalAdjProb(2)+getTotalAdjProb(3)+getTotalAdjProb(4)); nexttag->setAttributeValue("est_tot_num_correct", text); output->insertAtEnd(nexttag); *************** *** 1592,1596 **** sprintf(text, "%0.3f", priors_[charge]); nexttag->setAttributeValue("prior_probability", text); ! sprintf(text, "%0.1f", getTotalProb(charge)); nexttag->setAttributeValue("est_tot_correct", text); sprintf(text, "%d", (*spectra_)[charge]->size()); --- 1618,1622 ---- sprintf(text, "%0.3f", priors_[charge]); nexttag->setAttributeValue("prior_probability", text); ! sprintf(text, "%0.1f", getTotalAdjProb(charge)); nexttag->setAttributeValue("est_tot_correct", text); sprintf(text, "%d", (*spectra_)[charge]->size()); *************** *** 2235,2239 **** } ! fprintf(fout, "\tprior: %0.3f, est. total no. correct: %0.1f\n", priors_[charge], getTotalProb(charge)); for(int k = 0; k < (*mixtureDistrs_)[charge]->size(); k++) { (*(*mixtureDistrs_)[charge])[k]->writeDistr(fout); --- 2261,2265 ---- } ! fprintf(fout, "\tprior: %0.3f, est. total no. correct: %0.1f\n", priors_[charge], getTotalAdjProb(charge)); for(int k = 0; k < (*mixtureDistrs_)[charge]->size(); k++) { (*(*mixtureDistrs_)[charge])[k]->writeDistr(fout); *************** *** 2268,2272 **** next[strlen((*(*spectra_)[charge])[k]) + 1] = charge + 49; next[strlen((*(*spectra_)[charge])[k]) + 2] = 0; ! Spectrum* spec = new Spectrum(next, (*(*probs_)[charge])[k], ((NTTMixtureDistr*)(getMixtureDistr(ntt_name_, charge)))->getNTTValue(k), (*(*inds_)[charge])[k], k); delete [] next; pairedspecs_[total++] = *spec; --- 2294,2299 ---- next[strlen((*(*spectra_)[charge])[k]) + 1] = charge + 49; next[strlen((*(*spectra_)[charge])[k]) + 2] = 0; ! Spectrum* spec = new Spectrum(next, (*(*probs_)[charge])[k], ! ((NTTMixtureDistr*)(getMixtureDistr(ntt_name_, charge)))->getNTTValue(k), (*(*inds_)[charge])[k], k); delete [] next; pairedspecs_[total++] = *spec; *************** *** 2300,2306 **** char text[500]; - if(use_adj_probs_ && pairedspecs_ == NULL) { - computeAdjDoubleTriplySpectraProbs(); - } int total = 0; for(int charge = 0; charge < 5; charge++) { --- 2327,2330 ---- |