| 1002 | |
| 1003 | |
| 1004 | int 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 | |
| 1026 | double GenomeCopyNumber::calculateMedianAround (float interval, float around) { |
| 1027 |
no test coverage detected