MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / calculateLogRatio

Method calculateLogRatio

src/ChrDensity.cpp:108–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void 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
144ChrDensity::~ChrDensity(void)
145{

Callers

nothing calls this directly

Calls 5

factorialFunction · 0.85
compareMethod · 0.80
getCoverageAtIMethod · 0.80
getDensityAtIMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected