aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/show_trait/export_trait_data.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/wqflask/wqflask/show_trait/export_trait_data.py b/wqflask/wqflask/show_trait/export_trait_data.py
index 7fabc3f6..4b328a4a 100644
--- a/wqflask/wqflask/show_trait/export_trait_data.py
+++ b/wqflask/wqflask/show_trait/export_trait_data.py
@@ -16,15 +16,24 @@ def export_sample_table(targs):
final_sample_data = meta_data
column_headers = ["Name", "Value"]
+ attr_pos = 2
if any(sample["se"] for sample in sample_data['primary_samples']):
column_headers.append("SE")
+ attr_pos = 3
if any(sample["num_cases"] for sample in sample_data['primary_samples']):
column_headers.append("N")
+ attr_pos = 4
+
+ for key in sample_data["primary_samples"][0].keys():
+ if key not in ["name", "value", "se", "num_cases"]:
+ column_headers.append(key)
final_sample_data.append(column_headers)
for sample_group in ['primary_samples', 'other_samples']:
for row in sample_data[sample_group]:
- sorted_row = dict_to_sorted_list(row)
+ sorted_row = dict_to_sorted_list(row)[:attr_pos]
+ for attr in sample_data['attributes']:
+ sorted_row.append(row[attr])
final_sample_data.append(sorted_row)
return trait_name, final_sample_data