sbol2

Submodules

Package Contents

Classes

Attachment

Collection

CombinatorialDerivation

VariableComponent

Component

FunctionalComponent

ComponentDefinition

The ComponentDefinition class represents the structural entities

Config

A class which contains global configuration variables

ConfigOptions

Generic enumeration.

Design

This class represents a biological Design.

Experiment

ExperimentalData

Identified

Implementation

Interaction

Location

The Location class specifies the strand orientation of a Component.

Range

A Range object specifies a region via discrete,

Cut

The Cut class specifies a location between

GenericLocation

the GenericLocation class is included as a starting point

Measurement

The purpose of the Measure class is to link a numerical value

Module

An SBOLObject converts a Python data structure into an RDF triple store

ModuleDefinition

ModuleDefinition is a principle top-level class for

SBOLObject

An SBOLObject converts a Python data structure into an RDF triple store

Participation

SearchQuery

Search terms to support PartShop advanced search.

PartShop

A class which provides an API front-end for

DateTimeProperty

Member properties of all SBOL objects are defined

FloatProperty

Member properties of all SBOL objects are defined

IntProperty

Member properties of all SBOL objects are defined

LiteralProperty

Member properties of all SBOL objects are defined

OwnedObject

Member properties of all SBOL objects are defined

ReferencedObject

Member properties of all SBOL objects are defined

TextProperty

Member properties of all SBOL objects are defined

URIProperty

Member properties of all SBOL objects are defined

Activity

A generated Entity is linked through a wasGeneratedBy

Agent

Examples of agents are person, organisation or software.

Association

Plan

Usage

SBOLErrorCode

Generic enumeration.

Sequence

The primary structure (eg, nucleotide or amino acid sequence)

SequenceAnnotation

TopLevel

All SBOL classes derived from TopLevel appear as top level nodes

VersionProperty

Functions

getHomespace()

hasHomespace()

setHomespace(ns)

is_alphanumeric_or_underscore(c)

is_not_alphanumeric_or_underscore(c)

Attributes

__version__

DEFAULT_NS

SBOL_URI

RDF_URI

PURL_URI

PROV_URI

PROVO

SYSBIO_URI

OM_URI

PYSBOL2_NS

NODENAME_ABOUT

NODENAME_RESOURCE

VERSION_STRING

SBOL_DOCUMENT

SBOL_IDENTIFIED

SBOL_DOCUMENTED

SBOL_TOP_LEVEL

SBOL_GENERIC_TOP_LEVEL

SBOL_SEQUENCE_ANNOTATION

SBOL_COMPONENT

SBOL_FUNCTIONAL_COMPONENT

SBOL_COMPONENT_DEFINITION

SBOL_SEQUENCE

SBOL_MODULE_DEFINITION

SBOL_MODULE

SBOL_MODEL

SBOL_MAPS_TO

SBOL_INTERACTION

SBOL_PARTICIPATION

SBOL_SEQUENCE_CONSTRAINT

SBOL_LOCATION

SBOL_RANGE

SBOL_CUT

SBOL_COLLECTION

SBOL_GENERIC_LOCATION

SBOL_VARIABLE_COMPONENT

SBOL_COMBINATORIAL_DERIVATION

SBOL_ATTACHMENT

SBOL_IMPLEMENTATION

SBOL_EXPERIMENT

SBOL_EXPERIMENTAL_DATA

UNDEFINED

SBOL_IDENTITY

SBOL_PERSISTENT_IDENTITY

SBOL_VERSION

SBOL_DISPLAY_ID

SBOL_NAME

SBOL_DESCRIPTION

SBOL_TYPES

SBOL_START

SBOL_END

SBOL_SEQUENCE_ANNOTATIONS

SBOL_COMPONENTS

SBOL_COMPONENT_PROPERTY

SBOL_ROLES

SBOL_ELEMENTS

SBOL_ENCODING

SBOL_SEQUENCE_PROPERTY

SBOL_WAS_DERIVED_FROM

SBOL_DEFINITION

SBOL_ACCESS

SBOL_DIRECTION

SBOL_MODELS

SBOL_MODULES

SBOL_FUNCTIONAL_COMPONENTS

SBOL_INTERACTIONS

SBOL_MAPS_TOS

SBOL_PARTICIPATIONS

SBOL_PARTICIPANT

SBOL_LOCAL

SBOL_REMOTE

SBOL_REFINEMENT

SBOL_SOURCE

SBOL_LANGUAGE

SBOL_FRAMEWORK

SBOL_SEQUENCE_CONSTRAINTS

SBOL_SUBJECT

SBOL_OBJECT

SBOL_RESTRICTION

SBOL_ORIENTATION

SBOL_LOCATIONS

SBOL_SOURCE_LOCATIONS

SBOL_ROLE_INTEGRATION

SBOL_MEMBERS

SBOL_AT

SBOL_OPERATOR

SBOL_VARIABLE_COMPONENTS

SBOL_VARIABLE

SBOL_VARIANTS

SBOL_VARIANT_COLLECTIONS

SBOL_VARIANT_DERIVATIONS

SBOL_STRATEGY

SBOL_TEMPLATE

SBOL_ATTACHMENTS

SBOL_MEASUREMENTS

SBOL_UNIT

SBOL_VALUE

SBOL_ACCESS_PRIVATE

SBOL_ACCESS_PUBLIC

SBOL_DIRECTION_IN

SBOL_DIRECTION_OUT

SBOL_DIRECTION_IN_OUT

SBOL_DIRECTION_NONE

SBOL_RESTRICTION_PRECEDES

SBOL_RESTRICTION_SAME_ORIENTATION_AS

SBOL_RESTRICTION_OPPOSITE_ORIENTATION_AS

SBOL_ENCODING_IUPAC

SBOL_ENCODING_IUPAC_PROTEIN

SBOL_ENCODING_SMILES

SBOL_ORIENTATION_INLINE

SBOL_ORIENTATION_REVERSE_COMPLEMENT

SBOL_REFINEMENT_USE_REMOTE

SBOL_REFINEMENT_USE_LOCAL

SBOL_REFINEMENT_VERIFY_IDENTICAL

SBOL_REFINEMENT_MERGE

SBOL_ROLE_INTEGRATION_MERGE

SBOL_ROLE_INTEGRATION_OVERRIDE

SBOL_DESIGN

SBOL_BUILD

SBOL_TEST

SBOL_LEARN

PROVO_ACTIVITY

PROVO_USAGE

PROVO_ASSOCIATION

PROVO_AGENT

PROVO_PLAN

PROVO_WAS_GENERATED_BY

PROVO_STARTED_AT_TIME

PROVO_ENDED_AT_TIME

PROVO_QUALIFIED_ASSOCIATION

PROVO_QUALIFIED_USAGE

PROVO_WAS_INFORMED_BY

PROVO_HAD_PLAN

PROVO_HAD_ROLE

PROVO_AGENT_PROPERTY

PROVO_ENTITY

SBO

SBO_INTERACTION

SBO_INHIBITION

SBO_GENETIC_PRODUCTION

SBO_NONCOVALENT_BINDING

SBO_STIMULATION

SBO_DEGRADATION

SBO_CONTROL

SBO_BIOCHEMICAL_REACTION

SBO_STIMULATED

SBO_CONVERSION

SBO_PROMOTER

SBO_GENE

SBO_INHIBITOR

SBO_INHIBITED

SBO_STIMULATOR

SBO_REACTANT

SBO_PRODUCT

SBO_LIGAND

SBO_NONCOVALENT_COMPLEX

SBO_BINDING_SITE

SBO_SUBSTRATE

SBO_COFACTOR

SBO_SIDEPRODUCT

SBO_ENZYME

SO

SO_MISC

SO_GENE

SO_PROMOTER

SO_CDS

SO_RBS

SO_TERMINATOR

SO_SGRNA

SO_LINEAR

SO_CIRCULAR

SO_PLASMID

BIOPAX_DNA

BIOPAX_RNA

BIOPAX_PROTEIN

BIOPAX_SMALL_MOLECULE

BIOPAX_COMPLEX

EDAM_SBML

EDAM_CELLML

EDAM_BIOPAX

SBO_CONTINUOUS

SBO_DISCRETE

SYSBIO_DESIGN

SYSBIO_BUILD

SYSBIO_TEST

SYSBIO_ANALYSIS

SYSBIO_SAMPLE_ROSTER

IGEM_URI

OM_NS

OM_MEASURE

OM_HAS_UNIT

OM_HAS_NUMERICAL_VALUE

sbol2.__version__ = 1.4.1
class sbol2.Attachment(uri=URIRef('example'), *, type_uri=SBOL_ATTACHMENT, version=VERSION_STRING, source='')

Bases: sbol2.toplevel.TopLevel

class sbol2.Collection(uri=URIRef('example'), version=VERSION_STRING, *, type_uri=SBOL_COLLECTION)

Bases: sbol2.toplevel.TopLevel

class sbol2.CombinatorialDerivation(type_uri=SBOL_COMBINATORIAL_DERIVATION, uri=URIRef('example'), strategy='http://sbols.org/v2#enumerate', version=VERSION_STRING)

Bases: sbol2.toplevel.TopLevel

class sbol2.VariableComponent(type_uri=SBOL_VARIABLE_COMPONENT, uri=URIRef('example'), repeat='http://sbols.org/v2#one', version=VERSION_STRING)

Bases: sbol2.identified.Identified

class sbol2.Component(uri=URIRef('example'), definition='', access=SBOL_ACCESS_PUBLIC, version=VERSION_STRING)

Bases: ComponentInstance

addRole(self, new_role)
removeRole(self, index=0)
static _role_set_role_integration(sbol_obj, arg)

SBOL 2.3.0 says that if a Component has roles then it MUST specify a roleIntegration.

class sbol2.FunctionalComponent(uri=URIRef('example'), definition='', access=SBOL_ACCESS_PUBLIC, direction=SBOL_DIRECTION_NONE, version=VERSION_STRING)

Bases: ComponentInstance

abstract connect(self, interface_component)
abstract mask(self, masked_component)
abstract override(selfself, masked_component)
abstract isMasked(self)
class sbol2.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.

class sbol2.Config

A class which contains global configuration variables for the libSBOL environment.

Configuration variables are accessed through the setOption and getOption methods.

SBOL_DATA_MODEL_REGISTER
static register_extension_class(builder, type_uri)

Register an extension class and its namespace, so custom data can be embedded into and read from SBOL files.

Parameters
  • builder – A no-argument constructor

  • type_uri – An RDF type URI for the extension class

static setHomespace(ns)

Setting the Homespace has several advantages. It simplifies object creation and retrieval from Documents. In addition, it serves as a way for a user to claim ownership of new objects. Generally users will want to specify a Homespace that corresponds to their organization’s web domain. :param ns: The namespace to use as the Homespace :return: None

static getHomespace()
Returns

The Homespace (a string representing the default namespace).

static hasHomespace()
Returns

True if Homespace is set, False otherwise.

static setFileFormat(_file_format)
Parameters

_file_format – The file format to use.

Returns

None

static getFileFormat()
Returns

The file format.

static setOption(option, val)

Configure options for libSBOL. Access online validation and conversion.

Option | Description | Values | # noqa
:————————— | :———————————————————————– | :————– |
homespace | Enable validation and conversion requests through the online validator | http://examples.org |
sbol_compliant_uris | Enables autoconstruction of SBOL-compliant URIs from displayIds | True or False |
sbol_typed_uris | Include the SBOL type in SBOL-compliant URIs | True or False |
output_format | File format for serialization | True or False |
validate | Automatic validation | True or False |
validate_online | Use online (not local) validator for validation and conversion requests | True or False, defaults to True |
validator_url | The http request endpoint for online validation and conversion | A valid URL, set to<br>https://validator.sbolstandard.org/validate/ by default |
java_location | Path to Java executable for offline validation and conversion | A valid URL, set to<br>/usr/bin/java by default |
language | File format for conversion | SBOL2, SBOL1, FASTA, GenBank |
test_equality | Report differences between two files | True or False |
check_uri_compliance | If set to false, URIs in the file will not be checked for compliance<br>with the SBOL specification | True or False |
check_completeness | If set to false, not all referenced objects must be described within<br>the given main_file | True or False |
check_best_practices | If set to true, the file is checked for the best practice rules set<br>in the SBOL specification | True or False |
fail_on_first_error | If set to true, the validator will fail at the first error | True or False |
provide_detailed_stack_trace | If set to true (and failOnFirstError is true) the validator will<br>provide a stack trace for the first validation error | True or False |
uri_prefix | Required for conversion from FASTA and GenBank to SBOL1 or SBOL2,<br>used to generate URIs | True or False |
version | Adds the version to all URIs and to the document | A valid Maven version string |
return_file | Whether or not to return the file contents as a string | True or False |
Parameters
  • option – The option key

  • val – The option value (str or bool expected)

Returns

None

static getOption(option)

Get current option value for online validation and conversion

Parameters

option – The option key

Returns

The option value

class sbol2.ConfigOptions

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

HOMESPACE = homespace
SBOL_COMPLIANT_URIS = sbol_compliant_uris
SBOL_TYPED_URIS = sbol_typed_uris
SERIALIZATION_FORMAT = serialization_format
VALIDATE = validate
VALIDATE_ONLINE = validate_online
VALIDATOR_URL = validator_url
JAVA_LOCATION = java_location
LANGUAGE = language
TEST_EQUALITY = test_equality
CHECK_URI_COMPLIANCE = check_uri_compliance
CHECK_COMPLETENESS = check_completeness
CHECK_BEST_PRACTICES = check_best_practices
FAIL_ON_FIRST_ERROR = fail_on_first_error
PROVIDE_DETAILED_STACK_TRACE = provide_detailed_stack_trace
URI_PREFIX = uri_prefix
SUBSET_URI = subset_uri
VERSION = version
INSERT_TYPE = insert_type
MAIN_FILE_NAME = main_file_name
DIFF_FILE_NAME = diff_file_name
RETURN_FILE = return_file
VERBOSE = verbose
sbol2.getHomespace()
sbol2.hasHomespace()
sbol2.setHomespace(ns)
sbol2.DEFAULT_NS = http://examples.org/
sbol2.SBOL_URI = http://sbols.org/v2
sbol2.RDF_URI = http://www.w3.org/1999/02/22-rdf-syntax-ns#
sbol2.PURL_URI = http://purl.org/dc/terms/
sbol2.PROV_URI = http://www.w3.org/ns/prov
sbol2.PROVO = http://www.w3.org/ns/prov
sbol2.SYSBIO_URI = http://sys-bio.org
sbol2.OM_URI = http://www.ontology-of-units-of-measure.org/resource/om-2/
sbol2.PYSBOL2_NS
sbol2.NODENAME_ABOUT = rdf:about
sbol2.NODENAME_RESOURCE = rdf:resource
sbol2.VERSION_STRING = 1
sbol2.SBOL_DOCUMENT
sbol2.SBOL_IDENTIFIED
sbol2.SBOL_DOCUMENTED
sbol2.SBOL_TOP_LEVEL
sbol2.SBOL_GENERIC_TOP_LEVEL
sbol2.SBOL_SEQUENCE_ANNOTATION
sbol2.SBOL_COMPONENT
sbol2.SBOL_FUNCTIONAL_COMPONENT
sbol2.SBOL_COMPONENT_DEFINITION
sbol2.SBOL_SEQUENCE
sbol2.SBOL_MODULE_DEFINITION
sbol2.SBOL_MODULE
sbol2.SBOL_MODEL
sbol2.SBOL_MAPS_TO
sbol2.SBOL_INTERACTION
sbol2.SBOL_PARTICIPATION
sbol2.SBOL_SEQUENCE_CONSTRAINT
sbol2.SBOL_LOCATION
sbol2.SBOL_RANGE
sbol2.SBOL_CUT
sbol2.SBOL_COLLECTION
sbol2.SBOL_GENERIC_LOCATION
sbol2.SBOL_VARIABLE_COMPONENT
sbol2.SBOL_COMBINATORIAL_DERIVATION
sbol2.SBOL_ATTACHMENT
sbol2.SBOL_IMPLEMENTATION
sbol2.SBOL_EXPERIMENT
sbol2.SBOL_EXPERIMENTAL_DATA
sbol2.UNDEFINED
sbol2.SBOL_IDENTITY
sbol2.SBOL_PERSISTENT_IDENTITY
sbol2.SBOL_VERSION
sbol2.SBOL_DISPLAY_ID
sbol2.SBOL_NAME
sbol2.SBOL_DESCRIPTION
sbol2.SBOL_TYPES
sbol2.SBOL_START
sbol2.SBOL_END
sbol2.SBOL_SEQUENCE_ANNOTATIONS
sbol2.SBOL_COMPONENTS
sbol2.SBOL_COMPONENT_PROPERTY
sbol2.SBOL_ROLES
sbol2.SBOL_ELEMENTS
sbol2.SBOL_ENCODING
sbol2.SBOL_SEQUENCE_PROPERTY
sbol2.SBOL_WAS_DERIVED_FROM
sbol2.SBOL_DEFINITION
sbol2.SBOL_ACCESS
sbol2.SBOL_DIRECTION
sbol2.SBOL_MODELS
sbol2.SBOL_MODULES
sbol2.SBOL_FUNCTIONAL_COMPONENTS
sbol2.SBOL_INTERACTIONS
sbol2.SBOL_MAPS_TOS
sbol2.SBOL_PARTICIPATIONS
sbol2.SBOL_PARTICIPANT
sbol2.SBOL_LOCAL
sbol2.SBOL_REMOTE
sbol2.SBOL_REFINEMENT
sbol2.SBOL_SOURCE
sbol2.SBOL_LANGUAGE
sbol2.SBOL_FRAMEWORK
sbol2.SBOL_SEQUENCE_CONSTRAINTS
sbol2.SBOL_SUBJECT
sbol2.SBOL_OBJECT
sbol2.SBOL_RESTRICTION
sbol2.SBOL_ORIENTATION
sbol2.SBOL_LOCATIONS
sbol2.SBOL_SOURCE_LOCATIONS
sbol2.SBOL_ROLE_INTEGRATION
sbol2.SBOL_MEMBERS
sbol2.SBOL_AT
sbol2.SBOL_OPERATOR
sbol2.SBOL_VARIABLE_COMPONENTS
sbol2.SBOL_VARIABLE
sbol2.SBOL_VARIANTS
sbol2.SBOL_VARIANT_COLLECTIONS
sbol2.SBOL_VARIANT_DERIVATIONS
sbol2.SBOL_STRATEGY
sbol2.SBOL_TEMPLATE
sbol2.SBOL_ATTACHMENTS
sbol2.SBOL_MEASUREMENTS
sbol2.SBOL_UNIT
sbol2.SBOL_VALUE
sbol2.SBOL_ACCESS_PRIVATE
sbol2.SBOL_ACCESS_PUBLIC
sbol2.SBOL_DIRECTION_IN
sbol2.SBOL_DIRECTION_OUT
sbol2.SBOL_DIRECTION_IN_OUT
sbol2.SBOL_DIRECTION_NONE
sbol2.SBOL_RESTRICTION_PRECEDES
sbol2.SBOL_RESTRICTION_SAME_ORIENTATION_AS
sbol2.SBOL_RESTRICTION_OPPOSITE_ORIENTATION_AS
sbol2.SBOL_ENCODING_IUPAC = http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html
sbol2.SBOL_ENCODING_IUPAC_PROTEIN = http://www.chem.qmul.ac.uk/iupac/AminoAcid/
sbol2.SBOL_ENCODING_SMILES = http://www.opensmiles.org/opensmiles.html
sbol2.SBOL_ORIENTATION_INLINE
sbol2.SBOL_ORIENTATION_REVERSE_COMPLEMENT
sbol2.SBOL_REFINEMENT_USE_REMOTE
sbol2.SBOL_REFINEMENT_USE_LOCAL
sbol2.SBOL_REFINEMENT_VERIFY_IDENTICAL
sbol2.SBOL_REFINEMENT_MERGE
sbol2.SBOL_ROLE_INTEGRATION_MERGE
sbol2.SBOL_ROLE_INTEGRATION_OVERRIDE
sbol2.SBOL_DESIGN
sbol2.SBOL_BUILD
sbol2.SBOL_TEST
sbol2.SBOL_LEARN
sbol2.PROVO_ACTIVITY
sbol2.PROVO_USAGE
sbol2.PROVO_ASSOCIATION
sbol2.PROVO_AGENT
sbol2.PROVO_PLAN
sbol2.PROVO_WAS_GENERATED_BY
sbol2.PROVO_STARTED_AT_TIME
sbol2.PROVO_ENDED_AT_TIME
sbol2.PROVO_QUALIFIED_ASSOCIATION
sbol2.PROVO_QUALIFIED_USAGE
sbol2.PROVO_WAS_INFORMED_BY
sbol2.PROVO_HAD_PLAN
sbol2.PROVO_HAD_ROLE
sbol2.PROVO_AGENT_PROPERTY
sbol2.PROVO_ENTITY
sbol2.SBO = http://identifiers.org/biomodels.sbo/SBO:
sbol2.SBO_INTERACTION
sbol2.SBO_INHIBITION
sbol2.SBO_GENETIC_PRODUCTION
sbol2.SBO_NONCOVALENT_BINDING
sbol2.SBO_STIMULATION
sbol2.SBO_DEGRADATION
sbol2.SBO_CONTROL
sbol2.SBO_BIOCHEMICAL_REACTION
sbol2.SBO_STIMULATED
sbol2.SBO_CONVERSION
sbol2.SBO_PROMOTER
sbol2.SBO_GENE
sbol2.SBO_INHIBITOR
sbol2.SBO_INHIBITED
sbol2.SBO_STIMULATOR
sbol2.SBO_REACTANT
sbol2.SBO_PRODUCT
sbol2.SBO_LIGAND
sbol2.SBO_NONCOVALENT_COMPLEX
sbol2.SBO_BINDING_SITE
sbol2.SBO_SUBSTRATE
sbol2.SBO_COFACTOR
sbol2.SBO_SIDEPRODUCT
sbol2.SBO_ENZYME
sbol2.SO = http://identifiers.org/so/SO:
sbol2.SO_MISC
sbol2.SO_GENE
sbol2.SO_PROMOTER
sbol2.SO_CDS
sbol2.SO_RBS
sbol2.SO_TERMINATOR
sbol2.SO_SGRNA
sbol2.SO_LINEAR
sbol2.SO_CIRCULAR
sbol2.SO_PLASMID
sbol2.BIOPAX_DNA = http://www.biopax.org/release/biopax-level3.owl#DnaRegion
sbol2.BIOPAX_RNA = http://www.biopax.org/release/biopax-level3.owl#RnaRegion
sbol2.BIOPAX_PROTEIN = http://www.biopax.org/release/biopax-level3.owl#Protein
sbol2.BIOPAX_SMALL_MOLECULE = http://www.biopax.org/release/biopax-level3.owl#SmallMolecule
sbol2.BIOPAX_COMPLEX = http://www.biopax.org/release/biopax-level3.owl#Complex
sbol2.EDAM_SBML = http://identifiers.org/edam/format_2585
sbol2.EDAM_CELLML = http://identifiers.org/edam/format_3240
sbol2.EDAM_BIOPAX = http://identifiers.org/edam/format_3156
sbol2.SBO_CONTINUOUS
sbol2.SBO_DISCRETE
sbol2.SYSBIO_DESIGN
sbol2.SYSBIO_BUILD
sbol2.SYSBIO_TEST
sbol2.SYSBIO_ANALYSIS
sbol2.SYSBIO_SAMPLE_ROSTER
sbol2.IGEM_URI = http://wiki.synbiohub.org/wiki/Terms/igem
sbol2.OM_NS
sbol2.OM_MEASURE :str
sbol2.OM_HAS_UNIT :str
sbol2.OM_HAS_NUMERICAL_VALUE :str
class sbol2.Design(uri='example', version=VERSION_STRING, structure=None, function=None)

Bases: sbol2.toplevel.TopLevel

This class represents a biological Design. A Design is a conceptual representation of a biological system that a synthetic biologist intends to build. A Design is the first object created in libSBOL’s formalized Design-Build-Test-Analysis workflow.

abstract generateDesign(self, uri, agent=None, plan=None, usages=None)
class sbol2.Experiment(uri=URIRef('example'), version=VERSION_STRING)

Bases: sbol2.toplevel.TopLevel

class sbol2.ExperimentalData(uri=URIRef('example'), version=VERSION_STRING)

Bases: sbol2.toplevel.TopLevel

class sbol2.Identified(type_uri=SBOL_IDENTIFIED, uri=URIRef('example'), version=VERSION_STRING)

Bases: sbol2.object.SBOLObject

version :Union[str, sbol2.versionproperty.VersionProperty]
abstract generate(self)
update_uri(self)

Recursively generates SBOL compliant ids for an object and all its owned objects, then checks to make sure that these ids are unique. :return: None

copy(self, target_doc=None, target_namespace=None, version=None)
class sbol2.Implementation(uri=URIRef('example'), version=VERSION_STRING, *, type_uri=SBOL_IMPLEMENTATION)

Bases: sbol2.toplevel.TopLevel

class sbol2.Interaction(uri='example', interaction_type=SBO_INTERACTION, *, type_uri=SBOL_INTERACTION, version=VERSION_STRING)

Bases: sbol2.identified.Identified

class sbol2.Location(uri=URIRef('example'), orientation=SBOL_ORIENTATION_INLINE, *, type_uri=SBOL_LOCATION, version=VERSION_STRING)

Bases: sbol2.identified.Identified

The Location class specifies the strand orientation of a Component.

class sbol2.Range(uri=URIRef('example'), start=1, end=2, *, type_uri=SBOL_RANGE, version=VERSION_STRING)

Bases: Location

A Range object specifies a region via discrete, inclusive start and end positions that correspond to indices for characters in the elements String of a Sequence. 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.

precedes(self, comparand)
follows(self, comparand)
adjoins(self, comparand)
contains(self, comparand)
overlaps(self, comparand)
length(self)
class sbol2.Cut(uri=URIRef('example'), at=0, *, type_uri=SBOL_CUT, version=VERSION_STRING)

Bases: Location

The Cut class specifies a location between two coordinates of a Sequence’s elements.

class sbol2.GenericLocation(uri=URIRef('example'), *, type_uri=SBOL_GENERIC_LOCATION, version=VERSION_STRING)

Bases: Location

the GenericLocation class is included as a starting point for specifying regions on Sequence objects with encoding properties other than IUPAC and potentially nonlinear structure. This class can also be used to set the orientation of a SequenceAnnotation and any associated Component when their parent ComponentDefinition is a partial design that lacks a Sequence.

class sbol2.Measurement(uri=URIRef('example'), value=0.0, unit='', version=VERSION_STRING)

Bases: sbol2.identified.Identified

The purpose of the Measure class is to link a numerical value to a unit of measure.

addType(self, new_type)
removeType(self, index=0)
class sbol2.Module(uri='example', *, definition='', version=VERSION_STRING, type_uri=SBOL_MODULE)

Bases: sbol2.identified.Identified

An SBOLObject converts a Python data structure into an RDF triple store and contains methods for serializing and parsing RDF triples.

class sbol2.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)
class sbol2.SBOLObject(type_uri=rdflib.URIRef(UNDEFINED), uri=rdflib.URIRef('example'))

An SBOLObject converts a Python data structure into an RDF triple store and contains methods for serializing and parsing RDF triples.

abstract _serialize(self)
abstract _nest(self)
abstract _makeQName(self, uri)
property logger(self)
__uri__(self) sbol2.constants.rdflib.URIRef

Returns a URIRef representing this object.

Returns

The identity of this object as an rdflib.URIRef

Return type

rdflib.URIRef

property type(self)
property this(self)
getTypeURI(self)
Returns

The uniform resource identifier that describes

the RDF-type of this SBOL Object.

getClassName(self, rdf_type)

Parses a local class name from the RDF-type of this SBOL Object.

cast(self, cls)
find(self, uri)

Search this object recursively to see if an object or any child object with URI already exists.

Parameters

uri – The URI to search for.

Returns

The SBOLObject associated with this URI if it exists,

None otherwise.

abstract cacheObjects(self, objectCache)

TODO document

Parameters

objectCache – a dictionary mapping strings to SBOLObjects

Returns

None

find_property(self, uri)

Search this object recursively to see if it contains a member property with the given RDF type.

Parameters

uri – The RDF type of the property to search for.

Returns

The SBOLObject that contains a member property

with the specified RDF type, None otherwise

find_property_value(self, uri, value, matches=None)

Search this object recursively to see if it contains a member property with the given RDF type and indicated property value.

Parameters
  • uri – The RDF type of the property to search for.

  • value – The property value to match.

  • matches

Returns

A vector containing all objects found that contain

a member property with the specified RDF type

find_reference(self, uri)

Search this object recursively to see if it contains a member property with the given RDF type and indicated property value.

Parameters

uri – A URI, either an ontology term or an object reference,

to search for. :return: A vector containing all objects found that contain the URI in a property value.

compare(self, other)

Compare two SBOLObjects. The behavior is currently undefined for objects with custom annotations or extension classes.

Parameters

other – The object being compared to this one.

Returns

True if the objects are identical, False if they are different.

getPropertyValue(self, property_uri: str) str

Get the value of a custom annotation property by its URI.

Parameters

property_uri (str) – The URI for the property.

Returns

The value of the property.

Return type

str

Raises

SBOLError(SBOL_ERROR_NOT_FOUND) if property does not exist

getPropertyValues(self, property_uri: str) List[str]

Get all values of a custom annotation property by its URI.

Parameters

property_uri (str) – The URI for the property.

Returns

A vector of property values.

Return type

list of strings

Raises

SBOLError(SBOL_ERROR_NOT_FOUND) if property does not exist

getProperties(self)

Gets URIs for all properties contained by this object. This includes SBOL core properties as well as custom annotations. Use this to find custom extension data in an SBOL file.

Returns

A vector of URIs that identify the properties contained in this object.

setPropertyValue(self, property_uri, val)

Set and overwrite the value for a user-defined annotation property.

Parameters
  • property_uri

  • val – A string

Returns

None

abstract addPropertyValue(self, property_uri, val)

Append a value to a user-defined annotation property.

Parameters
  • property_uri

  • val – Either a literal or URI value.

Returns

None

abstract setAnnotation(self, property_uri, val)

Set the value for a user-defined annotation property. Synonymous with setPropertyValue.

Parameters
  • property_uri

  • val – If the value is a URI,

it should be surrounded by angle brackets, else it will be interpreted as a literal value. :return: None

abstract getAnnotation(self, property_uri)

Get the value of a custom annotation property by its URI. Synonymous with getPropertyValue.

Parameters

property_uri – The URI for the property.

Returns

The value of the property or SBOL_ERROR_NOT_FOUND.

abstract apply(self, callback, user_data)

Recursively call this callback function on the user_data provided :param callback: the callback function :param user_data: the input to the callback :return: None

abstract update_uri(self)

Recursively generates SBOL compliant ids for an object and all its owned objects, then checks to make sure that these ids are unique. :return: None

build_graph(self, graph)
__str__(self)

Return str(self).

is_top_level(self)
__getattribute__(self, name)

Return getattr(self, name).

_is_transparent_attribute(self, name)
_set_transparent_attribute(self, name, value)
__setattr__(self, name, value)

Implement setattr(self, name, value).

_added_to_document(self, doc)

Classes can override this method to do extra work when being added to a document.

class sbol2.Participation(type_uri=SBOL_PARTICIPATION, uri=URIRef('example'), participant='', version=VERSION_STRING)

Bases: sbol2.identified.Identified

addRole(self, new_role)
removeRole(self, index=0)
abstract define(self, species, role='')
class sbol2.SearchQuery(search_target: str = SBOL_COMPONENT_DEFINITION, offset: int = 0, limit: int = 25)

Bases: sbol2.toplevel.TopLevel

Search terms to support PartShop advanced search.

__setitem__(self, key, value)
__getitem__(self, item)
query_dict(self) dict

Convert this search query to a query dictionary suitable for urllib.parse.urlencode().

class sbol2.PartShop(url, spoofed_url='')

A class which provides an API front-end for online bioparts repositories

_validate_url(self, url, url_name)

Function to validate url with type checking, urlparse and terminal forward slash’s as well as allowing spoofed url to pass as ‘’

property logger(self)
abstract count(self)

Return the count of objects contained in a PartShop

spoof(self, spoofed_url)
sparqlQuery(self, query)

Issue a SPARQL query :param query: the SPARQL query :return: the HTTP response object

pull(self, uris, doc, recursive=True)

Retrieve an object from an online resource :param uris: A list of SBOL objects you want to retrieve, or a single SBOL object URI :param doc: A document to add the data to :param recursive: Whether the GET request should be recursive :return: nothing (doc parameter is updated, or an exception is thrown)

submit(self, doc, collection='', overwrite=0)

Submit a SBOL Document to SynBioHub :param doc: The Document to submit :param collection: The URI of a SBOL Collection to which the Document contents will be uploaded :param overwrite: An integer code: 0 (default) - do not overwrite, 1 - overwrite, 2 - merge :return: the HTTP response object

_uri2url(self, uri)

Converts an SBOL URI to a URL for running queries to a SynBioHub endpoint.

remove(self, uri)
login(self, user_id, password='')

In order to submit to a PartShop, you must login first. Register on [SynBioHub](http://synbiohub.org) to obtain account credentials. :param user_id: User ID :param password: User password :return: the HTTP response object

getKey(self)
getURL(self)
getUser(self)
getSpoofedURL(self)
attachFile(self, top_level_uri, filepath)

Attach a file to an object in SynBioHub.

Returns None if successful.

Raises SBOLError with code SBOL_ERROR_HTTP_UNAUTHORIZED if it there is an HTTP Unauthorized response.

Raises SBOLError with code SBOL_ERROR_BAD_HTTP_REQUEST on any other HTTP error. The actual status code is embedded in the string message.

downloadAttachment(self, attachment_uri, filepath='.')

Download a file attachment from SynBioHub. :param attachment_uri: The URI of the file to download :param filepath: The local path or filename to which the file will be written Returns None if successful.

Raises EnvironmentError if the filepath is invalid

Raises SBOLError with code SBOL_ERROR_HTTP_UNAUTHORIZED if it there is an HTTP Unauthorized response.

Raises SBOLError with code SBOL_ERROR_BAD_HTTP_REQUEST on any other HTTP error. The actual status code is embedded in the string message.

_make_search_item(self, item: dict) sbol2.identified.Identified

Given a URL, perform the search and parse the results. The URL is formed by one of the other search methods: search_exact, search_general, and search_advanced.

search_general(self, search_text: str, object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified]
search_exact(self, search_text: str, object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, property_uri: Optional[str] = None, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified]
search_advanced(self, search_query: sbol2.SearchQuery)
search(self, search_text: Union[str, sbol2.SearchQuery], object_type: Optional[str] = SBOL_COMPONENT_DEFINITION, property_uri: Optional[Union[str, int]] = None, offset: int = 0, limit: int = 25) List[sbol2.identified.Identified]
_search_count(self, url)
search_count(self, search_text, object_type, property_uri)
search_count_advanced(self, search_query)
searchCount(self, search_text, object_type=None, property_uri=None)

Returns the number of records matching the given criteria.

class sbol2.DateTimeProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.FloatProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value: rdflib.Literal) float
convert_from_user(self, value: Any) Union[rdflib.Literal, None]
Raises

ValueError if value cannot be converted to float

class sbol2.IntProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.LiteralProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

property value(self)
getSinglePropertyValue(self)
getPropertyValueList(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
add(self, new_value)

Appends the new value to a list of values, for properties that allow it.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.OwnedObject(property_owner, sbol_uri, builder, lower_bound, upper_bound, validation_rules=None, first_object=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

create(self, uri, builder=None)

Creates an instance appropriate for this owned object collection.

uri - the name of the object

add(self, sbol_obj)

Appends the new value to a list of values, for properties that allow it.

__getitem__(self, id)
get_int(self, id)
find(self, query)

Check if a value in this property matches the query.

get_uri(self, id)
find_persistent_identity(self, search_uri)
find_resource(self, uri, resource_namespaces, object_store, parent_obj, typedURI=False)
get(self, uri='')
__setitem__(self, rdf_type, sbol_obj)
convert_to_user(self, value)
getSinglePropertyValue(self)
getPropertyValueList(self)
property value(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
remove(self, identifier)

id can be either an integer index or a string URI

removeOwnedObject_int(self, index)
removeOwnedObject_str(self, uri)
clear(self)

Clear all property values.

__len__(self)
class sbol2.ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, upper_bound, validation_rules, initial_value=None)

Bases: URIProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

get(self, item)

Return reference object at this index. :param item (int) the index

set(self, new_value)
_to_uri(self, obj)

Converts strings, URIRefs, and sbol.Identified instances into rdflib.URIRefs.

setSinglePropertyValue(self, new_value)
setPropertyValueList(self, new_value)
add(self, uri)

Appends the new value to a list of values, for properties that allow it.

addReference(self, uri)
_ensure_uri_ref(self, thing)

This method ensures that what gets returned is an rdflib.URIRef. If the set methods are working properly, this should be unnecessary. Hence the warning message if what it finds is not a URIRef. The goal is to remove this method eventually.

property value(self)
class sbol2.TextProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: LiteralProperty

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

convert_to_user(self, value)
class sbol2.URIProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value=None)

Bases: Property

Member properties of all SBOL objects are defined using a Property object.

The Property class provides a generic interface for accessing SBOL objects. At a low level, the Property class converts SBOL data structures into RDF triples.

property value(self)
getSinglePropertyValue(self)
getPropertyValueList(self)
set(self, new_value)
setSinglePropertyValue(self, new_value)
setPropertyValueList(self, value)
add(self, new_value)

Appends the new value to a list of values, for properties that allow it.

convert_to_user(self, value)
convert_from_user(self, value)
class sbol2.Activity(uri=URIRef('example'), action_type='', version=VERSION_STRING, type_uri=PROVO_ACTIVITY)

Bases: sbol2.toplevel.TopLevel

A generated Entity is linked through a wasGeneratedBy relationship to an Activity, which is used to describe how different Agents

and other entities were used. An Activity is linked through a

a qualifiedAssociation to Associations, to describe the role of agents, and is linked through qualifiedUsage to Usages to describe the role of other entities used as part of the activity. Moreover, each Activity includes optional startedAtTime and endedAtTime properties. When using Activity to capture how an entity was derived, it is expected that any additional information needed will be attached as annotations. This may include software settings or textual notes. Activities can also be linked together using the wasInformedBy relationship to provide dependency without explicitly specifying start and end times.

_startedAtTime
_endedAtTime
wasInformedBy
associated
usages
agent
plan
class sbol2.Agent(uri=URIRef('example'), version=VERSION_STRING, type_uri=PROVO_AGENT)

Bases: sbol2.toplevel.TopLevel

Examples of agents are person, organisation or software. These agents should be annotated with additional information, such as software version needed to be able to run the same software again.

class sbol2.Association(uri=URIRef('example'), agent=None, role=None, version=VERSION_STRING, type_uri=PROVO_ASSOCIATION)

Bases: sbol2.identified.Identified

agent
_roles
plan
addRole(self, new_role)
removeRole(self, index=0)
class sbol2.Plan(uri=URIRef('example'), version=VERSION_STRING, type_uri=PROVO_PLAN)

Bases: sbol2.toplevel.TopLevel

class sbol2.Usage(uri=URIRef('example'), entity=None, role=None, version=VERSION_STRING, type_uri=PROVO_USAGE)

Bases: sbol2.identified.Identified

_entity
_roles
addRole(self, new_role)
removeRole(self, index=0)
exception sbol2.SBOLError(err: SBOLErrorCode, message: Any)

Bases: Exception

Common base class for all non-exit exceptions.

what(self)
error_code(self)
class sbol2.SBOLErrorCode

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

DUPLICATE_URI_ERROR = 1
NOT_FOUND_ERROR = 2
SBOL_ERROR_NOT_FOUND = 3
END_OF_LIST = 4
SBOL_ERROR_END_OF_LIST = 5
SBOL_ERROR_SERIALIZATION = 6
SBOL_ERROR_PARSE = 7
SBOL_ERROR_MISSING_NAMESPACE = 8
SBOL_ERROR_NONCOMPLIANT_VERSION = 9
SBOL_ERROR_COMPLIANCE = 10
SBOL_ERROR_MISSING_DOCUMENT = 11
SBOL_ERROR_INVALID_ARGUMENT = 12
SBOL_ERROR_FILE_NOT_FOUND = 13
SBOL_ERROR_ORPHAN_OBJECT = 14
SBOL_ERROR_TYPE_MISMATCH = 15
SBOL_ERROR_BAD_HTTP_REQUEST = 16
SBOL_ERROR_URI_NOT_UNIQUE = 17
SBOL_ERROR_HTTP_UNAUTHORIZED = 18
class sbol2.Sequence(uri=URIRef('example'), elements='', encoding=SBOL_ENCODING_IUPAC, version=VERSION_STRING, type_uri=SBOL_SEQUENCE)

Bases: sbol2.toplevel.TopLevel

The primary structure (eg, nucleotide or amino acid sequence) of a ComponentDefinition object.

__len__(self)
Returns

The length of the primary sequence in the elements property.

__bool__(self)
length(self)
Returns

The length of the primary sequence in the elements property.

abstract synthesize(self, clone_id)
Parameters

clone_id – A URI for the build, or displayId if working in

SBOLCompliant mode. :return:

compile(self, composite_sequence='', assembly_method=None)
class sbol2.SequenceAnnotation(uri='example', version=VERSION_STRING)

Bases: sbol2.identified.Identified

addRole(self, new_role)
removeRole(self, index=0)
abstract precedes(self, comparand)

Tests if the comparand SequenceAnnotation precedes this one according to base coordinates

Parameters

comparand – Another SequenceAnnotation

Returns

true or false

abstract follows(self, comparand)

Tests if the comparand SequenceAnnotation follows this one according to base coordinates

Parameters

comparand – Another SequenceAnnotation

Returns

true or false

abstract contains(self, comparand)

Tests if the comparand SequenceAnnotation is contained within the same start and end base coordinates as this one. This is mutually exclusive with overlaps.

Parameters

comparand – Another SequenceAnnotation

Returns

true or false

abstract overlaps(self, comparand)

Tests if the comparand SequenceAnnotation overlaps with this one in the primary sequence

Parameters

comparand – Another SequenceAnnotation

Returns

true or false

abstract extract(self, start_reference=1)

Convert a SequenceAnnotation to a subcomponent

Parameters

start_reference

Returns

A ComponentDefinition representing the subcomponent

abstract length(self)
Returns

The length of a SequenceAnnotation in base coordinates.

class sbol2.TopLevel(type_uri=SBOL_TOP_LEVEL, uri=URIRef('example'), version=VERSION_STRING)

Bases: sbol2.identified.Identified

All SBOL classes derived from TopLevel appear as top level nodes in the RDF/XML document tree and SBOL files.

abstract addToDocument(self, document)
abstract generateTopLevel(self, uri, agent=None, plan=None, usages=None)
Parameters

uri – A URI for the new object, or a displayId if operating in SBOLCompliant mode

Returns

abstract initialize(self, uri)
update_uri(self)

Recursively generates SBOL compliant ids for an object and all its owned objects, then checks to make sure that these ids are unique. :return: None

is_top_level(self)
sbol2.is_alphanumeric_or_underscore(c)
sbol2.is_not_alphanumeric_or_underscore(c)
class sbol2.VersionProperty

Bases: sbol2.property.LiteralProperty

convert_to_user(self, value)
convert_from_user(self, value)
static _make_version(major: int, minor: int, micro: int) packaging.version.Version
static increment_major(version: str) str