Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.model.dataset_collections.registry

from galaxy import model
from .types import (
    list,
    paired
)

PLUGIN_CLASSES = [list.ListDatasetCollectionType, paired.PairedDatasetCollectionType]


[docs]class DatasetCollectionTypesRegistry(object):
[docs] def __init__(self): self.__plugins = dict([(p.collection_type, p()) for p in PLUGIN_CLASSES])
[docs] def get(self, plugin_type): return self.__plugins[plugin_type]
[docs] def prototype(self, plugin_type): plugin_type_object = self.get(plugin_type) if not hasattr(plugin_type_object, 'prototype_elements'): raise Exception("Cannot pre-determine structure for collection of type %s" % plugin_type) dataset_collection = model.DatasetCollection() elements = [e for e in plugin_type_object.prototype_elements()] dataset_collection.elements = elements return dataset_collection
DATASET_COLLECTION_TYPES_REGISTRY = DatasetCollectionTypesRegistry()