From b6d85544409ae204b1377a4c6793d53e0bfd4f6c Mon Sep 17 00:00:00 2001 From: Charles Cowart Date: Wed, 25 Jan 2023 16:34:07 -0800 Subject: [PATCH 1/4] Add prep ID to artifacts list included in an analysis This will make it easier to track back to individual artifacts. --- qiita_pet/handlers/analysis_handlers/base_handlers.py | 3 ++- qiita_pet/templates/analysis_description.html | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qiita_pet/handlers/analysis_handlers/base_handlers.py b/qiita_pet/handlers/analysis_handlers/base_handlers.py index a063d64f8..f8a078967 100644 --- a/qiita_pet/handlers/analysis_handlers/base_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/base_handlers.py @@ -74,9 +74,10 @@ def analysis_description_handler_get_request(analysis_id, user): artifacts = {} for aid, samples in analysis.samples.items(): artifact = Artifact(aid) + foo = list(set([str(x.id) for x in artifact.prep_templates])) study = artifact.study artifacts[aid] = ( - study.id, study.title, artifact.merging_scheme, samples) + study.id, study.title, artifact.merging_scheme, samples, foo) return {'analysis_name': analysis.name, 'analysis_id': analysis.id, diff --git a/qiita_pet/templates/analysis_description.html b/qiita_pet/templates/analysis_description.html index cf9f611c0..e3e966869 100644 --- a/qiita_pet/templates/analysis_description.html +++ b/qiita_pet/templates/analysis_description.html @@ -66,6 +66,7 @@

Artifact ID + Prep IDs Study Title Parent Processing Merging Scheme @@ -76,6 +77,7 @@

{% for aid, data in artifacts.items() %} {{aid}} + {{', '.join(data[4])}} {{data[1]}} {{data[2][1]}} {{data[2][0]}} From af14fc56a4f91b7e8f45dec7957bd68980959543 Mon Sep 17 00:00:00 2001 From: Charles Cowart Date: Wed, 25 Jan 2023 17:18:57 -0800 Subject: [PATCH 2/4] Test updated --- .../handlers/analysis_handlers/tests/test_base_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py index ee30f1b91..0ff4b0810 100644 --- a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py @@ -126,7 +126,7 @@ def test_analyisis_graph_handler_get_request(self): 'artifacts_being_deleted': [], 'nodes': [ ('job', 'job', job_id, 'Single Rarefaction', 'success'), - ('artifact', 'BIOM', 9, 'noname\n(BIOM)', 'outdated'), + ('artifact', 'BIOM', 9, 'noname\n(BIOM)', 'artifact'), ('artifact', 'BIOM', 8, 'noname\n(BIOM)', 'artifact')], 'workflow': None} self.assertCountEqual(obs, exp) From e7ee6f62ab58a2eb0606ff6a6c8bdbb63d639a97 Mon Sep 17 00:00:00 2001 From: Charles Cowart Date: Wed, 25 Jan 2023 17:59:22 -0800 Subject: [PATCH 3/4] Updated test --- .../tests/test_base_handlers.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py index 0ff4b0810..495feb149 100644 --- a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py @@ -45,18 +45,19 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'])}, + '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, 'alert_msg': ''} + self.assertEqual(obs, exp) r_client.set('analysis_1', dumps({'job_id': 'job_id'})) @@ -73,17 +74,17 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'])}, + '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, 'alert_msg': 'An artifact is being deleted from this analysis'} self.assertEqual(obs, exp) @@ -103,17 +104,17 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192']), + '1.SKM4.640180', '1.SKM9.640192'], ['1']), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'])}, + '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, 'alert_msg': 'Error deleting artifact'} self.assertEqual(obs, exp) @@ -126,7 +127,7 @@ def test_analyisis_graph_handler_get_request(self): 'artifacts_being_deleted': [], 'nodes': [ ('job', 'job', job_id, 'Single Rarefaction', 'success'), - ('artifact', 'BIOM', 9, 'noname\n(BIOM)', 'artifact'), + ('artifact', 'BIOM', 9, 'noname\n(BIOM)', 'outdated'), ('artifact', 'BIOM', 8, 'noname\n(BIOM)', 'artifact')], 'workflow': None} self.assertCountEqual(obs, exp) From 49f7ffafc43b778b3e04d5a82769bd464deb1e46 Mon Sep 17 00:00:00 2001 From: Charles Cowart Date: Thu, 26 Jan 2023 11:17:25 -0800 Subject: [PATCH 4/4] Fixes based on feedback --- .../analysis_handlers/base_handlers.py | 4 ++-- .../tests/test_base_handlers.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/qiita_pet/handlers/analysis_handlers/base_handlers.py b/qiita_pet/handlers/analysis_handlers/base_handlers.py index f8a078967..782d24f27 100644 --- a/qiita_pet/handlers/analysis_handlers/base_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/base_handlers.py @@ -74,10 +74,10 @@ def analysis_description_handler_get_request(analysis_id, user): artifacts = {} for aid, samples in analysis.samples.items(): artifact = Artifact(aid) - foo = list(set([str(x.id) for x in artifact.prep_templates])) + prep_ids = set([str(x.id) for x in artifact.prep_templates]) study = artifact.study artifacts[aid] = ( - study.id, study.title, artifact.merging_scheme, samples, foo) + study.id, study.title, artifact.merging_scheme, samples, prep_ids) return {'analysis_name': analysis.name, 'analysis_id': analysis.id, diff --git a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py index 495feb149..a72c3c848 100644 --- a/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py @@ -45,17 +45,17 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, + '1.SKM4.640180', '1.SKM9.640192'], {'1'})}, 'alert_msg': ''} self.assertEqual(obs, exp) @@ -74,17 +74,17 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, + '1.SKM4.640180', '1.SKM9.640192'], {'1'})}, 'alert_msg': 'An artifact is being deleted from this analysis'} self.assertEqual(obs, exp) @@ -104,17 +104,17 @@ def test_analysis_description_handler_get_request(self): 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 5: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1']), + '1.SKM4.640180', '1.SKM9.640192'], {'1'}), 6: (1, 'Identification of the Microbiomes for Cannabis ' 'Soils', ('Pick closed-reference OTUs | Split ' 'libraries FASTQ', 'QIIME v1.9.1'), [ '1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184', - '1.SKM4.640180', '1.SKM9.640192'], ['1'])}, + '1.SKM4.640180', '1.SKM9.640192'], {'1'})}, 'alert_msg': 'Error deleting artifact'} self.assertEqual(obs, exp)