| 3303 | } |
| 3304 | |
| 3305 | void GenomeCopyNumber::calculateSDs(int ploidy, map <float,float> &sds) { |
| 3306 | |
| 3307 | float value,med; |
| 3308 | vector<ChrCopyNumber>::iterator it; |
| 3309 | |
| 3310 | //fill the map |
| 3311 | map <float,vector <float> > mymap; |
| 3312 | for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) { |
| 3313 | for (int i = 0; i<it->getLength(); i++) { |
| 3314 | med = it->getMedianProfileAtI(i); |
| 3315 | float level = round_by_ploidy(med, ploidy); |
| 3316 | value = it->getRatioAtBin(i); |
| 3317 | if (isRatioLogged_&& value!=NA) |
| 3318 | value=pow(2,value); |
| 3319 | if (value != NA) { |
| 3320 | if (mymap.count(level) == 0) { |
| 3321 | vector <float> a; |
| 3322 | mymap.insert ( pair<float,vector <float> >(level,a) ); |
| 3323 | } |
| 3324 | mymap.find(level)->second.push_back(value); |
| 3325 | } |
| 3326 | } |
| 3327 | } |
| 3328 | |
| 3329 | //get median and variance for each level |
| 3330 | map<float,vector <float> >::iterator it2; |
| 3331 | for ( it2=mymap.begin() ; it2 != mymap.end(); it2++ ) { |
| 3332 | float level = (*it2).first; |
| 3333 | // float mean = get_mean((*it2).second); |
| 3334 | float sdev = sd((*it2).second,level); |
| 3335 | sds.insert(pair<float,float>(level,sdev)); |
| 3336 | (*it2).second.clear(); |
| 3337 | } |
| 3338 | mymap.clear(); |
| 3339 | |
| 3340 | } |
| 3341 | |
| 3342 | |
| 3343 | float GenomeCopyNumber::calculateVarianceForNormalCopy(int ploidy) { //geting the total variance for points with median around 1 (+-0.5/ploidy) --- OLD |
nothing calls this directly
no test coverage detected