| 106 | } |
| 107 | |
| 108 | void ChrDensity::calculateLogRatio(ChrDensity controlCD, std::string type) { |
| 109 | typeOfLogRatio_ = type; |
| 110 | if (length_!=controlCD.getLength()) |
| 111 | return; //throw error TODO |
| 112 | std::vector<float> second(length_); |
| 113 | logRatio = second; |
| 114 | if (type.compare("norm")==0) { |
| 115 | for (int i = 0; i<length_; i++) { |
| 116 | int y = controlCD.getCoverageAtI(i); |
| 117 | if (y!=0) |
| 118 | logRatio[i] = float(coverage_[i])/y; |
| 119 | else |
| 120 | logRatio[i] = -1; |
| 121 | |
| 122 | if (i % 50000 == 0) { |
| 123 | // std::cout << i << "\t" << logRatio[i] << "\t" << coverage_[i] << "\t" << y << "\n"; |
| 124 | std::cout << i << "\t" << exp(-(float)y)*pow((float)y,coverage_[i])/factorial(coverage_[i]) << "\t" << -log(exp((float)y)*pow((float)y,coverage_[i])/factorial(coverage_[i])) << "\t" << coverage_[i] << "\t" << y << "\n"; |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | else { |
| 129 | for (int i = 0; i<length_; i++) { |
| 130 | float y = controlCD.getDensityAtI(i); |
| 131 | if (y!=0) |
| 132 | logRatio[i] = float(density_[i])/y; |
| 133 | else |
| 134 | logRatio[i] = -1; |
| 135 | |
| 136 | //if (i % 50000 == 0) |
| 137 | // std::cout << i << "\t" << logRatio[i] << "\t" << density_[i] << "\t" << y << "\n"; |
| 138 | |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | |
| 144 | ChrDensity::~ChrDensity(void) |
| 145 | { |
nothing calls this directly
no test coverage detected