sbol2.componentdefinition

Module Contents

Classes

ComponentDefinition

The ComponentDefinition class represents the structural entities

class sbol2.componentdefinition.ComponentDefinition(uri=URIRef('example'), component_type=URIRef(BIOPAX_DNA), version=VERSION_STRING, type_uri=SBOL_COMPONENT_DEFINITION)

Bases: sbol2.toplevel.TopLevel

The ComponentDefinition class represents the structural entities of a biological design.

The primary usage of this class is to represent structural entities with designed sequences, such as DNA, RNA, and proteins, but it can also be used to represent any other entity that is part of a design, such as small molecules, proteins, and complexes.

_types
_roles
components
sequences
sequenceAnnotations
sequenceConstraints
property sequence(self)
_added_to_document(self, doc)
addType(self, new_type)
removeType(self, index=0)
addRole(self, new_role)
removeRole(self, index=0)
assemble(self, component_list, assembly_method=None, doc=None)

Assembles ComponentDefinitions into an abstraction hierarchy.

The resulting data structure is a partial design, still lacking a primary structure or explicit sequence. To form a primary structure out of the ComponentDefinitions, call linearize after calling assemble. To fully realize the target sequence, use Sequence::assemble(). :param component_list: Either a list of URIs for the constituent ComponentDefinitions or a list of subcomponents. A list of displayIds is also acceptable if using SBOL-compliant URIs. :param assembly_method: An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence. :param doc: The Document to which the assembled ComponentDefinitions will be added. If not set, then you must add this ComponentDefinition to a Document before calling this method. :return: None

assemblePrimaryStructure(self, primary_structure, assembly_method=None, doc=None)

Assembles ComponentDefinition into a linear primary structure.

The resulting data structure is a partial design, still lacking an explicit sequence. To fully realize the target sequence, use Sequence::assemble(). :param primary_structure: Either a list of URIs for the constituent ComponentDefinitions or a list of subcomponents. A list of displayIds is also acceptable if using SBOL-compliant URIs. :param assembly_standard: An optional argument such as IGEM_STANDARD_ASSEMBLY that affects how components are composed and the final target sequence. :param doc: The Document to which the assembled ComponentDefinitions will be added. If not set, then you must add this ComponentDefinition to a Document before calling this method. :return: None

compile(self, assembly_method=None)

Compiles an abstraction hierarchy of ComponentDefinitions into a nucleotide sequence.

If no Sequence object is associated with this ComponentDefinition, one will be automatically instantiated :return: A string representing the nucleotide sequence for this ComponentDefinition.

abstract updateSequence(self, composite_sequence='')

Assemble a parent ComponentDefinition’s Sequence from its subcomponent Sequences.

Parameters

composite_sequence – A recursive parameter, use default value.

Returns

The assembled parent sequence.

getInSequentialOrder(self)

Get the primary sequence of a design in terms of its sequentially ordered Components.

Returns

A list of Components.

hasUpstreamComponent(self, component)

Checks if the specified Component has a Component upstream in linear arrangement on the DNA strand.

Checks that the appropriate SequenceConstraint exists. :param current_component: A Component in this ComponentDefinition. :return: True if found, False if not

getUpstreamComponent(self, component)

Get the upstream component.

Parameters

component – A Component in this ComponentDefinition.

Returns

The upstream component.

hasDownstreamComponent(self, component)

Checks if the specified Component has a Component downstream in linear arrangement on the DNA strand.

Checks that the appropriate SequenceConstraint exists. :param current_component: A Component in this ComponentDefinition. :return: True if found, False if not.

getDownstreamComponent(self, component)

Get the downstream component.

Parameters

current_component – A Component in this ComponentDefinition.

Returns

The downstream component.

deleteDownstreamComponent(self, upstream_component)
deleteUpstreamComponent(self, downstream_component)
insertUpstreamComponent(self, downstream, insert)
insertDownstreamComponent(self, upstream, insert)
getFirstComponent(self)

Gets the first Component in a linear sequence.

Returns

The first component in sequential order.

getLastComponent(self)

Gets the last Component in a linear sequence.

Returns

The last component in sequential order.

abstract applyToComponentHierarchy(self, callback=None, user_data=None)

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

Parameters
  • callback – The callback function to apply.

  • user_data – Arbitrary user data which can be passed

in and out of the callback as an argument. :return: A list of all Components in the hierarchy.

getPrimaryStructureComponents(self)

Get the primary sequence of a design in terms of its sequentially ordered Components.

Returns

A list of Components.

getPrimaryStructure(self)

Get the primary sequence of a design in terms of its sequentially ordered ComponentDefinitions.

Returns

A list of ComponentDefinitions.

abstract insertDownstream(self, target, component_to_insert)

Insert a Component downstream of another in a primary sequence, shifting any adjacent Components downstream as well.

Parameters

target – The target Component will be upstream

of the insert Component after this operation. :param component_to_insert: The insert Component is inserted downstream of the target Component. :return: None

abstract insertUpstream(self, target, component_to_insert)

Insert a Component upstream of another in a primary sequence, shifting any adjacent Components upstream as well.

Parameters

target – The target Component will be downstream

of the insert Component after this operation. :param component_to_insert: The insert Component is inserted upstream of the target Component. :return:

abstract addUpstreamFlank(self, target, elements)

A useful method when building up SBOL representations of natural DNA sequences.

For example, it is often necessary to specify components that are assumed to have no meaningful role in the design, but are nevertheless important to fill in regions of sequence. This method autoconstructs a ComponentDefinition and Sequence object to create an arbitrary flanking sequence around design Components. The new ComponentDefinition will have Sequence Ontology type of flanking_region or SO:0000239. :param target: The new flanking sequence will be placed upstream of the target. :param elements: The primary sequence elements will be assigned to the autoconstructed Sequence object. The encoding is inferred. :return: None

abstract addDownstreamFlank(self, target, elements)

A useful method when building up SBOL representations of natural DNA sequences.

For example, it is often necessary to specify components that are assumed to have no meaningful role in the design, but are nevertheless important to fill in regions of sequence. This method autoconstructs a ComponentDefinition and Sequence object to create an arbitrary flanking sequence around design Components. The new ComponentDefinition will have Sequence Ontology type of flanking_sequence. :param target: The new flanking sequence will be placed downstream of the target. :param elements: The primary sequence elements will be assigned to the autoconstructed Sequence object. The encoding is inferred. :return: None

abstract isRegular(self, msg=None)

Use this diagnose an irregular design.

Recursively checks if this ComponentDefinition defines a SequenceAnnotation and Range for every Sequence. Regularity is more stringent than completeness. A design must be complete to be regular. :param msg: An optional message for diagnosing the irregularity, if any is found. :return: True if the abstraction hierarchy is regular, False otherwise.

abstract isComplete(self, msg=None)

Use this diagnose an incomplete design.

Recursively checks if this ComponentDefinition defines a SequenceAnnotation and Range for every Sequence. Completeness does not guarantee regularity. :param msg: An optional message for diagnosing the irregularity, if any is found. :return: True if the abstraction hierarchy is complete, False otherwise.

abstract disassemble(self, range_start=1)

Instantiates a Component for every SequenceAnnotation

When converting from a flat GenBank file to a flat SBOL file, the result is a ComponentDefinition with SequenceAnnotations. This method will convert the flat SBOL file into hierarchical SBOL.

Parameters

range_start

Returns

None

abstract linearize(self, components=None)

TODO document

Parameters

components – An optional list of component definitions or URIs.

If None, an empty list of ComponentDefinitions is assumed. :return: None

abstract build(self)

TODO document

Returns

A ComponentDefinition.

abstract participate(self, species)

A convenience method that assigns a component to participate in a biochemical reaction.

Behind the scenes, it auto-constructs a FunctionalComponent for this ComponentDefinition and assigns it to a Participation.

Parameters

species – A Participation object

(ie. participant species in a biochemical Interaction). :return: None

getTypeURI(self)
integrateAtBaseCoordinate(self, target_cd, insert_cd, base_coordinate)

Construct SBOL representing a genetic insert. Inserts insert_cd into self at base_coordinate.

This method constructs a new ComponentDefinition that is annotated with the original sequence and the inserted sequence such that the new DNA sequence can be generated. This method does not generate the new sequence itself.

The new sequence is not generated to avoid duplicating very long sequences in memory when they are not needed.