void FullRun::displayResult(void) { unsigned long numRecombinant = 0; unsigned long numLongRec = 0; for (unsigned long i = 0; i < childDataset->getSize(); i++) { Genome* child = childDataset->getGenome(i); if (child->getRecombinantType() != Genome::Na_REC) { numRecombinant++; } if (child->getRecombinantType() == Genome::LONG_REC) { numLongRec++; if (fileLongRecombinants != NULL) { fileLongRecombinants->writeLine(child->getAccession()); } } } Interface::instance() << "Number of triples tested : " << getNumTotalTriplets() << "\n" << "Number of p-values computed exactly : " << numComputedExactly << "\n" << "Number of p-values approximated (HS) : " << numApproximated << "\n" << "Number of p-values not computed : " << numSkipped << "\n" << endl << "Number of recombinant triplets : \t" << numRecombinantTriplets << "\n" << "Number of distinct recombinant sequences : \t" << numRecombinant << "\n"; if (cloStopAtFirstRecombinant) { Interface::instance() << "[[ search stopped when first one found ]]\n" << endl; } if (!cloNoBpCalculated) { Interface::instance() << "Number of distinct recombinant sequences at least " << cloMinLongRecombinantLength << "nt long : \t" << numLongRec << "\n" << "Longest of short recombinant segments : \t" << longestRecombinantSegment << "nt\n"; } Interface::instance().showOutput(true); Interface::instance() << Interface::SEPARATOR << endl; Interface::instance().showLog(true); char formatedPVal[20]; sprintf(formatedPVal, "%1.3e", static_cast<double> (stats::correction::dunnSidak(minPVal, getNumTripletsForCorrection())) ); Interface::instance() << "Rejection of the null hypothesis of clonal evolution at p = " << stats::correction::dunnSidak(minPVal, getNumTripletsForCorrection()) << "\n" << " p = " << formatedPVal << "\n" << " Uncorrected p = " << minPVal << "\n" << " Bonferroni p = " << stats::correction::bonferroni(minPVal, getNumTripletsForCorrection()) << "\n"; Interface::instance().showOutput(true); }
void FullRun::progress(void) { if (cloAllBpCalculated) { Interface::instance() << " Recombinant Longest Recombinant\n" << "Progress Time Elapsed Minimum P-Value Triplets Found Segment\n"; } else { Interface::instance() << " Recombinant\n" << "Progress Time Elapsed Minimum P-Value Triplets Found\n"; } Interface::instance().showLog(false); recombinationSensitivity = 0; for (unsigned long randLoopCounter = 0; randLoopCounter < randomLoopNum; randLoopCounter++) { if (isRandomMode) { childDataset->randomlyActivate(randomSeqNum); calculateTripletNum(); } numRecombinantTriplets = 0.0; numComputedExactly = 0.0; numApproximated = 0.0; numSkipped = getNumTotalTriplets(); minPVal = 1.0; longestRecombinantSegment = 0; /* Initialise progress counter */ unsigned long activeChildNum = childDataset->getNumActiveSeq(); unsigned long activeParentNum = parentDataset->getNumActiveSeq(); double totalLoop = static_cast<double> (activeChildNum) * static_cast<double> (activeParentNum); Interface::instance().initCounter("", 0, totalLoop); /* This flag indicates if the progressing should be stopped */ bool isStoped = false; /* Progressing begins */ unsigned long activeChildCounter = 0; unsigned long activeDadCounter = 0; Genome* child = NULL; Genome* dad = NULL; Genome* mum = NULL; Triplet* triplet = NULL; for (unsigned long childIndex = 0; !isStoped && childIndex < childDataset->getSize(); childIndex++) { child = childDataset->getGenome(childIndex); if (child->isActive()) { activeChildCounter++; } else { continue; } activeDadCounter = 0; for (unsigned long dadIndex = 0; !isStoped && dadIndex < parentDataset->getSize(); dadIndex++) { dad = parentDataset->getGenome(dadIndex); if (dad->isActive()) { activeDadCounter++; } if (!dad->isActive() || dad == child) { continue; } /* Show progress counter */ double currentLoop = static_cast<double> (activeChildCounter - 1) * static_cast<double> (activeParentNum) + static_cast<double> (activeDadCounter - 1); showProgress(currentLoop, false); for (unsigned long mumIndex = 0; !isStoped && mumIndex < parentDataset->getSize(); mumIndex++) { mum = parentDataset->getGenome(mumIndex); if (!mum->isActive() || mum == child || mum == dad) continue; triplet = new Triplet(dad, mum, child); /* Let's see if we can calculate the exact P-value */ bool hasPValue = triplet->calculatePVal(cloUseSiegmundApprox); if (!hasPValue) { if (fileSkippedTriplets) { /* No need to open file, writeLine() will do that automatically */ fileSkippedTriplets->writeLine(triplet->toString()); } delete triplet; continue; } numSkipped -= 1.0; if (triplet->isPValApproximated()) { numApproximated += 1.0; } else { numComputedExactly += 1.0; } double pValue = triplet->getPVal(); addPValIntoHistogram(pValue); if (pValue < minPVal) minPVal = pValue; /* Let's see if the P-value is significant */ if (stats::correction::dunnSidak(pValue, getNumTripletsForCorrection()) < cloRejectThreshold) { numRecombinantTriplets += 1.0; if (child->getRecombinantType() == Genome::Na_REC) { child->setRecombinantType(Genome::SHORT_REC); } /* Go into this loop either if we're doing ALL breakpoint or * NO breakpoint if we are doing no breakpoint, then the * breakpoint calculations is skipped. */ if (cloAllBpCalculated || cloNoBpCalculated) { recordRecombinantTriplet(triplet); } /* Now check if this is the *best* recombinant (meaning lowest p-value) * and if it is, record it */ if (child->getBestRecombinantTriplet() == NULL || pValue < child->getBestRecombinantTriplet()->getPVal()) { child->setBestRecombinantTriplet(triplet); } else { delete triplet; } if (cloStopAtFirstRecombinant) { /* Finish progressing early */ isStoped = true; } } else { delete triplet; } } } } /* Progressing finished */ showProgress(0.0, true); if (numRecombinantTriplets > 0) { recombinationSensitivity++; } } }