forked from galaxyproject/galaxy
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Implement records - heterogenous dataset collections.
Existing dataset colleciton types are meant to be homogenous - all datasets of the same time. This introduces CWL-style record dataset collections.
- Loading branch information
Showing
13 changed files
with
209 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from galaxy.exceptions import RequestParameterMissingException | ||
from galaxy.model import DatasetCollectionElement, HistoryDatasetAssociation | ||
|
||
from ..types import BaseDatasetCollectionType | ||
|
||
|
||
class RecordDatasetCollectionType(BaseDatasetCollectionType): | ||
"""Arbitrary CWL-style record type.""" | ||
|
||
collection_type = "record" | ||
|
||
def generate_elements(self, elements, **kwds): | ||
fields = kwds.get("fields", None) | ||
if fields is None: | ||
raise RequestParameterMissingException("Missing or null parameter fields required for record types.") | ||
if len(elements) != len(fields): | ||
self._validation_failed("Supplied element do not match fields.") | ||
index = 0 | ||
for identifier, element in elements.items(): | ||
field = fields[index] | ||
if field["name"] != identifier: | ||
self._validation_failed("Supplied element do not match fields.") | ||
|
||
# TODO: validate type and such. | ||
association = DatasetCollectionElement( | ||
element=element, | ||
element_identifier=identifier, | ||
) | ||
yield association | ||
index += 1 | ||
|
||
def prototype_elements( self, fields=None, **kwds ): | ||
if fields is None: | ||
raise RequestParameterMissingException("Missing or null parameter fields required for record types.") | ||
for field in fields: | ||
name = field.get("name", None) | ||
assert name | ||
assert field.get("type", "File") | ||
field_dataset = DatasetCollectionElement( | ||
element=HistoryDatasetAssociation(), | ||
element_identifier=name, | ||
) | ||
yield field_dataset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.