Skip to content

Commit

Permalink
fix rank percentile denominator
Browse files Browse the repository at this point in the history
  • Loading branch information
iblacksand committed Nov 16, 2023
1 parent 38fe338 commit 453c4ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webgestalt_lib/src/methods/multiomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ fn normalize(list: &mut Vec<RankListItem>, method: NormalizationMethod) -> Vec<R
.expect("Invalid float comparison during normalization")
});
let median = list.len() as f64 / 2.0;
let len: f64 = list.len() as f64;
let mut final_list: Vec<RankListItem> = Vec::new();
for (i, item) in list.iter().enumerate() {
final_list.push(RankListItem {
analyte: item.analyte.clone(),
rank: (i as f64 - median) / median,
rank: (i as f64 - median) / len,
});
}
final_list
Expand Down

0 comments on commit 453c4ab

Please sign in to comment.