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

Method calculateRatioUsingCG

src/GenomeCopyNumber.cpp:568–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568int GenomeCopyNumber::calculateRatioUsingCG (bool intercept, float minExpectedGC, float maxExpectedGC) { //returns 1 if the number of iteration is less than max; otherwise 0
569
570 //try degree 3 and 4, SELECT THE ONE WITH LESS ITTERATIONS:
571 int minDegreeToTest = 3;
572 int maxDegreeToTest = 4;
573 int selectedDegree=minDegreeToTest;
574 int maximalNumberOfIterations = 300;
575 int bestNumberOfIterations=maximalNumberOfIterations;
576 // int bestSqareError=INFINITY;
577 int valueToReturn = 0;
578
579
580 vector <float> y; //y ~ ax^2+bx+c
581 vector <float> x;
582
583 //check whether there are chromosomes without X and Y:
584 vector<ChrCopyNumber>::iterator it;
585 int countAutosomes = 0;
586 for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) {
587 if (! (it->getChromosome().find("X")!=string::npos || it->getChromosome().find("Y")!=string::npos)) {
588 countAutosomes++;
589 }
590 }
591 //fill x and y:
592 for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) {
593
594 if (countAutosomes>0 && !(it->getChromosome().find("X")!=string::npos || it->getChromosome().find("Y")!=string::npos) || countAutosomes==0) {
595 // if uniqueMatch, do correction to mappability
596 if (uniqueMatch) {
597 //use mappabilityProfile_ and correct
598 for (int i = 0; i< it->getLength(); i++) {
599 if ((it->getValueAt(i)>0)&&(it->getMappabilityProfileAt(i)>minMappabilityPerWindow)) {
600 x.push_back(it->getCGprofileAt(i));
601 y.push_back(it->getValueAt(i)/it->getMappabilityProfileAt(i));
602 }
603 }
604 } else {
605 //use a threshold, but correct using notN profile
606 if (it->getMappabilityLength()>0) {
607 for (int i = 0; i< it->getLength(); i++) {
608 if ((it->getValueAt(i)>0)&&(it->getMappabilityProfileAt(i)>minMappabilityPerWindow)) {
609 x.push_back(it->getCGprofileAt(i));
610 y.push_back(it->getValueAt(i)/it->getNotNprofileAt(i));
611 }
612 }
613 } else {
614 for (int i = 0; i< it->getLength(); i++) {
615 if ((it->getValueAt(i)>0)&&(it->getNotNprofileAt(i)>minMappabilityPerWindow)) {
616 x.push_back(it->getCGprofileAt(i));
617 y.push_back(it->getValueAt(i)/it->getNotNprofileAt(i));
618 }
619 }
620 }
621 }
622 }
623 }
624
625 for (int degree=minDegreeToTest;degree<=maxDegreeToTest; degree++) {

Callers 1

runWithDefinedPloidyFunction · 0.80

Calls 15

lrbuildFunction · 0.85
lrbuildzFunction · 0.85
lrunpackFunction · 0.85
runEMFunction · 0.85
getChromosomeMethod · 0.80
getCGprofileAtMethod · 0.80
getMappabilityLengthMethod · 0.80
getNotNprofileAtMethod · 0.80
compareMethod · 0.80
getChrCopyNumberMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected