diff options
author | zsloan | 2021-04-09 17:40:53 +0000 |
---|---|---|
committer | zsloan | 2021-04-09 17:40:53 +0000 |
commit | e7b589f05e1c13612ea2f7245d66cc3f054fa14b (patch) | |
tree | 95cff2d9c458d54c33822a7d68df33473941bb29 | |
parent | ef51e08753defdfc7f3e67f8788cd1362d2cf631 (diff) | |
download | genenetwork2-e7b589f05e1c13612ea2f7245d66cc3f054fa14b.tar.gz |
Added varaiable 'categorical_attr_exists' tracking whether there are any case attributes with fewer than 10 distinct values, since it currently throws a JS error if case attributes exist but none have fewer than 10 distinct values (specifically when we have RRID as a case attribute)
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 878c41c0..d3267190 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -203,6 +203,13 @@ class ShowTrait(object): if sample.value < 0: self.negative_vals_exist = "true" + #ZS: Check whether any attributes have few enough distinct values to show the "Block samples by group" option + self.categorical_attr_exists = False + for attribute in self.sample_groups[0].attributes: + if len(self.sample_groups[0].attributes[attribute].distinct_values) <= 10: + self.categorical_attr_exists = True + break + sample_column_width = max_samplename_width * 8 self.stats_table_width, self.trait_table_width = get_table_widths(self.sample_groups, sample_column_width, self.has_num_cases) @@ -277,6 +284,7 @@ class ShowTrait(object): se_exists = self.sample_groups[0].se_exists, has_num_cases = self.has_num_cases, attributes = self.sample_groups[0].attributes, + categorical_attr_exists = self.categorical_attr_exists, categorical_vars = ",".join(categorical_var_list), num_values = self.num_values, qnorm_values = self.qnorm_vals, |