diff options
-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]) |