From 8071a53c2f1ff5a33d57f69aa45bef2248a7fc85 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Sat, 2 May 2015 10:04:33 -0600 Subject: [PATCH 1/4] fix #947 --- qiita_pet/handlers/analysis_handlers.py | 16 ++++-- qiita_pet/templates/analysis_results.html | 60 ++++++++++++++--------- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/qiita_pet/handlers/analysis_handlers.py b/qiita_pet/handlers/analysis_handlers.py index 5c013396b..fa377366e 100644 --- a/qiita_pet/handlers/analysis_handlers.py +++ b/qiita_pet/handlers/analysis_handlers.py @@ -30,6 +30,7 @@ check_access_to_analysis_result, filepath_ids_to_rel_paths) from qiita_db.exceptions import QiitaDBUnknownIDError +from qiita_db.study import Study SELECT_SAMPLES = 2 SELECT_COMMANDS = 3 @@ -141,14 +142,19 @@ def get(self, analysis_id): jobres[jobject.datatype].append((jobject.command[0], jobject.results)) - dropped = {} dropped_samples = analysis.dropped_samples + dropped = {} if dropped_samples: - for proc_data_id, samples in viewitems(dropped_samples): + for proc_data_id, samples in viewitems(analysis.dropped_samples): + if not samples: + continue proc_data = ProcessedData(proc_data_id) - key = "Data type %s, Study: %s" % (proc_data.data_type(), - proc_data.study) - dropped[key] = samples + data_type = proc_data.data_type() + study = proc_data.study + if data_type not in dropped: + dropped[data_type] = [] + dropped[data_type].append({'study': Study(study).title, + 'samples': samples}) self.render("analysis_results.html", jobres=jobres, aname=analysis.name, dropped=dropped, diff --git a/qiita_pet/templates/analysis_results.html b/qiita_pet/templates/analysis_results.html index 1a6153df6..bdc545271 100644 --- a/qiita_pet/templates/analysis_results.html +++ b/qiita_pet/templates/analysis_results.html @@ -11,44 +11,60 @@
-

Analysis {{aname}}

- - {% if dropped %} -

Dropped Samples

- These samples were dropped during processing due to rarefaction: - - {% for study, samples in viewitems(dropped) %} - - - - - {% end %} -
For {{study}}:{{', '.join(samples)}}
-
- {% end %} +

Analysis: {{aname}}

+
+
+
+ {% if dropped %} +
+ +
+
+ {% for data_type, studies in viewitems(dropped) %} + {{data_type}} +

+ {% for s in studies %} + {{s['study']}}: +
+ Total dropped: {{len(s['samples'])}} +
+ {{', '.join(s['samples'])}}
+ {% end %} +
+ {% end %} +
+
+
+ {% end %} +
+
+
+
-{% for data_type, jobs in jobres.items() %} + {% for data_type, jobs in jobres.items() %}
-{% for job, results in jobs%} + {% for job, results in jobs%}
{{job}}
- {% if len(results) == 0 %} + {% if len(results) == 0 %}

ERROR

- {% end %} - {%for result in results%} + {% end %} + {%for result in results%} {{basename(result)}}
- {% end %} + {% end %}
-{% end %} + {% end %}
{% end %} From 11e71a55348f648e1dc22e549f4337161c9a8626 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Sat, 2 May 2015 10:17:12 -0600 Subject: [PATCH 2/4] adding space in title --- qiita_pet/templates/analysis_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiita_pet/templates/analysis_results.html b/qiita_pet/templates/analysis_results.html index bdc545271..7fe20187f 100644 --- a/qiita_pet/templates/analysis_results.html +++ b/qiita_pet/templates/analysis_results.html @@ -11,7 +11,7 @@
-

Analysis: {{aname}}

+

 Analysis: {{aname}}

From d57bd9768856de57a7147096da49ce7dbc38f152 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Sat, 2 May 2015 18:48:10 -0600 Subject: [PATCH 3/4] addressing @josenavas suggestions --- qiita_pet/handlers/analysis_handlers.py | 8 +++----- qiita_pet/templates/analysis_results.html | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/qiita_pet/handlers/analysis_handlers.py b/qiita_pet/handlers/analysis_handlers.py index fa377366e..eb604211a 100644 --- a/qiita_pet/handlers/analysis_handlers.py +++ b/qiita_pet/handlers/analysis_handlers.py @@ -143,7 +143,7 @@ def get(self, analysis_id): jobject.results)) dropped_samples = analysis.dropped_samples - dropped = {} + dropped = defaultdict(list) if dropped_samples: for proc_data_id, samples in viewitems(analysis.dropped_samples): if not samples: @@ -151,10 +151,8 @@ def get(self, analysis_id): proc_data = ProcessedData(proc_data_id) data_type = proc_data.data_type() study = proc_data.study - if data_type not in dropped: - dropped[data_type] = [] - dropped[data_type].append({'study': Study(study).title, - 'samples': samples}) + dropped[data_type].append((Study(study).title, len(samples), + ', '.join(samples))) self.render("analysis_results.html", jobres=jobres, aname=analysis.name, dropped=dropped, diff --git a/qiita_pet/templates/analysis_results.html b/qiita_pet/templates/analysis_results.html index 7fe20187f..c13573a3b 100644 --- a/qiita_pet/templates/analysis_results.html +++ b/qiita_pet/templates/analysis_results.html @@ -28,12 +28,12 @@

{{data_type}}

- {% for s in studies %} - {{s['study']}}: + {% for title, num_samples, samples in studies %} + {{title}}:
- Total dropped: {{len(s['samples'])}} + Total dropped: {{num_samples}}
- {{', '.join(s['samples'])}}
+ {{samples}}
{% end %}
{% end %} From 1bea0cd7e11027664dd70d3f4dfc8db66111cf68 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Mon, 4 May 2015 17:00:39 -0600 Subject: [PATCH 4/4] fix-947 --- qiita_pet/handlers/analysis_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiita_pet/handlers/analysis_handlers.py b/qiita_pet/handlers/analysis_handlers.py index eb604211a..539d9384e 100644 --- a/qiita_pet/handlers/analysis_handlers.py +++ b/qiita_pet/handlers/analysis_handlers.py @@ -145,7 +145,7 @@ def get(self, analysis_id): dropped_samples = analysis.dropped_samples dropped = defaultdict(list) if dropped_samples: - for proc_data_id, samples in viewitems(analysis.dropped_samples): + for proc_data_id, samples in viewitems(dropped_samples): if not samples: continue proc_data = ProcessedData(proc_data_id)