sbol_utilities.component

Module Contents

Functions

add_feature(component: sbol3.Component, to_add: Union[sbol3.Feature, sbol3.Component]) → sbol3.Feature

Pass-through adder for adding a Feature to a Component for allowing slightly more compact code.

add_interaction(interaction_type: str, participants: Dict[Union[sbol3.Feature, sbol3.Component], str], system: sbol3.Component = None, name: str = None) → sbol3.Interaction

Compact function for creation of an interaction.

all_in_role(interaction: sbol3.Interaction, role: str) → List[sbol3.Feature]

Find the features with a given role in the interaction.

backbone(identity: str, sequence: str, dropout_location: List[int], fusion_site_length: int, linear: bool, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Backbone Component and its Sequence.

by_roles(required_role: str) → Callable[[sbol3.TopLevel], bool]

Given an object and a role, check if it is one of the roles of the object.

by_types(required_type: str) → Callable[[sbol3.TopLevel], bool]

Given an object and a type, check if it is one of the types of the object.

cds(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Coding Sequence (CDS) Component and its Sequence.

constitutive(target: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) → sbol3.Feature

Add a constitutive promoter regulating the target feature.

contained_components(roots: Union[sbol3.TopLevel, Iterable[sbol3.TopLevel]]) → set[sbol3.Component]

Find the set of all SBOL Components contained within the roots or their children.

contains(container: Union[sbol3.Feature, sbol3.Component], contained: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) → sbol3.Feature

Assert a topological containment constraint between two features (e.g., a promoter contained in a plasmid).

dna_component_with_sequence(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a DNA Component and its Sequence.

ed_protein(definition: str, **kwargs) → sbol3.ExternallyDefined

Creates an ExternallyDefined Protein Component.

ed_restriction_enzyme(name: str, **kwargs) → sbol3.ExternallyDefined

Creates an ExternallyDefined Restriction Enzyme Component from rebase.

ed_simple_chemical(definition: str, **kwargs) → sbol3.ExternallyDefined

Creates an ExternallyDefined Simple Chemical Component.

engineered_region(identity: str, features: Union[List[sbol3.SubComponent], List[sbol3.Component]], **kwargs) → sbol3.Component

Creates an Engineered Region Component, with features assumed to be in linear order

ensure_singleton_feature(system: sbol3.Component, target: Union[sbol3.Feature, sbol3.Component])

Return a feature associated with the target, i.e., the target itself if a feature, or a SubComponent.

ensure_singleton_system(system: Optional[sbol3.Component], *features: Union[sbol3.Feature, sbol3.Component]) → sbol3.Component

Check that the system referred to is unambiguous. Raises ValueError if there are multiple or zero systems.

functional_component(identity: str, **kwargs) → sbol3.Component

Creates a Component of type functional entity.

gene(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Gene Component and its Sequence.

in_role(interaction: sbol3.Interaction, role: str) → sbol3.Feature

Find the (precisely one) feature with a given role in the interaction.

is_dna_part(obj: sbol3.Component) → bool

Check if an SBOL Component is a DNA Part, i.e., having type 'SBO:DNA', and exactly 1 sequence property

media(identity: str, recipe: dict[Union[sbol3.Component, sbol3.SubComponent], Union[sbol3.Measure, list]] = None, **kwargs) → sbol3.Component

Creates a media Component of type functional entity.

mrna(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates an mRNA Component and its Sequence.

operator(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates an Operator Component and its Sequence.

order(five_prime: Union[sbol3.Feature, sbol3.Component], three_prime: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) → sbol3.Feature

Assert a topological ordering constraint between two features (e.g., a CDS followed by a terminator).

part_in_backbone(identity: str, part: sbol3.Component, backbone: sbol3.Component, linear: bool = False, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Part in Backbone Component and its Sequence.

promoter(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Promoter Component and its Sequence.

protein_component_with_sequence(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Protein Component and its Sequence.

protein_stability_element(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a protein stability element Component and its Sequence.

rbs(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Ribosome Entry Site (RBS) Component and its Sequence.

regulate(five_prime: Union[sbol3.Feature, sbol3.Component], target: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) → sbol3.Feature

Connect a 5' regulatory region to control the expression of a 3' target region.

rna_component_with_sequence(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a RNA Component and its Sequence.

strain(identity: str, **kwargs) → sbol3.Component

Creates a strain Component of type functional entity.

terminator(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Terminator Component and its Sequence.

transcription_factor(identity: str, sequence: str, **kwargs) → Tuple[sbol3.Component, sbol3.Sequence]

Creates a Transcription Factor Component and its Sequence.

add_feature(component: sbol3.Component, to_add: Union[sbol3.Feature, sbol3.Component]) sbol3.Feature

Pass-through adder for adding a Feature to a Component for allowing slightly more compact code. Note that unlike ensure_singleton_feature, this allows adding multiple instances.

Parameters
  • component – Component to add the Feature to

  • to_add – Feature or Component to be added to system. Components will be wrapped in a SubComponent Feature

Returns

feature added (SubComponent if to_add was a Component)

add_interaction(interaction_type: str, participants: Dict[Union[sbol3.Feature, sbol3.Component], str], system: sbol3.Component = None, name: str = None) sbol3.Interaction

Compact function for creation of an interaction. Implicitly identifies system and creates/adds features as necessary.

Parameters
  • interaction_type – SBO type of interaction to be to be added

  • participants – dictionary assigning features/components to roles for participations

  • system – system to add interaction to

  • name – name for the interaction

Returns

interaction

all_in_role(interaction: sbol3.Interaction, role: str) List[sbol3.Feature]

Find the features with a given role in the interaction.

Parameters
  • interaction – interaction to search

  • role – role to search for

Returns

sorted list of Features playing that role

backbone(identity: str, sequence: str, dropout_location: List[int], fusion_site_length: int, linear: bool, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Backbone Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • dropout_location – List of 2 integers that indicates the start and the end of the dropout sequence including overhangs. Note that the index of the first location is 1, as is typical practice in biology, rather than 0, as is typical practice in computer science.

  • fusion_site_length – Integer of the lenght of the fusion sites (eg. BsaI fusion site lenght is 4, SapI fusion site lenght is 3)

  • linear – Boolean than indicates if the backbone is linear, by default it is seted to Flase which means that it has a circular topology.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

by_roles(required_role: str) Callable[[sbol3.TopLevel], bool]

Given an object and a role, check if it is one of the roles of the object.

Parameters

required_role – the role which must be present in given object

Returns

lambda function taking an obj to check roles in, returns bool

by_types(required_type: str) Callable[[sbol3.TopLevel], bool]

Given an object and a type, check if it is one of the types of the object.

Parameters

required_type – the type which must be present in given object

Returns

lambda function taking an obj to check types in, returns bool

cds(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Coding Sequence (CDS) Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

constitutive(target: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) sbol3.Feature

Add a constitutive promoter regulating the target feature.

Parameters
  • target – 5’ region for promoter to regulate

  • system – optional explicit statement of system

Returns

newly created constitutive promoter

contained_components(roots: Union[sbol3.TopLevel, Iterable[sbol3.TopLevel]]) set[sbol3.Component]

Find the set of all SBOL Components contained within the roots or their children. This will explore via all of the direct relations that can include a Component: Collection.member, CombinatorialDerivation.template, variable_features Component.feature:SubComponent, Implementation.built, VariableFeature.variant, variant_derivation, variant_collection

Parameters

roots – single TopLevel or iterable collection of TopLevel objects to explore

Returns

set of Components found, including roots

Raises

TopLevelNotFound – if some referenced Components are not in the document

contains(container: Union[sbol3.Feature, sbol3.Component], contained: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) sbol3.Feature

Assert a topological containment constraint between two features (e.g., a promoter contained in a plasmid). Implicitly identifies system and creates/adds features as necessary.

Parameters
  • container – containing feature

  • contained – feature that is contained

  • system – optional explicit statement of system

Returns

contained feature

dna_component_with_sequence(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a DNA Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

ed_protein(definition: str, **kwargs) sbol3.ExternallyDefined

Creates an ExternallyDefined Protein Component.

Parameters
  • definition – The URI that links to a canonical definition external to SBOL, recommended UniProt.

  • kwargs – Keyword arguments of any other ExternallyDefined attribute.

Returns

A Component object.

ed_restriction_enzyme(name: str, **kwargs) sbol3.ExternallyDefined

Creates an ExternallyDefined Restriction Enzyme Component from rebase.

Parameters
  • name – Name of the SBOL ExternallyDefined, used by PyDNA. Case sensitive, follow standard restriction enzyme nomenclature, i.e. ‘BsaI’

  • kwargs – Keyword arguments of any other ExternallyDefined attribute.

Returns

An ExternallyDefined object.

ed_simple_chemical(definition: str, **kwargs) sbol3.ExternallyDefined

Creates an ExternallyDefined Simple Chemical Component.

Parameters
  • definition – The URI that links to a canonical definition external to SBOL, recommended ChEBI and PubChem.

  • kwargs – Keyword arguments of any other ExternallyDefined attribute.

Returns

A Component object.

engineered_region(identity: str, features: Union[List[sbol3.SubComponent], List[sbol3.Component]], **kwargs) sbol3.Component

Creates an Engineered Region Component, with features assumed to be in linear order

Parameters
  • identity – The identity of the Component.

  • features – SubComponents or Components to add as features in linear order

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

ensure_singleton_feature(system: sbol3.Component, target: Union[sbol3.Feature, sbol3.Component])

Return a feature associated with the target, i.e., the target itself if a feature, or a SubComponent. If the target is not already in the system, add it. Raises ValueError if given a Component with multiple instances.

Returns

associated feature

ensure_singleton_system(system: Optional[sbol3.Component], *features: Union[sbol3.Feature, sbol3.Component]) sbol3.Component

Check that the system referred to is unambiguous. Raises ValueError if there are multiple or zero systems.

Parameters
  • system – Optional explicit specification of system

  • features – features in the same system or components to be referenced from it

Returns

Component for the identified system

functional_component(identity: str, **kwargs) sbol3.Component

Creates a Component of type functional entity.

Parameters
  • identity – The identity of the Component.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

gene(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Gene Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

in_role(interaction: sbol3.Interaction, role: str) sbol3.Feature

Find the (precisely one) feature with a given role in the interaction.

Parameters
  • interaction – interaction to search

  • role – role to search for

Returns

Feature playing that role

is_dna_part(obj: sbol3.Component) bool

Check if an SBOL Component is a DNA Part, i.e., having type ‘SBO:DNA’, and exactly 1 sequence property

Parameters

obj – Sbol3 Document to be checked

Returns

true if dna part

media(identity: str, recipe: dict[Union[sbol3.Component, sbol3.SubComponent], Union[sbol3.Measure, list]] = None, **kwargs) sbol3.Component

Creates a media Component of type functional entity.

Parameters
  • identity – The identity of the Component.

  • recipe – dictionary of mapping from Component/SubComponent to a quantity (either Measure or value/unit pairs)

  • kwargs – Keyword arguments of any other Component attribute.

Returns

a new Component representing the specified media

Raises

ValueError if there are problems with the recipe elements

mrna(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates an mRNA Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The RNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

operator(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates an Operator Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

order(five_prime: Union[sbol3.Feature, sbol3.Component], three_prime: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) sbol3.Feature

Assert a topological ordering constraint between two features (e.g., a CDS followed by a terminator). Implicitly identifies system and creates/adds features as necessary.

Parameters
  • five_prime – containing feature

  • three_prime – feature that is contained

  • system – optional explicit statement of system

Returns

three_prime feature

part_in_backbone(identity: str, part: sbol3.Component, backbone: sbol3.Component, linear: bool = False, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Part in Backbone Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • part – Part to be located in the backbone as SBOL Component.

  • backbone – Backbone in wich the part is located as SBOL Component.

  • linear – Boolean than indicates if the backbone is linear, by default it is seted to Flase which means that it has a circular topology.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

promoter(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Promoter Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

protein_component_with_sequence(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Protein Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The Protein sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

protein_stability_element(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a protein stability element Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

rbs(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Ribosome Entry Site (RBS) Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

regulate(five_prime: Union[sbol3.Feature, sbol3.Component], target: Union[sbol3.Feature, sbol3.Component], system: Optional[sbol3.Component] = None) sbol3.Feature

Connect a 5’ regulatory region to control the expression of a 3’ target region. Note: this function is an alias for “order”.

Parameters
  • five_prime – Regulatory region to place upstream of target

  • target – region to be regulated (e.g., a CDS or ncRNA)

  • system – optional explicit statement of system

Returns

target feature

rna_component_with_sequence(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a RNA Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The RNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

strain(identity: str, **kwargs) sbol3.Component

Creates a strain Component of type functional entity.

Parameters
  • identity – The identity of the Component.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A Component object.

terminator(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Terminator Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The DNA sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.

transcription_factor(identity: str, sequence: str, **kwargs) Tuple[sbol3.Component, sbol3.Sequence]

Creates a Transcription Factor Component and its Sequence.

Parameters
  • identity – The identity of the Component. The identity of Sequence is also identity with the suffix ‘_seq’.

  • sequence – The Protein amino acid sequence of the Component encoded in IUPAC.

  • kwargs – Keyword arguments of any other Component attribute.

Returns

A tuple of Component and Sequence.