Skip to content

Commit

Permalink
Fix #3237 Add prep ID to artifacts list included in an analysis (#3238)
Browse files Browse the repository at this point in the history
* Add prep ID to artifacts list included in an analysis

This will make it easier to track back to individual artifacts.

* Test updated

* Updated test

* Fixes based on feedback
  • Loading branch information
charles-cowart committed Jan 26, 2023
1 parent 74404c4 commit 16f415c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion qiita_pet/handlers/analysis_handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ def analysis_description_handler_get_request(analysis_id, user):
artifacts = {}
for aid, samples in analysis.samples.items():
artifact = Artifact(aid)
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)
study.id, study.title, artifact.merging_scheme, samples, prep_ids)

return {'analysis_name': analysis.name,
'analysis_id': analysis.id,
Expand Down
19 changes: 10 additions & 9 deletions qiita_pet/handlers/analysis_handlers/tests/test_base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}))
Expand All @@ -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)

Expand All @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions qiita_pet/templates/analysis_description.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ <h2>
<thead>
<tr>
<th>Artifact ID</th>
<th>Prep IDs</th>
<th>Study Title</th>
<th>Parent Processing</th>
<th>Merging Scheme</th>
Expand All @@ -76,6 +77,7 @@ <h2>
{% for aid, data in artifacts.items() %}
<tr>
<td>{{aid}}</td>
<td>{{', '.join(data[4])}}</td>
<td><a href="{% raw qiita_config.portal_dir %}/study/description/{{data[0]}}" target="_blank">{{data[1]}}</a></td>
<td>{{data[2][1]}}</td>
<td>{{data[2][0]}}</td>
Expand Down

0 comments on commit 16f415c

Please sign in to comment.