forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement paired_or_unpaired collections...
- Loading branch information
Showing
22 changed files
with
744 additions
and
27 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
46 changes: 46 additions & 0 deletions
46
lib/galaxy/model/dataset_collections/types/paired_or_unpaired.py
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,46 @@ | ||
from galaxy.exceptions import RequestParameterInvalidException | ||
from galaxy.model import ( | ||
DatasetCollectionElement, | ||
HistoryDatasetAssociation, | ||
) | ||
from . import BaseDatasetCollectionType | ||
from .paired import ( | ||
FORWARD_IDENTIFIER, | ||
REVERSE_IDENTIFIER, | ||
) | ||
|
||
SINGLETON_IDENTIFIER = "unpaired" | ||
|
||
|
||
class PairedOrUnpairedDatasetCollectionType(BaseDatasetCollectionType): | ||
""" """ | ||
|
||
collection_type = "paired_or_unpaired" | ||
|
||
def generate_elements(self, dataset_instances, **kwds): | ||
num_datasets = len(dataset_instances) | ||
if num_datasets > 2 or num_datasets < 1: | ||
raise RequestParameterInvalidException( | ||
f"Incorrect number of datasets - 1 or 2 datasets is required to create a paired_or_unpaired collection" | ||
) | ||
|
||
if num_datasets == 2: | ||
if forward_dataset := self._ensure_dataset_with_identifier(dataset_instances, FORWARD_IDENTIFIER): | ||
left_association = DatasetCollectionElement( | ||
element=forward_dataset, | ||
element_identifier=FORWARD_IDENTIFIER, | ||
) | ||
yield left_association | ||
if reverse_dataset := self._ensure_dataset_with_identifier(dataset_instances, REVERSE_IDENTIFIER): | ||
right_association = DatasetCollectionElement( | ||
element=reverse_dataset, | ||
element_identifier=REVERSE_IDENTIFIER, | ||
) | ||
yield right_association | ||
else: | ||
if single_datasets := self._ensure_dataset_with_identifier(dataset_instances, SINGLETON_IDENTIFIER): | ||
single_association = DatasetCollectionElement( | ||
element=single_datasets, | ||
element_identifier=SINGLETON_IDENTIFIER, | ||
) | ||
yield single_association |
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.