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

Method calculateMedianReadCountPerWindow

src/GenomeCopyNumber.cpp:1004–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002
1003
1004int GenomeCopyNumber::calculateMedianReadCountPerWindow() {
1005 vector <float> myValues;
1006 vector<ChrCopyNumber>::iterator it;
1007 for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) {
1008 if (! (it->getChromosome().find("X")!=string::npos || it->getChromosome().find("Y")!=string::npos))
1009 for (int i = 0; i< it->getLength(); i++) {
1010 if (it->getValueAt(i) >0) //non-zero values
1011 myValues.push_back(it->getValueAt(i));
1012 }
1013 }
1014
1015 if (myValues.size()==0) {
1016 cerr << "Error: no windows with reads\n";
1017 cerr << "Unable to proceed..\n";
1018 exit(-1);
1019 }
1020
1021 float median = get_median(myValues);
1022 myValues.clear();
1023 return floor(median);
1024}
1025
1026double GenomeCopyNumber::calculateMedianAround (float interval, float around) {
1027

Callers 1

calculateRatioMethod · 0.80

Calls 4

get_medianFunction · 0.85
getChromosomeMethod · 0.80
getLengthMethod · 0.45
getValueAtMethod · 0.45

Tested by

no test coverage detected