@sjcrh/proteinpaint-rust 2.40.6 → 2.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +5 -6
- package/package.json +35 -35
- package/src/DEanalysis.rs +460 -387
- package/src/indel.rs +1 -1
- package/src/stats_functions.rs +270 -270
package/src/indel.rs
CHANGED
|
@@ -848,7 +848,7 @@ fn main() {
|
|
|
848
848
|
let remainder: usize = iter % max_threads; // Calculate remainder of read number divided by max_threads to decide which thread parses this read
|
|
849
849
|
//println!("iter:{}", iter);
|
|
850
850
|
if remainder == thread_num {
|
|
851
|
-
// Thread analyzing a particular read must have the same remainder as the thread_num, this avoids multiple
|
|
851
|
+
// Thread analyzing a particular read must have the same remainder as the thread_num, this avoids multiple threads from parsing the same read. Also checking if the read length > 0
|
|
852
852
|
|
|
853
853
|
//println!(
|
|
854
854
|
// "start_positions_list:{}",
|
package/src/stats_functions.rs
CHANGED
|
@@ -141,274 +141,274 @@ fn chi_square_test(
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
//
|
|
322
|
-
// let sigma = (((group1.len() * group2.len()) as f64) / 12.0
|
|
323
|
-
// * ((group1.len() + group2.len() + 1) as f64
|
|
324
|
-
// - nties_sum
|
|
325
|
-
// / (((group1.len() + group2.len()) as f64)
|
|
326
|
-
// * ((group1.len() + group2.len() - 1) as f64))))
|
|
327
|
-
// .sqrt();
|
|
328
|
-
// //println!("sigma:{}", sigma);
|
|
329
|
-
// let mut correction: f64 = 0.0;
|
|
330
|
-
// if correct == true {
|
|
331
|
-
// if alternative == 'g' {
|
|
332
|
-
// // Alternative "greater"
|
|
333
|
-
// correction = 0.5;
|
|
334
|
-
// } else if alternative == 'l' {
|
|
335
|
-
// // Alternative "lesser"
|
|
336
|
-
// correction = -0.5;
|
|
337
|
-
// } else {
|
|
338
|
-
// // Alternative "two-sided"
|
|
339
|
-
// if z > 0.0 {
|
|
340
|
-
// correction = 0.5;
|
|
341
|
-
// } else if z < 0.0 {
|
|
342
|
-
// correction = -0.5;
|
|
343
|
-
// } else {
|
|
344
|
-
// // z=0
|
|
345
|
-
// correction = 0.0;
|
|
346
|
-
// }
|
|
347
|
-
// }
|
|
348
|
-
// }
|
|
349
|
-
// z = (z - correction) / sigma;
|
|
350
|
-
// //println!("z:{}", z);
|
|
351
|
-
// if alternative == 'g' {
|
|
352
|
-
// // Alternative "greater"
|
|
353
|
-
// //println!("greater:{}", n.cdf(weight_y));
|
|
354
|
-
// //1.0 - n.cdf(z) // Applying continuity correction
|
|
355
|
-
// r_mathlib::normal_cdf(z, 0.0, 1.0, false, false)
|
|
356
|
-
// } else if alternative == 'l' {
|
|
357
|
-
// // Alternative "lesser"
|
|
358
|
-
// //println!("lesser:{}", n.cdf(weight_x));
|
|
359
|
-
// //n.cdf(z) // Applying continuity coorection
|
|
360
|
-
// r_mathlib::normal_cdf(z, 0.0, 1.0, true, false)
|
|
361
|
-
// } else {
|
|
362
|
-
// // Alternative "two-sided"
|
|
363
|
-
// let p_g = r_mathlib::normal_cdf(z, 0.0, 1.0, false, false); // Applying continuity correction
|
|
364
|
-
// let p_l = r_mathlib::normal_cdf(z, 0.0, 1.0, true, false); // Applying continuity correction
|
|
365
|
-
// let mut p_value;
|
|
366
|
-
// if p_g < p_l {
|
|
367
|
-
// p_value = 2.0 * p_g;
|
|
368
|
-
// } else {
|
|
369
|
-
// p_value = 2.0 * p_l;
|
|
370
|
-
// }
|
|
371
|
-
// //println!("p_value:{}", p_value);
|
|
372
|
-
// if p_value > 1.0 {
|
|
373
|
-
// p_value = 1.0;
|
|
374
|
-
// }
|
|
375
|
-
// p_value
|
|
376
|
-
// }
|
|
377
|
-
// }
|
|
378
|
-
//}
|
|
144
|
+
#[allow(dead_code)]
|
|
145
|
+
pub fn wilcoxon_rank_sum_test(
|
|
146
|
+
mut group1: Vec<f64>,
|
|
147
|
+
mut group2: Vec<f64>,
|
|
148
|
+
threshold: usize,
|
|
149
|
+
alternative: char,
|
|
150
|
+
correct: bool,
|
|
151
|
+
) -> f64 {
|
|
152
|
+
// Check if there are any ties between the two groups
|
|
153
|
+
|
|
154
|
+
let mut combined = group1.clone();
|
|
155
|
+
combined.extend(group2.iter().cloned());
|
|
156
|
+
combined.sort_by(|a, b| a.partial_cmp(b).unwrap());
|
|
157
|
+
//println!("combined:{:?}", combined);
|
|
158
|
+
|
|
159
|
+
group1.sort_by(|a, b| a.partial_cmp(b).unwrap());
|
|
160
|
+
group2.sort_by(|a, b| a.partial_cmp(b).unwrap());
|
|
161
|
+
//println!("group1:{:?}", group1);
|
|
162
|
+
//println!("group2:{:?}", group2);
|
|
163
|
+
|
|
164
|
+
let mut group1_iter = 0;
|
|
165
|
+
let mut group2_iter = 0;
|
|
166
|
+
let mut xy: Vec<char> = Vec::with_capacity(combined.len()); // Stores X-Y classification
|
|
167
|
+
let mut ranks: Vec<f64> = Vec::with_capacity(combined.len()); // Stores the rank of each element
|
|
168
|
+
let mut is_repeat = false;
|
|
169
|
+
let mut repeat_present = false;
|
|
170
|
+
let mut frac_rank: f64 = 0.0;
|
|
171
|
+
let mut num_repeats: f64 = 1.0;
|
|
172
|
+
let mut repeat_iter: f64 = 1.0;
|
|
173
|
+
#[allow(unused_variables)]
|
|
174
|
+
let mut weight_x: f64 = 0.0;
|
|
175
|
+
let mut weight_y: f64 = 0.0;
|
|
176
|
+
let mut group_char: char = 'X';
|
|
177
|
+
let mut rank_frequencies: Vec<f64> = Vec::with_capacity(combined.len());
|
|
178
|
+
for i in 0..combined.len() {
|
|
179
|
+
//println!("group1_iter:{}", group1_iter);
|
|
180
|
+
//println!("group2_iter:{}", group2_iter);
|
|
181
|
+
//println!("item1:{}", combined[i]);
|
|
182
|
+
//println!("is_repeat:{}", is_repeat);
|
|
183
|
+
if group1_iter < group1.len() && combined[i] == group1[group1_iter] {
|
|
184
|
+
xy.push('X');
|
|
185
|
+
group1_iter += 1;
|
|
186
|
+
group_char = 'X';
|
|
187
|
+
} else if group2_iter < group2.len() && combined[i] == group2[group2_iter] {
|
|
188
|
+
xy.push('Y');
|
|
189
|
+
group2_iter += 1;
|
|
190
|
+
group_char = 'Y';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Computing ranks
|
|
194
|
+
if is_repeat == false {
|
|
195
|
+
// Check if current element has other occurences
|
|
196
|
+
num_repeats = 1.0;
|
|
197
|
+
for j in i + 1..combined.len() {
|
|
198
|
+
if combined[i] == combined[j] {
|
|
199
|
+
is_repeat = true;
|
|
200
|
+
repeat_present = true;
|
|
201
|
+
repeat_iter = 1.0;
|
|
202
|
+
num_repeats += 1.0;
|
|
203
|
+
} else {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//println!("num_repeats:{}", num_repeats);
|
|
208
|
+
if is_repeat == false {
|
|
209
|
+
ranks.push(i as f64 + 1.0);
|
|
210
|
+
if group_char == 'X' {
|
|
211
|
+
weight_x += i as f64 + 1.0;
|
|
212
|
+
} else if group_char == 'Y' {
|
|
213
|
+
weight_y += i as f64 + 1.0;
|
|
214
|
+
}
|
|
215
|
+
//rank_frequencies.push(RankFreq {
|
|
216
|
+
// rank: i as f64 + 1.0,
|
|
217
|
+
// freq: 1,
|
|
218
|
+
//});
|
|
219
|
+
rank_frequencies.push(1.0);
|
|
220
|
+
} else {
|
|
221
|
+
frac_rank = calculate_frac_rank(i as f64 + 1.0, num_repeats);
|
|
222
|
+
ranks.push(frac_rank);
|
|
223
|
+
if group_char == 'X' {
|
|
224
|
+
weight_x += frac_rank;
|
|
225
|
+
} else if group_char == 'Y' {
|
|
226
|
+
weight_y += frac_rank
|
|
227
|
+
}
|
|
228
|
+
//rank_frequencies.push(RankFreq {
|
|
229
|
+
// rank: frac_rank,
|
|
230
|
+
// freq: num_repeats as usize,
|
|
231
|
+
//});
|
|
232
|
+
rank_frequencies.push(num_repeats);
|
|
233
|
+
}
|
|
234
|
+
} else if repeat_iter < num_repeats {
|
|
235
|
+
// Repeat case
|
|
236
|
+
ranks.push(frac_rank);
|
|
237
|
+
repeat_iter += 1.0;
|
|
238
|
+
if group_char == 'X' {
|
|
239
|
+
weight_x += frac_rank;
|
|
240
|
+
} else if group_char == 'Y' {
|
|
241
|
+
weight_y += frac_rank
|
|
242
|
+
}
|
|
243
|
+
if repeat_iter == num_repeats {
|
|
244
|
+
is_repeat = false;
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
//println!("i:{}", i);
|
|
248
|
+
ranks.push(i as f64 + 1.0);
|
|
249
|
+
repeat_iter = 1.0;
|
|
250
|
+
num_repeats = 1.0;
|
|
251
|
+
if group_char == 'X' {
|
|
252
|
+
weight_x += i as f64 + 1.0;
|
|
253
|
+
} else if group_char == 'Y' {
|
|
254
|
+
weight_y += i as f64 + 1.0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
//println!("rank_frequencies:{:?}", rank_frequencies);
|
|
259
|
+
//println!("xy:{:?}", xy);
|
|
260
|
+
//println!("ranks:{:?}", ranks);
|
|
261
|
+
//println!("weight_x:{}", weight_x);
|
|
262
|
+
//println!("weight_y:{}", weight_y);
|
|
263
|
+
|
|
264
|
+
//u_dash (calculated below) calculates the "W Statistic" in wilcox.test function in R
|
|
265
|
+
|
|
266
|
+
let u_y = weight_y - (group2.len() as f64 * (group2.len() as f64 + 1.0) / 2.0) as f64;
|
|
267
|
+
let u_dash_y = (u_y - (group1.len() * group2.len()) as f64).abs();
|
|
268
|
+
//println!("u_dash_y:{}", u_dash_y);
|
|
269
|
+
|
|
270
|
+
let u_x = weight_x - (group1.len() as f64 * (group1.len() as f64 + 1.0) / 2.0) as f64;
|
|
271
|
+
let _u_dash_x = (u_x - (group1.len() * group2.len()) as f64).abs();
|
|
272
|
+
//println!("u_dash_x:{}", u_dash_x);
|
|
273
|
+
|
|
274
|
+
// Calculate test_statistic
|
|
275
|
+
|
|
276
|
+
//let t1 = weight_x - ((group1.len() as f64) * (group1.len() as f64 + 1.0)) / 2.0;
|
|
277
|
+
//let t2 = weight_y - ((group2.len() as f64) * (group2.len() as f64 + 1.0)) / 2.0;
|
|
278
|
+
//
|
|
279
|
+
//let mut test_statistic = t1;
|
|
280
|
+
//if t2 < t1 {
|
|
281
|
+
// test_statistic = t2;
|
|
282
|
+
//}
|
|
283
|
+
|
|
284
|
+
//println!("test_statistic:{}", test_statistic);
|
|
285
|
+
|
|
286
|
+
if group1.len() < threshold && group2.len() < threshold && repeat_present == false {
|
|
287
|
+
// Compute exact p-values
|
|
288
|
+
|
|
289
|
+
// Calculate conditional probability for weight_y
|
|
290
|
+
|
|
291
|
+
if alternative == 'g' {
|
|
292
|
+
// Alternative "greater"
|
|
293
|
+
//if group1.len() <= low_cutoff && group2.len() <= low_cutoff {
|
|
294
|
+
// iterate_exact_p_values(ranks, weight_y, group2.len())
|
|
295
|
+
//} else {
|
|
296
|
+
calculate_exact_probability(u_dash_y, group1.len(), group2.len(), alternative)
|
|
297
|
+
//}
|
|
298
|
+
} else if alternative == 'l' {
|
|
299
|
+
// Alternative "lesser"
|
|
300
|
+
//if group1.len() <= low_cutoff && group2.len() <= low_cutoff {
|
|
301
|
+
// iterate_exact_p_values(ranks, weight_x, group1.len())
|
|
302
|
+
//} else {
|
|
303
|
+
calculate_exact_probability(u_dash_y, group1.len(), group2.len(), alternative)
|
|
304
|
+
//}
|
|
305
|
+
} else {
|
|
306
|
+
// Two-sided distribution
|
|
307
|
+
calculate_exact_probability(u_dash_y, group1.len(), group2.len(), alternative)
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
// Compute p-values from a normal distribution
|
|
311
|
+
//println!("group1 length:{}", group1.len());
|
|
312
|
+
//println!("group2 length:{}", group2.len());
|
|
313
|
+
|
|
314
|
+
let mut z = u_dash_y - ((group1.len() * group2.len()) as f64) / 2.0;
|
|
315
|
+
//println!("z_original:{}", z);
|
|
316
|
+
let mut nties_sum: f64 = 0.0;
|
|
317
|
+
for i in 0..rank_frequencies.len() {
|
|
318
|
+
nties_sum += rank_frequencies[i] * rank_frequencies[i] * rank_frequencies[i]
|
|
319
|
+
- rank_frequencies[i];
|
|
320
|
+
}
|
|
379
321
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
//
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
//
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
//
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
//
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
//
|
|
409
|
-
|
|
410
|
-
//
|
|
411
|
-
//
|
|
412
|
-
//
|
|
413
|
-
|
|
414
|
-
|
|
322
|
+
let sigma = (((group1.len() * group2.len()) as f64) / 12.0
|
|
323
|
+
* ((group1.len() + group2.len() + 1) as f64
|
|
324
|
+
- nties_sum
|
|
325
|
+
/ (((group1.len() + group2.len()) as f64)
|
|
326
|
+
* ((group1.len() + group2.len() - 1) as f64))))
|
|
327
|
+
.sqrt();
|
|
328
|
+
//println!("sigma:{}", sigma);
|
|
329
|
+
let mut correction: f64 = 0.0;
|
|
330
|
+
if correct == true {
|
|
331
|
+
if alternative == 'g' {
|
|
332
|
+
// Alternative "greater"
|
|
333
|
+
correction = 0.5;
|
|
334
|
+
} else if alternative == 'l' {
|
|
335
|
+
// Alternative "lesser"
|
|
336
|
+
correction = -0.5;
|
|
337
|
+
} else {
|
|
338
|
+
// Alternative "two-sided"
|
|
339
|
+
if z > 0.0 {
|
|
340
|
+
correction = 0.5;
|
|
341
|
+
} else if z < 0.0 {
|
|
342
|
+
correction = -0.5;
|
|
343
|
+
} else {
|
|
344
|
+
// z=0
|
|
345
|
+
correction = 0.0;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
z = (z - correction) / sigma;
|
|
350
|
+
//println!("z:{}", z);
|
|
351
|
+
if alternative == 'g' {
|
|
352
|
+
// Alternative "greater"
|
|
353
|
+
//println!("greater:{}", n.cdf(weight_y));
|
|
354
|
+
//1.0 - n.cdf(z) // Applying continuity correction
|
|
355
|
+
r_mathlib::normal_cdf(z, 0.0, 1.0, false, false)
|
|
356
|
+
} else if alternative == 'l' {
|
|
357
|
+
// Alternative "lesser"
|
|
358
|
+
//println!("lesser:{}", n.cdf(weight_x));
|
|
359
|
+
//n.cdf(z) // Applying continuity coorection
|
|
360
|
+
r_mathlib::normal_cdf(z, 0.0, 1.0, true, false)
|
|
361
|
+
} else {
|
|
362
|
+
// Alternative "two-sided"
|
|
363
|
+
let p_g = r_mathlib::normal_cdf(z, 0.0, 1.0, false, false); // Applying continuity correction
|
|
364
|
+
let p_l = r_mathlib::normal_cdf(z, 0.0, 1.0, true, false); // Applying continuity correction
|
|
365
|
+
let mut p_value;
|
|
366
|
+
if p_g < p_l {
|
|
367
|
+
p_value = 2.0 * p_g;
|
|
368
|
+
} else {
|
|
369
|
+
p_value = 2.0 * p_l;
|
|
370
|
+
}
|
|
371
|
+
//println!("p_value:{}", p_value);
|
|
372
|
+
if p_value > 1.0 {
|
|
373
|
+
p_value = 1.0;
|
|
374
|
+
}
|
|
375
|
+
p_value
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// To be used only when there are no ties in the input data
|
|
381
|
+
#[allow(dead_code)]
|
|
382
|
+
fn calculate_exact_probability(weight: f64, x: usize, y: usize, alternative: char) -> f64 {
|
|
383
|
+
//println!("Using Wilcoxon CDF");
|
|
384
|
+
let mut p_value;
|
|
385
|
+
if alternative == 't' {
|
|
386
|
+
if weight > ((x * y) as f64) / 2.0 {
|
|
387
|
+
p_value = 2.0 * r_mathlib::wilcox_cdf(weight - 1.0, x as f64, y as f64, false, false);
|
|
388
|
+
} else {
|
|
389
|
+
p_value = 2.0 * r_mathlib::wilcox_cdf(weight, x as f64, y as f64, true, false);
|
|
390
|
+
}
|
|
391
|
+
if p_value > 1.0 {
|
|
392
|
+
p_value = 1.0;
|
|
393
|
+
}
|
|
394
|
+
} else if alternative == 'g' {
|
|
395
|
+
p_value = r_mathlib::wilcox_cdf(weight - 1.0, x as f64, y as f64, false, false);
|
|
396
|
+
} else if alternative == 'l' {
|
|
397
|
+
p_value = r_mathlib::wilcox_cdf(weight, x as f64, y as f64, true, false);
|
|
398
|
+
} else {
|
|
399
|
+
// Should not happen
|
|
400
|
+
panic!("Unknown alternative option given, please check!");
|
|
401
|
+
}
|
|
402
|
+
//println!("p_value:{}", p_value);
|
|
403
|
+
p_value
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
#[allow(dead_code)]
|
|
407
|
+
pub fn calculate_frac_rank(current_rank: f64, num_repeats: f64) -> f64 {
|
|
408
|
+
let mut sum = 0.0;
|
|
409
|
+
for i in 0..num_repeats as usize {
|
|
410
|
+
let rank = current_rank + i as f64;
|
|
411
|
+
sum += rank;
|
|
412
|
+
}
|
|
413
|
+
sum / num_repeats
|
|
414
|
+
}
|