Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_collection_description(self):
self.dataset1 = self.hist.paste_content(FOO_DATA)
self.dataset2 = self.hist.paste_content(FOO_DATA_2)
self.collection_description = dataset_collections.CollectionDescription(
name="MyDatasetList",
elements=[
dataset_collections.HistoryDatasetElement(name="sample1", id=self.dataset1.id),
dataset_collections.HistoryDatasetElement(name="sample2", id=self.dataset2.id),
]
def test_create_list_of_paired_datasets_in_history(self):
history_id = self.gi.histories.create_history(name="TestDSListCreate")["id"]
dataset1_id = self._test_dataset(history_id)
dataset2_id = self._test_dataset(history_id)
dataset3_id = self._test_dataset(history_id)
dataset4_id = self._test_dataset(history_id)
collection_response = self.gi.histories.create_dataset_collection(
history_id=history_id,
collection_description=collections.CollectionDescription(
name="MyListOfPairedDatasets",
type="list:paired",
elements=[
collections.CollectionElement(
name="sample1",
type="paired",
elements=[
collections.HistoryDatasetElement(name="forward", id=dataset1_id),
collections.HistoryDatasetElement(name="reverse", id=dataset2_id),
]
),
collections.CollectionElement(
name="sample2",
type="paired",
elements=[
collections.HistoryDatasetElement(name="forward", id=dataset3_id),
def _associate_collection_elements(self, galaxy_element_data):
"""
Handles the association of Galaxy objects with their parent elements
:param galaxy_element_data: list of bioblend objects to associate
with each other
:return:
"""
if not len(galaxy_element_data) == 1:
for index, galaxy_element in enumerate(galaxy_element_data):
if type(galaxy_element) == CollectionDescription:
for prev_galaxy_element in galaxy_element_data[:index]:
if (type(prev_galaxy_element) ==
HistoryDatasetElement or
type(prev_galaxy_element) ==
CollectionElement):
galaxy_element.add(prev_galaxy_element)
galaxy_element_data.remove(prev_galaxy_element)
return self._associate_collection_elements(
galaxy_element_data
)
if type(galaxy_element) == CollectionElement:
for prev_galaxy_element in galaxy_element_data[:index]:
if type(prev_galaxy_element) == HistoryDatasetElement:
galaxy_element.add(prev_galaxy_element)
galaxy_element_data.remove(prev_galaxy_element)
return self._associate_collection_elements(