Skip to content

Commit

Permalink
Merge f3825fc into 58e15a4
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanssen2 committed Feb 19, 2024
2 parents 58e15a4 + f3825fc commit c2e0a10
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 50 deletions.
30 changes: 15 additions & 15 deletions qiita_db/handlers/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class UtilTests(TestCase):
def test_get_plugin(self):
obs = _get_plugin("QIIME", "1.9.1")
obs = _get_plugin("QIIMEq2", "1.9.1")
exp = qdb.software.Software(1)
self.assertEqual(obs, exp)

Expand All @@ -27,7 +27,7 @@ def test_get_plugin(self):
_get_plugin("QiIME", "1.9.1")

def test_get_command(self):
obs = _get_command('QIIME', '1.9.1', 'Split libraries FASTQ')
obs = _get_command('QIIMEq2', '1.9.1', 'Split libraries FASTQ')
exp = qdb.software.Command(1)
self.assertEqual(obs, exp)

Expand All @@ -38,18 +38,18 @@ def test_get_command(self):

class PluginHandlerTests(OauthTestingBase):
def test_get_plugin_does_not_exist(self):
obs = self.get('/qiita_db/plugins/QIIME/1.9.0/', headers=self.header)
obs = self.get('/qiita_db/plugins/QIIMEq2/1.9.0/', headers=self.header)
self.assertEqual(obs.code, 404)

def test_get_no_header(self):
obs = self.get('/qiita_db/plugins/QIIME/1.9.0/')
obs = self.get('/qiita_db/plugins/QIIMEq2/1.9.0/')
self.assertEqual(obs.code, 400)

def test_get(self):
obs = self.get('/qiita_db/plugins/QIIME/1.9.1/', headers=self.header)
obs = self.get('/qiita_db/plugins/QIIMEq2/1.9.1/', headers=self.header)
self.assertEqual(obs.code, 200)
exp = {
'name': 'QIIME',
'name': 'QIIMEq2',
'version': '1.9.1',
'description': 'Quantitative Insights Into Microbial Ecology '
'(QIIME) is an open-source bioinformatics pipeline '
Expand Down Expand Up @@ -85,10 +85,10 @@ def test_post(self):
'param2': '2.4',
'param3': 'False'}})
}
obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
obs = self.post('/qiita_db/plugins/QIIMEq2/1.9.1/commands/', data=data,
headers=self.header)
self.assertEqual(obs.code, 200)
obs = _get_command('QIIME', '1.9.1', 'New Command')
obs = _get_command('QIIMEq2', '1.9.1', 'New Command')
self.assertEqual(obs.name, 'New Command')
self.assertFalse(obs.analysis_only)

Expand All @@ -106,10 +106,10 @@ def test_post(self):
'default_parameter_sets': dumps({'dflt1': {'param1': 'test'}}),
'analysis_only': True
}
obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
obs = self.post('/qiita_db/plugins/QIIMEq2/1.9.1/commands/', data=data,
headers=self.header)
self.assertEqual(obs.code, 200)
obs = _get_command('QIIME', '1.9.1', 'New analysis command')
obs = _get_command('QIIMEq2', '1.9.1', 'New analysis command')
self.assertEqual(obs.name, 'New analysis command')
self.assertTrue(obs.analysis_only)
self.assertEqual(obs.merging_scheme,
Expand All @@ -125,12 +125,12 @@ def test_get_command_does_not_exist(self):

def test_get_no_header(self):
obs = self.get(
'/qiita_db/plugins/QIIME/1.9.1/commands/Split%20libraries/')
'/qiita_db/plugins/QIIMEq2/1.9.1/commands/Split%20libraries/')
self.assertEqual(obs.code, 400)

def test_get(self):
obs = self.get(
'/qiita_db/plugins/QIIME/1.9.1/commands/Split%20libraries/',
'/qiita_db/plugins/QIIMEq2/1.9.1/commands/Split%20libraries/',
headers=self.header)
self.assertEqual(obs.code, 200)
exp = {'name': 'Split libraries',
Expand Down Expand Up @@ -195,20 +195,20 @@ def test_get(self):

class CommandActivateHandlerTests(OauthTestingBase):
def test_post_command_does_not_exist(self):
obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/'
obs = self.post('/qiita_db/plugins/QIIMEq2/1.9.1/commands/'
'UNKNOWN/activate/',
headers=self.header, data={})
self.assertEqual(obs.code, 404)

def test_post_no_header(self):
obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/'
obs = self.post('/qiita_db/plugins/QIIMEq2/1.9.1/commands/'
'Split%20libraries/activate/', data={})
self.assertEqual(obs.code, 400)

def test_post(self):
qdb.software.Software.deactivate_all()
self.assertFalse(qdb.software.Command(2).active)
obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/'
obs = self.post('/qiita_db/plugins/QIIMEq2/1.9.1/commands/'
'Split%20libraries/activate/', headers=self.header,
data={})
self.assertEqual(obs.code, 200)
Expand Down
6 changes: 4 additions & 2 deletions qiita_db/handlers/tests/test_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ class ProcessingJobAPItestHandlerTests(OauthTestingBase):
def test_post_processing_job(self):
data = {
'user': 'demo@microbio.me',
'command': dumps(['QIIME', '1.9.1', 'Pick closed-reference OTUs']),
'command': dumps(['QIIMEq2', '1.9.1',
'Pick closed-reference OTUs']),
'parameters': dumps({"reference": 1,
"sortmerna_e_value": 1,
"sortmerna_max_pos": 10000,
Expand All @@ -298,7 +299,8 @@ def test_post_processing_job(self):
def test_post_processing_job_status(self):
data = {
'user': 'demo@microbio.me',
'command': dumps(['QIIME', '1.9.1', 'Pick closed-reference OTUs']),
'command': dumps(['QIIMEq2', '1.9.1',
'Pick closed-reference OTUs']),
'status': 'running',
'parameters': dumps({"reference": 1,
"sortmerna_e_value": 1,
Expand Down
15 changes: 15 additions & 0 deletions qiita_db/support_files/patches/91.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Feb 19, 2024
-- update qp-target-gene command name to "QIIMEq2" to be in sync with plugin repo
-- When setting up a new instance of Qiita, we end up using qiita-env make
-- which creates entries in the postgress database, also for qiita.software.
-- One of these entries belongs to the qp-target-gene plugin with name "QIIME"
-- and version "1.9.1". However, with
-- qp_target_gene/support_files/patches/171029_QIIME_v191_to_QIIMEq2_v191.sql
-- the plugin was renamed into QIIMEq2, but this change was not relected in
-- the qiita.software table. Thus, updating plugin information finds a mismatch
-- between old (QIIME) and new (QIIMEq2) names and therefor creates a new
-- command. However, the also provided default workflows hold command_ids to
-- the old version and subsequently the commands for artifact processing
-- will result in an empty list, even though the plugin is available.
-- Therefore, this patch updates the name of QIIME.
UPDATE qiita.software SET name = 'QIIMEq2' WHERE name = 'QIIME';
4 changes: 2 additions & 2 deletions qiita_db/test/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ def test_merging_scheme(self):
('Split libraries FASTQ | N/A', 'N/A'))
self.assertEqual(qdb.artifact.Artifact(4).merging_scheme,
('Pick closed-reference OTUs | Split libraries FASTQ',
'QIIME v1.9.1'))
'QIIMEq2 v1.9.1'))
self.assertEqual(qdb.artifact.Artifact(5).merging_scheme,
('Pick closed-reference OTUs | Split libraries FASTQ',
'QIIME v1.9.1'))
'QIIMEq2 v1.9.1'))

def test_jobs(self):
# Returning all jobs
Expand Down
12 changes: 6 additions & 6 deletions qiita_db/test/test_meta_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ def test_generate_biom_and_metadata_release(self):
'processed_data/1_study_1001_closed_reference_otu_table.biom\t'
'%s\t%s\t4\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ\t'
'QIIME v1.9.1\tQIIME v1.9.1\n' % (fn_sample, fn_prep),
'QIIMEq2 v1.9.1\tQIIMEq2 v1.9.1\n' % (fn_sample, fn_prep),
'processed_data/1_study_1001_closed_reference_otu_table.biom\t'
'%s\t%s\t5\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ\t'
'QIIME v1.9.1\tQIIME v1.9.1\n' % (fn_sample, fn_prep),
'QIIMEq2 v1.9.1\tQIIMEq2 v1.9.1\n' % (fn_sample, fn_prep),
'processed_data/1_study_1001_closed_reference_otu_table_Silva.bio'
'm\t%s\t%s\t6\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ\t'
'QIIME v1.9.1\tQIIME v1.9.1' % (fn_sample, fn_prep)]
'QIIMEq2 v1.9.1\tQIIMEq2 v1.9.1' % (fn_sample, fn_prep)]
self.assertEqual(txt_obs, txt_exp)

# whatever the configuration was, we will change to settings so we can
Expand Down Expand Up @@ -465,15 +465,15 @@ def test_generate_biom_and_metadata_release(self):
'processed_data/1_study_1001_closed_reference_otu_table.biom\t'
'%s\t%s\t4\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ\t'
'QIIME v1.9.1\tQIIME v1.9.1\n' % (fn_sample, fn_prep),
'QIIMEq2 v1.9.1\tQIIMEq2 v1.9.1\n' % (fn_sample, fn_prep),
'processed_data/1_study_1001_closed_reference_otu_table.biom\t'
'%s\t%s\t5\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ\t'
'QIIME v1.9.1\tQIIME v1.9.1\n' % (fn_sample, fn_prep),
'QIIMEq2 v1.9.1\tQIIMEq2 v1.9.1\n' % (fn_sample, fn_prep),
'processed_data/1_study_1001_closed_reference_otu_table_Silva.bio'
'm\t%s\t%s\t6\tIllumina\t16S rRNA\t'
'Pick closed-reference OTUs | Split libraries FASTQ'
'\tQIIME v1.9.1\tQIIME v1.9.1' % (fn_sample, fn_prep)]
'\tQIIMEq2 v1.9.1\tQIIMEq2 v1.9.1' % (fn_sample, fn_prep)]
self.assertEqual(txt_obs, txt_exp)

# returning configuration
Expand Down
26 changes: 13 additions & 13 deletions qiita_db/test/test_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ def test_create_error(self):
self.outputs)

# the output type doesn't exist
with self.assertRaisesRegex(ValueError, "Error creating QIIME, Split "
"libraries - wrong output, This is a "
with self.assertRaisesRegex(ValueError, "Error creating QIIMEq2, Split"
" libraries - wrong output, This is a "
"command for testing - Unknown "
"artifact_type: BLA!"):
qdb.software.Command.create(
Expand Down Expand Up @@ -567,7 +567,7 @@ def tearDown(self):
remove(f)

def test_from_name_and_version(self):
obs = qdb.software.Software.from_name_and_version('QIIME', '1.9.1')
obs = qdb.software.Software.from_name_and_version('QIIMEq2', '1.9.1')
exp = qdb.software.Software(1)
self.assertEqual(obs, exp)

Expand All @@ -578,13 +578,13 @@ def test_from_name_and_version(self):

# Wrong name
with self.assertRaises(qdb.exceptions.QiitaDBUnknownIDError):
qdb.software.Software.from_name_and_version('QiIME', '1.9.1')
qdb.software.Software.from_name_and_version('QiIMEq2', '1.9.1')
# Wrong version
with self.assertRaises(qdb.exceptions.QiitaDBUnknownIDError):
qdb.software.Software.from_name_and_version('QIIME', '1.9.0')
qdb.software.Software.from_name_and_version('QIIMEq2', '1.9.0')

def test_name(self):
self.assertEqual(qdb.software.Software(1).name, "QIIME")
self.assertEqual(qdb.software.Software(1).name, "QIIMEq2")

def test_version(self):
self.assertEqual(qdb.software.Software(1).version, "1.9.1")
Expand Down Expand Up @@ -694,7 +694,7 @@ def test_from_file(self):
self._clean_up_files.append(fp)
with open(fp, 'w') as f:
f.write(CONF_TEMPLATE %
('QIIME', '1.9.1',
('QIIMEq2', '1.9.1',
'Quantitative Insights Into Microbial Ecology (QIIME) '
'is an open-source bioinformatics pipeline for '
'performing microbiome analysis from raw DNA '
Expand All @@ -711,18 +711,18 @@ def test_from_file(self):
self._clean_up_files.append(fp)
with open(fp, 'w') as f:
f.write(CONF_TEMPLATE %
('QIIME', '1.9.1', 'Different description',
('QIIMEq2', '1.9.1', 'Different description',
'source activate qiime', 'start_qiime',
'artifact transformation',
'[["10.1038/nmeth.f.303", "20383131"]]', client_id,
client_secret))
with warnings.catch_warnings(record=True) as warns:
obs = qdb.software.Software.from_file(fp)
obs_warns = [str(w.message) for w in warns]
exp_warns = ['Plugin "QIIME" version "1.9.1" config file does not '
'match with stored information. Check the config file'
' or run "qiita plugin update" to update the plugin '
'information. Offending values: description, '
exp_warns = ['Plugin "QIIMEq2" version "1.9.1" config file does '
'not match with stored information. Check the config '
'file or run "qiita plugin update" to update the '
'plugin information. Offending values: description, '
'environment_script, start_script']
self.assertCountEqual(obs_warns, exp_warns)

Expand Down Expand Up @@ -829,7 +829,7 @@ def test_from_file(self):
self.assertEqual(obs.client_secret, 'client_secret')

def test_exists(self):
self.assertTrue(qdb.software.Software.exists("QIIME", "1.9.1"))
self.assertTrue(qdb.software.Software.exists("QIIMEq2", "1.9.1"))
self.assertFalse(qdb.software.Software.exists("NewPlugin", "1.9.1"))
self.assertFalse(qdb.software.Software.exists("QIIME", "2.0.0"))

Expand Down
18 changes: 9 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 @@ -43,17 +43,17 @@ def test_analysis_description_handler_get_request(self):
'artifacts': {
4: (1, 'Identification of the Microbiomes for Cannabis '
'Soils', ('Pick closed-reference OTUs | Split '
'libraries FASTQ', 'QIIME v1.9.1'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'1.SKM4.640180', '1.SKM9.640192'], {'1'})},
'analysis_reservation': '',
Expand All @@ -72,17 +72,17 @@ def test_analysis_description_handler_get_request(self):
'artifacts': {
4: (1, 'Identification of the Microbiomes for Cannabis '
'Soils', ('Pick closed-reference OTUs | Split '
'libraries FASTQ', 'QIIME v1.9.1'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'1.SKM4.640180', '1.SKM9.640192'], {'1'})},
'alert_msg': 'An artifact is being deleted from this analysis',
Expand All @@ -103,17 +103,17 @@ def test_analysis_description_handler_get_request(self):
'artifacts': {
4: (1, 'Identification of the Microbiomes for Cannabis '
'Soils', ('Pick closed-reference OTUs | Split '
'libraries FASTQ', 'QIIME v1.9.1'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'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'), [
'libraries FASTQ', 'QIIMEq2 v1.9.1'), [
'1.SKB7.640196', '1.SKB8.640193', '1.SKD8.640184',
'1.SKM4.640180', '1.SKM9.640192'], {'1'})},
'alert_msg': 'Error deleting artifact',
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/handlers/api_proxy/tests/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_job_ajax_get_req(self):
'command': 'Split libraries FASTQ',
'command_description': 'Demultiplexes and applies quality '
'control to FASTQ data',
'software': 'QIIME',
'software': 'QIIMEq2',
'software_version': '1.9.1'}
self.assertEqual(obs, exp)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_artifact_summary_get_request(self):
'rev_comp_mapping_barcodes': 'False',
'min_per_read_length_fraction': '0.75',
'barcode_type': 'golay_12'},
'software_version': '1.9.1', 'software': 'QIIME'},
'software_version': '1.9.1', 'software': 'QIIMEq2'},
'files': exp_files,
'is_from_analysis': False,
'summary': None,
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/handlers/study_handlers/tests/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_get(self):
'command': 'Split libraries FASTQ',
'command_description': 'Demultiplexes and applies quality '
'control to FASTQ data',
'software': 'QIIME',
'software': 'QIIMEq2',
'software_version': '1.9.1'}
self.assertEqual(loads(response.body), exp)

Expand Down

0 comments on commit c2e0a10

Please sign in to comment.