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

Method EstimateSubclonalPopulation

src/SeekSubclones.cpp:197–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195
196
197void SeekSubclones::EstimateSubclonalPopulation(vector <float> data, float threshold, int ploidy_)
198{
199 float sumtmp = 0;
200 threshold = threshold*ploidy_;
201 int countData = 0;
202 for (unsigned int i = 0; i < data.size(); i++) {
203 if (data[i]!=NA) {
204 sumtmp += data[i];
205 countData++;
206 }
207
208 }
209 if (countData==0) {return;}
210 float mean = ploidy_*sumtmp/countData;
211 if (mean > threshold)
212 {
213 int i =1;
214 float pop = 1;
215 int iter = 0;
216 while (pop > minimal_pop_ && iter < 100)
217 {
218 if ((((mean - threshold)/(i)) > minimal_pop_) && (((mean - threshold)/(i)) < 1) ) // && (threshold + i != ploidy_)
219 {
220 copynumber_.push_back(threshold + i);
221 population_.push_back((mean - threshold)/(i));
222 }
223 pop = (mean - threshold)/(i);
224 i++;
225 iter++;
226 }
227 }
228 else if (mean < threshold)
229 {
230 int i =1;
231 float pop = 1;
232 int iter = 0;
233 while (pop > minimal_pop_ && iter < 100 && (threshold - i >= 0))
234 {
235 if ((((-mean + threshold)/(i)) > minimal_pop_) && (((-mean + threshold)/(i)) < 1) ) //GOT IT EXCEPT for "&& (threshold - i != ploidy_)" SO I REMOVED IT
236 {
237 copynumber_.push_back(threshold - i);
238 population_.push_back((-mean + threshold)/(i));
239 }
240 pop = (-mean + threshold)/(i);
241 i++;
242 iter++;
243 }
244 }
245}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected