diff options
author | zsloan | 2022-08-31 19:15:03 +0000 |
---|---|---|
committer | zsloan | 2022-08-31 19:15:03 +0000 |
commit | 72c01fe48285725b24b76d7c6e82eee3148ad59e (patch) | |
tree | 485337073e3f72502ce9612c42d4b3aa659dc0a0 /wqflask | |
parent | 58fc24b17e2f3dc326e7e764df0c31c53292b9e1 (diff) | |
download | genenetwork2-72c01fe48285725b24b76d7c6e82eee3148ad59e.tar.gz |
Move normf function out of quantile_normalize_vals so it can be imported by mapping api
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index d9821d9c..c1d9ad84 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -550,21 +550,21 @@ def get_max_digits(trait_vals): return max_digits -def quantile_normalize_vals(sample_groups, trait_vals): - def normf(trait_vals): - ranked_vals = ss.rankdata(trait_vals) - p_list = [] - for i, val in enumerate(trait_vals): - p_list.append(((i + 1) - 0.5) / len(trait_vals)) +def normf(trait_vals): + ranked_vals = ss.rankdata(trait_vals) + p_list = [] + for i, val in enumerate(trait_vals): + p_list.append(((i + 1) - 0.5) / len(trait_vals)) - z = ss.norm.ppf(p_list) + z = ss.norm.ppf(p_list) - normed_vals = [] - for rank in ranked_vals: - normed_vals.append("%0.3f" % z[int(rank) - 1]) + normed_vals = [] + for rank in ranked_vals: + normed_vals.append("%0.3f" % z[int(rank) - 1]) - return normed_vals + return normed_vals +def quantile_normalize_vals(sample_groups, trait_vals): qnorm_by_group = [] for i, sample_type in enumerate(sample_groups): qnorm_vals = normf(trait_vals[i]) |