| 1184 | } |
| 1185 | |
| 1186 | double ChrCopyNumber::calculateXiSum(int ploidy, map <float,float> &sds, map <float,float> &meds) { |
| 1187 | double sum = 0; |
| 1188 | const double PI = 3.141592; |
| 1189 | |
| 1190 | for (int i = 0; i <= (int)bpfinal_.size();i++) { |
| 1191 | |
| 1192 | float level = getLevelAt(i,ploidy); |
| 1193 | if (level != NA) { |
| 1194 | double theta_i = meds.find(level)->second; |
| 1195 | //bpLengths_[i]; |
| 1196 | //sd_[i]; |
| 1197 | double d = medianValues_[i]-theta_i; |
| 1198 | if (fragmentNotNA_lengths_[i] != 0) { |
| 1199 | double sqrtVar = sqrt(float(PI/2./fragmentNotNA_lengths_[i]))*max(sds.find(level)->second,sd_[i]); |
| 1200 | double term = pow(d/sqrtVar,2); |
| 1201 | sum += term; |
| 1202 | } |
| 1203 | } |
| 1204 | } |
| 1205 | /*ofstream myfile; |
| 1206 | myfile.open ("example.txt"); |
| 1207 | myfile <<"ratio\tmedianValues\n"; |
| 1208 | for (int i = 0; i < (int)ratio_.size();i++) { |
| 1209 | myfile << ratio_[i] << "\t" <<medianProfile_[i] <<"\n"; |
| 1210 | } |
| 1211 | myfile.close();*/ |
| 1212 | return sum; |
| 1213 | } |
| 1214 | |
| 1215 | double ChrCopyNumber::calculateXiSum(int ploidy, map <float,float> &sds) { |
| 1216 | double sum = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected