Skip to content
Merged

092020 #3033

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Qiita changelog

Version 092020
--------------

* Added a new endpoint to inject artifacts to existing preparations or jobs: `/qiita_db/artifact/`
* Outdated commands with the exact same name than newer commands will be marked as not outdated. This is helpful for cases where the commands haven't changed between version
* Added the `add_ebi_accessions` to the `to_dataframe()` method of the information files so it can be used to `redbiom`. This will allow searching via sample or experiment accessions
* Added the `release_validator_job` method to `ProcessingJob` method to easily retrieve the `release_validator` job of a `processing_job`
* Re-added `STUDY_TYPE` to the EBI-ENA submission as they are required but deprecated so just adding as Other
* Added qiime2.2020.08 to the system; which updated these plugins: qp-qiime2, qtp-biom, qtp-diversity, qtp-visualization
* Shogun processing using Woltka will now produce 2 extra artifacts: a per genome and per gene artifacts

Version 072020
--------------

Expand Down
2 changes: 1 addition & 1 deletion qiita_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

__version__ = "052020"
__version__ = "092020"
2 changes: 1 addition & 1 deletion qiita_db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from . import user
from . import processing_job

__version__ = "052020"
__version__ = "092020"

__all__ = ["analysis", "artifact", "archive", "base", "commands",
"environment_manager", "exceptions", "investigation", "logger",
Expand Down
3 changes: 2 additions & 1 deletion qiita_db/handlers/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ def post(self):
'direct_creation': True,
'name': aname}
values['provenance'] = dumps(provenance)
prep_id = job.input_artifacts[0].id
# inherint the first prep info file from the first input artifact
prep_id = job.input_artifacts[0].prep_templates[0].id
else:
prep_id = int(prep_id)

Expand Down
9 changes: 8 additions & 1 deletion qiita_db/handlers/tests/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ def test_post(self):
# tests success by inserting a new artifact into an existing job
original_job = qdb.processing_job.ProcessingJob(data['job_id'])
input_artifact = original_job.input_artifacts[0]
self.assertEqual(len(input_artifact.children), 3)
original_children = input_artifact.children
self.assertEqual(len(original_children), 3)

# send the new data
del data['prep_id']
obs = self.post('/qiita_db/artifact/', headers=self.header, data=data)
Expand All @@ -353,12 +355,17 @@ def test_post(self):
# now the original job should have 4 children and make sure they have
# the same parent and parameters
children = input_artifact.children
new_children = list(set(children) - set(original_children))[0]
self.assertEqual(len(children), 4)
for c in children[1:]:
self.assertCountEqual(children[0].processing_parameters.values,
c.processing_parameters.values)
self.assertEqual(children[0].parents, c.parents)

# making sure the new artifact is part of the descendants, which is a
# different method and usage than children method
self.assertIn(new_children, input_artifact.descendants.nodes)

# now let's test adding an artifact directly to a new prep
new_prep = qdb.metadata_template.prep_template.PrepTemplate.create(
pd.DataFrame({'new_col': {'1.SKB1.640202': 1,
Expand Down
13 changes: 12 additions & 1 deletion qiita_db/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,12 +1133,23 @@ def _complete_artifact_definition(self, artifact_data):
provenance = loads(job_params['provenance'])
if provenance.get('direct_creation', False):
original_job = ProcessingJob(provenance['job'])
qdb.artifact.Artifact.create(
artifact = qdb.artifact.Artifact.create(
filepaths, atype,
parents=original_job.input_artifacts,
processing_parameters=original_job.parameters,
analysis=job_params['analysis'],
name=job_params['name'])

sql = """
INSERT INTO qiita.artifact_output_processing_job
(artifact_id, processing_job_id,
command_output_id)
VALUES (%s, %s, %s)"""
qdb.sql_connection.TRN.add(
sql, [artifact.id, original_job.id,
provenance['cmd_out_id']])
qdb.sql_connection.TRN.execute()

self._set_status('success')
else:
if provenance.get('data_type') is not None:
Expand Down
29 changes: 20 additions & 9 deletions qiita_db/test/test_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,24 @@ def test_create(self):
'analysis': ('analysis', None),
'files': ('string', None),
'artifact_type': ('string', None)}
obs = qdb.software.Command.create(
validate = qdb.software.Command.create(
software, "Validate", "Test creating a validate command",
parameters)
self.assertEqual(obs.name, "Validate")
self.assertEqual(obs.description, "Test creating a validate command")
self.assertEqual(validate.name, "Validate")
self.assertEqual(
validate.description, "Test creating a validate command")
exp_required = {
'template': ('prep_template', [None]),
'analysis': ('analysis', [None]),
'files': ('string', [None]),
'artifact_type': ('string', [None])}
self.assertEqual(obs.required_parameters, exp_required)
self.assertEqual(validate.required_parameters, exp_required)
exp_optional = {'name': ['string', 'dflt_name'],
'provenance': ['string', None]}
self.assertEqual(obs.optional_parameters, exp_optional)
self.assertFalse(obs.analysis_only)
self.assertEqual(obs.naming_order, [])
self.assertEqual(obs.merging_scheme,
self.assertEqual(validate.optional_parameters, exp_optional)
self.assertFalse(validate.analysis_only)
self.assertEqual(validate.naming_order, [])
self.assertEqual(validate.merging_scheme,
{'parameters': [], 'outputs': [],
'ignore_parent_command': False})

Expand Down Expand Up @@ -440,11 +441,21 @@ def test_create(self):
self.assertFalse(old_cmd.active)

# 2. let's create a new command with the same name and check that now
# the old and the new are active
# the old and the new are active. Remember the new command is going
# to be created in a new software that has a Validate command which
# is an 'artifact definition', so this will allow us to test that
# a previous Validate command is not active
new_cmd = qdb.software.Command.create(
software, cmd_name, cmd_name, parameters, outputs=outputs)
self.assertEqual(old_cmd.name, new_cmd.name)
self.assertTrue(old_cmd.active)
self.assertTrue(new_cmd.active)
# find an old Validate command
old_validate = [c for c in qdb.software.Software.from_name_and_version(
'BIOM type', '2.1.4 - Qiime2').commands if c.name == 'Validate'][0]
self.assertEqual(old_validate.name, validate.name)
self.assertTrue(validate.active)
self.assertFalse(old_validate.active)

def test_activate(self):
qdb.software.Software.deactivate_all()
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

__version__ = "052020"
__version__ = "092020"
2 changes: 1 addition & 1 deletion qiita_pet/handlers/api_proxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from .user import (user_jobs_get_req)
from .util import check_access, check_fp

__version__ = "052020"
__version__ = "092020"

__all__ = ['prep_template_summary_get_req', 'data_types_get_req',
'study_get_req', 'sample_template_filepaths_get_req',
Expand Down
8 changes: 8 additions & 0 deletions qiita_pet/support_files/doc/source/dev/rest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ the important parts of the values are described in the Parameters column.
|PATCH | ``/qiita_db/artifacts/<artifact_id>/`` | ``op: operation``, ``path: path``, | Retrieves the artifact information | ArtifactHandler |
| | | ``value: value`` | | |
+--------+-----------------------------------------------------------------------------------+-----------------------------------------+-----------------------------------------------------+----------------------------+
|POST | ``/qiita_db/artifact/`` | ``user_email: str``, | Injects artifacts to existing prep templates or | APIArtifactHandler |
| | | ``artifact_type: str``, | jobs | |
| | | ``files: JSON of {'filepath_types': | | |
| | | [filepaths]}`` | | |
| | | ``command_artifact_name: str``, | | |
| | | ``job_id: str, optional``, | | |
| | | ``prep_id: int, optional``, | | |
+--------+-----------------------------------------------------------------------------------+-----------------------------------------+-----------------------------------------------------+----------------------------+
|GET | ``/qiita_db/users/`` | | Retrieves the email and name of all the users | UsersListDBHandler |
+--------+-----------------------------------------------------------------------------------+-----------------------------------------+-----------------------------------------------------+----------------------------+
|GET | ``/qiita_db/user/<email>/data/`` | | Retrieves the user information | UserInfoDBHandlerTests |
Expand Down
2 changes: 1 addition & 1 deletion qiita_ware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

__version__ = "052020"
__version__ = "092020"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup
from glob import glob

__version__ = "052020"
__version__ = "092020"


classes = """
Expand Down