sbol2.moduledefinition

Module Contents

Classes

ModuleDefinition

ModuleDefinition is a principle top-level class for

class sbol2.moduledefinition.ModuleDefinition(uri=rdflib.URIRef('example'), version=VERSION_STRING, type_uri=SBOL_MODULE_DEFINITION)

Bases: sbol2.toplevel.TopLevel

ModuleDefinition is a principle top-level class for describing the function of a design.

_roles
modules
interactions
functionalComponents
models
addRole(self, new_role)
removeRole(self, index=0)
abstract setOutput(self, output)

Defines an output for a sub-Module. Useful for top-down assembly of Modules and sub-Modules.

If a FunctionalComponent with the given definition does not exist yet, one will be autoconstructed. Otherwise the FunctionalComponent with the given definition will be inferred. Be warned that this inference may fail if there is more than one FunctionalComponent with the same definition.

Parameters

output – A ComponentDefinition that defines the output

Returns

A FunctionalComponent that is derived from the argument

ComponentDefinition and configured as this ModuleDefinition’s output (it’s direction property is set to SBOL_DIRECTION_OUT)

abstract setOutputFunctional(self, output)

Configures a FunctionalComponent as an output for a Module.

Useful for bottom-up assembly of Modules and sub-Modules.

Parameters

output – The FunctionalComponent that will be configured

Returns

None

abstract setInput(self, input)

Defines an input for a sub-Module. Useful for top-down assembly of Modules and sub-Modules.

If a FunctionalComponent with the given definition does not exist yet, one will be autoconstructed. Otherwise the FunctionalComponent with the given definition will be inferred. Be warned that this inference may fail if there is more than one FunctionalComponent with the same definition.

Parameters

input – A ComponentDefinition that defines the input.

Returns

A FunctionalComponent that is derived

from the argument ComponentDefinition and configured as this ModuleDefinition’s input (it’s direction property is set to SBOL_DIRECTION_IN).

setInputFunctional(self, input)

Configures a FunctionalComponent as an input for a Module.

Useful for bottom-up assembly of Modules and sub-Modules.

Parameters

input – The FunctionalComponent that will be configured.

Returns

None

abstract connect(self, output, input)

Connects the output of a sub-Module with the input of another sub-Module. Auto-constructs MapsTo objects.

Parameters

output – A FunctionalComponent configured as a Module output

(see setOutput). :param input: A FunctionalComponent configured as a Module input (see setInput). :return: None

abstract override(self, highlevel, lowlevel)

Overrides a low-level component in an abstract sub-Module with a high-level component in a parent ModuleDefinition, for example when overriding an abstract template Module with explicit components.

Parameters
  • highlevel – A high-level FunctionalComponent

  • lowlevel – A low-level FunctionalComponent in a nested sub-Module

Returns

None

applyToModuleHierarchy(self, callback=None, user_data=None)

Perform an operation on every ModuleDefinition in a structurally-linked hierarchy of ModuleDefinitions by applying a callback function. If no callback is specified, the default behavior is to return a list of each ModuleDefinition in the hierarchy.

Parameters
  • callback – A callback function

  • user_data – Arbitrary user data which can be passed in and out

of the callback as an argument. :return: A list of all ModuleDefinitions in the hierarchy.

assemble(self, list_of_modules)

Assemble a high-level ModuleDefinition from lower-level submodules.

Autoconstructs Module objects in the process.

Parameters

list_of_modules – A list of submodule ModuleDefinitions.

Returns

None

getTypeURI(self)