Commit 613b568e authored by Ryan Herbert's avatar Ryan Herbert

sample_set.py stats_decorator.py add stats decoration

Adds the bassis for decorating fields in the multi sample stats
controler. the idea being that not all data is to be represented in
textual or numerical format, so we can use a decorator to generate an
html object from the data.
See #2235
parent ff6410ca
......@@ -654,7 +654,8 @@ def custom():
group_ids=group_ids)
def getStatHeaders():
return [('set_id', 'db'), ('set_name', 'db'), ('set_info', 'db'), ('main_clone', 'parser'), ('reads', 'parser'), ('mapped', 'parser')]
m = StatDecorator()
return [('set_id', 'db', m), ('set_name', 'db', m), ('set_info', 'db', m), ('main_clone', 'parser', m), ('reads', 'parser', m), ('mapped', 'parser', m)]
def getResultsFileStats(file_name, dest):
file_path = "%s%s" % (defs.DIR_RESULTS, file_name)
......@@ -724,9 +725,9 @@ def getStatData(results_file_ids):
d = {}
set_type = res.sample_type
headers = getStatHeaders()
for head, htype in headers:
for head, htype, model in headers:
if htype == 'db':
d[head] = res[head] if res[head] is not None else ""
d[head] = model.decorate(res[head])
d['set_name'] = helpers[set_type].get_name(res[set_type])
d = getFusedStats(res.fused_file, res, d)
data.append(d)
......@@ -734,7 +735,7 @@ def getStatData(results_file_ids):
def multi_sample_stats():
data = {}
data['headers'] = [h for h, t in getStatHeaders()]
data['headers'] = [h for h, t, m in getStatHeaders()]
results = []
custom_result = request.vars['custom_result']
if not isinstance(custom_result, list):
......
import vidjil_utils
class StatDecorator():
def __init__(self):
pass
def decorate(self, data):
return data if data is not None else ""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment