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.

galaxy.model.dataset_collections package

Submodules

galaxy.model.dataset_collections.builder module

galaxy.model.dataset_collections.builder.build_collection(type, dataset_instances)[source]

Build DatasetCollection with populated DatasetcollectionElement objects corresponding to the supplied dataset instances or throw exception if this is not a valid collection of the specified type.

galaxy.model.dataset_collections.builder.set_collection_elements(dataset_collection, type, dataset_instances)[source]
class galaxy.model.dataset_collections.builder.CollectionBuilder(collection_type_description)[source]

Bases: object

Purely functional builder pattern for building a dataset collection.

__init__(collection_type_description)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

replace_elements_in_collection(template_collection, replacement_dict)[source]
get_level(identifier)[source]
add_dataset(identifier, dataset_instance)[source]
build_elements()[source]
build()[source]
class galaxy.model.dataset_collections.builder.BoundCollectionBuilder(dataset_collection)[source]

Bases: galaxy.model.dataset_collections.builder.CollectionBuilder

More stateful builder that is bound to a particular model object.

__init__(dataset_collection)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

populate()[source]

galaxy.model.dataset_collections.matching module

class galaxy.model.dataset_collections.matching.CollectionsToMatch[source]

Bases: object

Structure representing a set of collections that need to be matched up when running tools (possibly workflows in the future as well).

__init__()[source]

x.__init__(…) initializes x; see help(type(x)) for signature

add(input_name, hdca, subcollection_type=None, linked=True)[source]
has_collections()[source]
items()[source]
class galaxy.model.dataset_collections.matching.MatchingCollections[source]

Bases: object

Structure holding the result of matching a list of collections together. This class being different than the class above and being created in the dataset_collections_service layer may seem like overkill but I suspect in the future plugins will be subtypable for instance so matching collections will need to make heavy use of the dataset collection type registry managed by the dataset collections sevice - hence the complexity now.

__init__()[source]

x.__init__(…) initializes x; see help(type(x)) for signature

slice_collections()[source]
subcollection_mapping_type(input_name)[source]
structure

Yield cross product of all unlinked collections structures to linked collection structure.

map_over_action_tuples(input_name)[source]
is_mapped_over(input_name)[source]
static for_collections(collections_to_match, collection_type_descriptions)[source]

galaxy.model.dataset_collections.registry module

class galaxy.model.dataset_collections.registry.DatasetCollectionTypesRegistry[source]

Bases: object

__init__()[source]

x.__init__(…) initializes x; see help(type(x)) for signature

get(plugin_type)[source]
prototype(plugin_type)[source]

galaxy.model.dataset_collections.structure module

Module for reasoning about structure of and matching hierarchical collections of data.

class galaxy.model.dataset_collections.structure.Leaf[source]

Bases: object

children_known = True
is_leaf
clone()[source]
multiply(other_structure)[source]
sliced_collection_type(collection)[source]
class galaxy.model.dataset_collections.structure.BaseTree(collection_type_description)[source]

Bases: object

__init__(collection_type_description)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

class galaxy.model.dataset_collections.structure.UninitializedTree(collection_type_description)[source]

Bases: galaxy.model.dataset_collections.structure.BaseTree

children_known = False
clone()[source]
is_leaf
multiply(other_structure)[source]
class galaxy.model.dataset_collections.structure.Tree(children, collection_type_description)[source]

Bases: galaxy.model.dataset_collections.structure.BaseTree

children_known = True
__init__(children, collection_type_description)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

static for_dataset_collection(dataset_collection, collection_type_description)[source]
walk_collections(hdca_dict)[source]
is_leaf
can_match(other_structure)[source]
multiply(other_structure)[source]
clone()[source]
galaxy.model.dataset_collections.structure.tool_output_to_structure(get_sliced_input_collection_structure, tool_output, collections_manager)[source]
galaxy.model.dataset_collections.structure.dict_map(func, input_dict)[source]
galaxy.model.dataset_collections.structure.get_structure(dataset_collection_instance, collection_type_description, leaf_subcollection_type=None)[source]

galaxy.model.dataset_collections.subcollections module

galaxy.model.dataset_collections.subcollections.split_dataset_collection_instance(dataset_collection_instance, collection_type)[source]

Split up collection into collection.

galaxy.model.dataset_collections.type_description module

class galaxy.model.dataset_collections.type_description.CollectionTypeDescriptionFactory(type_registry=<galaxy.model.dataset_collections.registry.DatasetCollectionTypesRegistry object>)[source]

Bases: object

__init__(type_registry=<galaxy.model.dataset_collections.registry.DatasetCollectionTypesRegistry object>)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

for_collection_type(collection_type)[source]
class galaxy.model.dataset_collections.type_description.CollectionTypeDescription(collection_type, collection_type_description_factory)[source]

Bases: object

Abstraction over dataset collection type that ties together string reprentation in database/model with type registry.

>>> factory = CollectionTypeDescriptionFactory(None)
>>> nested_type_description = factory.for_collection_type("list:paired")
>>> paired_type_description = factory.for_collection_type("paired")
>>> nested_type_description.has_subcollections_of_type("list")
False
>>> nested_type_description.has_subcollections_of_type("list:paired")
False
>>> nested_type_description.has_subcollections_of_type("paired")
True
>>> nested_type_description.has_subcollections_of_type(paired_type_description)
True
>>> nested_type_description.has_subcollections()
True
>>> paired_type_description.has_subcollections()
False
>>> paired_type_description.rank_collection_type()
'paired'
>>> nested_type_description.rank_collection_type()
'list'
>>> nested_type_description.effective_collection_type(paired_type_description)
'list'
>>> nested_type_description.effective_collection_type_description(paired_type_description).collection_type
'list'
>>> nested_type_description.child_collection_type()
'paired'
__init__(collection_type, collection_type_description_factory)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

child_collection_type()[source]
child_collection_type_description()[source]
effective_collection_type_description(subcollection_type)[source]
effective_collection_type(subcollection_type)[source]
has_subcollections_of_type(other_collection_type)[source]

Take in another type (either flat string or another CollectionTypeDescription) and determine if this collection contains subcollections matching that type.

The way this is used in map/reduce it seems to make the most sense for this to return True if these subtypes are proper (i.e. a type is not considered to have subcollections of its own type).

is_subcollection_of_type(other_collection_type)[source]
can_match_type(other_collection_type)[source]
subcollection_type_description()[source]
has_subcollections()[source]
rank_collection_type()[source]

Return the top-level collection type corresponding to this collection type. For instance the “rank” type of a list of paired data (“list:paired”) is “list”.

rank_type_plugin()[source]
dimension
multiply(other_collection_type)[source]
galaxy.model.dataset_collections.type_description.map_over_collection_type(mapped_over_collection_type, target_collection_type)[source]