sbol2

Package Contents

Classes

Attachment(uri=URIRef(‘example’), *, type_uri=SBOL_ATTACHMENT, version=VERSION_STRING, source=’‘) All SBOL classes derived from TopLevel appear as top level nodes
Collection(uri=URIRef(‘example’), version=VERSION_STRING, *, type_uri=SBOL_COLLECTION) All SBOL classes derived from TopLevel appear as top level nodes
CombinatorialDerivation(type_uri=SBOL_COMBINATORIAL_DERIVATION, uri=URIRef(‘example’), strategy=’http://sbols.org/v2#enumerate’, version=VERSION_STRING)
Component(uri=URIRef(‘example’), definition=’‘, access=SBOL_ACCESS_PUBLIC, version=VERSION_STRING)
FunctionalComponent(uri=URIRef(‘example’), definition=’‘, access=SBOL_ACCESS_PUBLIC, direction=SBOL_DIRECTION_NONE, version=VERSION_STRING)
ComponentDefinition(uri=URIRef(‘example’), component_type=URIRef(BIOPAX_DNA), version=VERSION_STRING, type_uri=SBOL_COMPONENT_DEFINITION) The ComponentDefinition class represents the structural entities
Config() A class which contains global configuration variables
ConfigOptions() Generic enumeration.
Design(uri=’example’, version=VERSION_STRING, structure=None, function=None) This class represents a biological Design.
Document(filename=None) The Document is a container for all SBOL data objects.
Experiment(uri=URIRef(‘example’), version=VERSION_STRING)
ExperimentalData(uri=URIRef(‘example’), version=VERSION_STRING)
Identified(type_uri=SBOL_IDENTIFIED, uri=URIRef(‘example’), version=VERSION_STRING)
Implementation(uri=URIRef(‘example’), version=VERSION_STRING, *, type_uri=SBOL_IMPLEMENTATION)
Interaction(uri=’example’, interaction_type=SBO_INTERACTION, *, type_uri=SBOL_INTERACTION, version=VERSION_STRING)
Location(uri=URIRef(‘example’), orientation=SBOL_ORIENTATION_INLINE, *, type_uri=SBOL_LOCATION, version=VERSION_STRING) The Location class specifies the strand orientation of a Component.
Range(uri=URIRef(‘example’), start=1, end=2, *, type_uri=SBOL_RANGE, version=VERSION_STRING) A Range object specifies a region via discrete,
Cut(uri=URIRef(‘example’), at=0, *, type_uri=SBOL_CUT, version=VERSION_STRING) The Cut class specifies a location between
GenericLocation(uri=URIRef(‘example’), *, type_uri=SBOL_GENERIC_LOCATION, version=VERSION_STRING) the GenericLocation class is included as a starting point
Measurement(uri=URIRef(‘example’), value=0.0, unit=’‘, version=VERSION_STRING) The purpose of the Measure class is to link a numerical value
Module(uri=’example’, *, definition=’‘, version=VERSION_STRING, type_uri=SBOL_MODULE) An SBOLObject converts a Python data structure into an RDF triple store
ModuleDefinition(uri=rdflib.URIRef(‘example’), version=VERSION_STRING, type_uri=SBOL_MODULE_DEFINITION) ModuleDefinition is a principle top-level class for
SBOLObject(type_uri=rdflib.URIRef(UNDEFINED), uri=rdflib.URIRef(‘example’)) An SBOLObject converts a Python data structure into an RDF triple store
Participation(type_uri=SBOL_PARTICIPATION, uri=URIRef(‘example’), participant=’‘, version=VERSION_STRING)
SearchQuery(search_target: str = SBOL_COMPONENT_DEFINITION, offset: int = 0, limit: int = 25) Search terms to support PartShop advanced search.
DateTimeProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined
FloatProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined
IntProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined
LiteralProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined
OwnedObject(property_owner, sbol_uri, builder, lower_bound, upper_bound, validation_rules=None, first_object=None) Member properties of all SBOL objects are defined
ReferencedObject(property_owner, type_uri, reference_type_uri, lower_bound, upper_bound, validation_rules, initial_value=None) Member properties of all SBOL objects are defined
TextProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined
URIProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules, initial_value=None) Member properties of all SBOL objects are defined
Activity(uri=URIRef(‘example’), action_type=’‘, version=VERSION_STRING, type_uri=PROVO_ACTIVITY) A generated Entity is linked through a wasGeneratedBy
Agent(uri=URIRef(‘example’), version=VERSION_STRING, type_uri=PROVO_AGENT) Examples of agents are person, organisation or software.
Association(uri=URIRef(‘example’), agent=None, role=None, version=VERSION_STRING, type_uri=PROVO_ASSOCIATION)
Plan(uri=URIRef(‘example’), version=VERSION_STRING, type_uri=PROVO_PLAN)
Usage(uri=URIRef(‘example’), entity=None, role=None, version=VERSION_STRING, type_uri=PROVO_USAGE)
SBOLErrorCode() Generic enumeration.
Sequence(uri=URIRef(‘example’), elements=’‘, encoding=SBOL_ENCODING_IUPAC, version=VERSION_STRING, type_uri=SBOL_SEQUENCE) The primary structure (eg, nucleotide or amino acid sequence)
SequenceAnnotation(uri=’example’, version=VERSION_STRING)
TopLevel(type_uri=SBOL_TOP_LEVEL, uri=URIRef(‘example’), version=VERSION_STRING) All SBOL classes derived from TopLevel appear as top level nodes
VersionProperty(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None) Member properties of all SBOL objects are defined

Functions

getHomespace()
hasHomespace()
setHomespace(ns)
IGEM_STANDARD_ASSEMBLY(parts_list)
is_alphanumeric_or_underscore(c)
is_not_alphanumeric_or_underscore(c)
sbol2.__version__ = 1.0
class sbol2.Attachment(uri=URIRef('example'), *, type_uri=SBOL_ATTACHMENT, version=VERSION_STRING, source='')

Bases: sbol2.toplevel.TopLevel

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

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

Bases: sbol2.toplevel.TopLevel

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

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.Component(uri=URIRef('example'), definition='', access=SBOL_ACCESS_PUBLIC, version=VERSION_STRING)

Bases: sbol2.component.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: sbol2.component.ComponentInstance

connect(self, interface_component)
mask(self, masked_component)
override(selfself, masked_component)
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
sequence
_added_to_document(self, doc)

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

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.

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.
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.
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

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:

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

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

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.

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.

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
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

build(self)

TODO document

Returns:A ComponentDefinition.
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)
Returns:The uniform resource identifier that describes

the RDF-type of this SBOL Object.

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
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 | Enable validation and conversion requests through the online validator | True or False |
validator_url | The http request endpoint for validation | A valid URL, set to<br>http://www.async.ece.utah.edu/sbol-validator/endpoint.php 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
VALIDATOR_URL = validator_url
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: 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.

generateDesign(self, uri, agent=None, plan=None, usages=None)
class sbol2.Document(filename=None)

Bases: sbol2.identified.Identified

The Document is a container for all SBOL data objects.

In a previous era, engineers might sit at a drafting board and draft a design by hand. The engineer’s drafting sheet in LibSBOL is called a Document. The Document serves as a container, initially empty, for SBOL data objects. All file I/O operations are performed on the Document to populate it with SBOL objects representing design elements.

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.
addCitation(self, new_citation)
removeCitation(self, index=0)
addKeyword(self, new_keyword)
removeKeyword(self, index=0)
add(self, sbol_obj)

Register an object in the Document.

Parameters:sbol_obj – The SBOL object(s) you want to serialize. Either a single object or a list of objects.
Returns:None
add_list(self, sbol_objs)
addNamespace(self, namespace, prefix)

Add a new namespace to the Document.

Parameters:
  • namespace – The namespace, eg. http://sbols.org/v2#
  • prefix – The namespace prefix, eg. sbol
Returns:

addComponentDefinition(self, sbol_obj)

Convenience method for adding a component definition.

Parameters:sbol_obj – component definition
Returns:None
addModuleDefinition(self, sbol_obj)

Convenience method for adding a module definition.

Parameters:sbol_obj – module definition
Returns:None
addCollection(self, sbol_obj)

Convenience method for adding a collection.

Parameters:sbol_obj – a Collection
Returns:None
addSequence(self, sbol_obj)

Convenience method for adding a sequence.

Parameters:sbol_obj – sequence
Returns:None
addModel(self, sbol_obj)

Convenience method for adding a model.

Parameters:sbol_obj – model
Returns:None
addImplementation(self, implementation)

Convenience method for adding an implementation.

addAttachment(self, attachment)

Add an attachment to this document.

create(self, uri)

Creates another SBOL object derived from TopLevel and adds it to the Document. NOTE: originally from ReferencedObject :param uri: In “open world” mode, this is a full URI and the same as the returned URI. If the default namespace for libSBOL has been configured, then this argument should simply be a local identifier. If SBOL-compliance is enabled, this argument should be the intended displayId of the new object. A full URI is automatically generated and returned. :return: The full URI of the created object

get(self, uri)

Finds the SBOL object with the given URI.

Parameters:uri (str) – URI of the extension object
Returns:The matching SBOLObject
Return type:SBOLObject
Raises:SBOLError if the given uri is not found
getAll(self)

Retrieve a list of objects from the Document.

Returns:A list of objects from the Document.
getComponentDefinition(self, uri)
getModuleDefinition(self, uri)
getSequence(self, uri)
getModel(self, uri)
getImplementation(self, uri)
getCollection(self, uri: str)
write(self, filename)

Serialize all objects in this Document to an RDF/XML file.

Parameters:filename – The full name of the file you want to write

(including file extension). :return: A string with the validation results, or empty string if validation is disabled.

read(self, filename)

Read an RDF/XML file and attach the SBOL objects to this Document.

Existing contents of the Document will be wiped. :param filename: The full name of the file you want to read (including file extension). :return: None

readString(self, sbol_str)

Convert text in SBOL into data objects.

Parameters:sbol_str – A string formatted in SBOL.
Returns:None
writeString(self)

Convert data objects in this Document into textual SBOL.

Returns:A string representation of the objects in this Document.
append(self, filename)

Read an RDF/XML file and attach the SBOL objects to this Document.

New objects will be added to the existing contents of the Document. :param filename: The full name of the file you want to read (including file extension). :return: None

parse_all(self)
parse_objects_inner(self, subject, obj)
parse_properties_inner(self, subject, predicate, obj)
find_reference(self, uri)

Find objects that reference the given URI. Returns a list of objects. The list will be empty if no references were found.

parse_annotation_objects(self)

Parse leftover objects from reading and link them up where they belong. These are usually extension-type objects.

infer_resource_namespaces(self)
dress_document(self)
convert_ntriples_encoding_to_ascii(self, s)
request_comparison(self, diff_file)

Perform comparison on Documents using the online validation tool.

This is for cross-validation of SBOL documents with libSBOLj. Document comparison can also be performed using the built-in compare method. :param diff_file: :return: The comparison results

clear(self, clear_graph=True)

Delete all properties and objects in the Document.

Returns:None
query_repository(self, command)
Parameters:command
Returns:str
search_metadata(self, role, type, name, collection)
Parameters:
  • role
  • type
  • name
  • collection
Returns:

str

doc_serialize_rdf2xml(self, outfile)

Serialize RDF XML. :param outfile: output file :return: None

update_graph(self)

Update the RDF triples representation of data. :return:

validate(self)

Run validation on this Document via the online validation tool.

Returns:A string containing a message with the validation results
Return type:str
size(self)

Get the total number of objects in the Document, including SBOL core object and custom annotation objects.

Returns:The total number of objects in the Document.
__len__(self)

Get the total number of objects in the Document, including SBOL core object and custom annotation objects.

(Returns the same thing as size())

Returns:The total number of objects in the Document.
__bool__(self)
__str__(self)

Produce a string representation of the Document.

Returns:A string representation of the Document.
__iter__(self)
__next__(self)
cacheObjectsDocument(self)
referenceNamespace(self, uri)

Replaces the namespace with a reference and removes the default namespace, shortening the URI. :param uri: :return: str

summary(self)

Produce a string representation of the Document.

Returns:A string representation of the Document.
find(self, uri)

Search recursively for an SBOLObject in this Document that matches the uri.

Parameters:uri – The identity of the object to search for.
Returns:A pointer to the SBOLObject,

or NULL if an object with this identity doesn’t exist.

getTypeURI(self)
Returns:The uniform resource identifier that describes

the RDF-type of this SBOL Object.

getTopLevel(self, uri)
copy(self, target_namespace=None, target_doc=None, version=None)
exportToFormat(self, language: str, output_path: str)
convert(self, language, output_path)
getExtensionObject(self, uri: str)

Deprecated. Use Document.get instead.

Parameters:uri (str) – URI of the extension object
Returns:The matching SBOLObject
Return type:SBOLObject
Raises:SBOLError if the given uri is not found
addExtensionObject(self, obj: SBOLObject)

Deprecated. Use Document.add instead.

Parameters:obj (SBOLObject) – An SBOLObject to add to this document
Returns:None
sbol2.IGEM_STANDARD_ASSEMBLY(parts_list)
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, VersionProperty]
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: sbol2.location.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: sbol2.location.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: sbol2.location.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)
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)

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
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
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

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)
Returns:The uniform resource identifier that describes

the RDF-type of this SBOL Object.

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.

logger
type
this
_serialize(self)
_nest(self)
_makeQName(self, uri)
__uri__(self)

Returns a URIRef representing this object.

Returns:The identity of this object as an rdflib.URIRef
Return type:rdflib.URIRef
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.

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)

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)

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

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

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

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.
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

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)
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)

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

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

Bases: sbol2.property.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: sbol2.property.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)
convert_from_user(self, value: Any)
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: sbol2.property.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: sbol2.property.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.

value
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: sbol2.property.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.

value
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)
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: sbol2.property.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.

value
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.

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

Bases: sbol2.property.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: sbol2.property.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.

value
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.
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)
precedes(self, comparand)

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

Parameters:comparand – Another SequenceAnnotation
Returns:true or false
follows(self, comparand)

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

Parameters:comparand – Another SequenceAnnotation
Returns:true or false
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
overlaps(self, comparand)

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

Parameters:comparand – Another SequenceAnnotation
Returns:true or false
extract(self, start_reference=1)

Convert a SequenceAnnotation to a subcomponent

Parameters:start_reference
Returns:A ComponentDefinition representing the subcomponent
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.

addToDocument(self, document)
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:
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(property_owner, type_uri, lower_bound, upper_bound, validation_rules=None, initial_value=None)

Bases: sbol2.property.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)
static _make_version(major: int, minor: int, micro: int)
static increment_major(version: str)