MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / calculateVarianceForNormalCopy

Method calculateVarianceForNormalCopy

src/GenomeCopyNumber.cpp:3343–3375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3341
3342
3343float GenomeCopyNumber::calculateVarianceForNormalCopy(int ploidy) { //geting the total variance for points with median around 1 (+-0.5/ploidy) --- OLD
3344 float variance = 0;
3345 int count = 0;
3346 double lowBoundary = 1-0.5/ploidy;
3347 double highBoundary = 1+0.5/ploidy;
3348 float value,med;
3349 vector<ChrCopyNumber>::iterator it;
3350
3351 ofstream myfile;
3352
3353 myfile.open ("example.txt");
3354
3355
3356 cout << "..Calculating variance for neutral copies\n";
3357 for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) {
3358 //cout << "..processing chromosome " <<it->getChromosome()<<"\n";
3359 for (int i = 0; i<it->getLength(); i++) {
3360 med = it->getMedianProfileAtI(i);
3361 if ((med>lowBoundary)&&(med < highBoundary)) {
3362 value = it->getRatioAtBin(i);
3363 if (isRatioLogged_&& value!=NA)
3364 value=pow(2,value);
3365 if (value != NA) {
3366 myfile << value-1 << "\n";
3367 variance += (value-1)*(value-1);
3368 count++;
3369 }
3370 }
3371 }
3372 }
3373 myfile.close();
3374 return float(variance/(count-1));
3375}
3376
3377void GenomeCopyNumber::printPloidy(std::string const& outFile) {
3378 std::ofstream file (outFile.c_str());

Callers

nothing calls this directly

Calls 3

getMedianProfileAtIMethod · 0.80
getRatioAtBinMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected