| 439 | } |
| 440 | |
| 441 | void ChrCopyNumber::calculateRatioLog(ChrCopyNumber control, const double * a, const int degree){ |
| 442 | if ((int)ratio_.size()!=length_) |
| 443 | ratio_.resize(length_); |
| 444 | for (int i = 0; i<length_; i++) { |
| 445 | if ((control.getLength()>i)&&(control.getValueAt(i) != 0)){ |
| 446 | if (mappabilityProfile_.size() == 0 || mappabilityProfile_[i] > minMappabilityPerWindow) { |
| 447 | ratio_[i] = readCount_[i]/polynomial(control.getValueAt(i),a,1,degree); |
| 448 | if (ratio_[i]<0) |
| 449 | ratio_[i] = NA; |
| 450 | } else |
| 451 | ratio_[i] = NA; |
| 452 | } else |
| 453 | if (readCount_[i]==0) |
| 454 | //ratio_[i] = 1; |
| 455 | ratio_[i] = NA; |
| 456 | else |
| 457 | ratio_[i] = NA; |
| 458 | //cout << readCount_[i] << "\t" << control.getValueAt(i) << "\t" << ratio_[i] << "\n"; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | void ChrCopyNumber::calculateRatio(ChrCopyNumber control, const double * a, const int degree){ |
| 463 | if ((int)ratio_.size()!=length_) |
no test coverage detected