sbol2.document
¶
Module Contents¶
Classes¶
The Document is a container for all SBOL data objects. |
Functions¶
|
|
|
|
|
Attributes¶
- sbol2.document.SBOL_DATA_MODEL_REGISTER¶
- class sbol2.document.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)¶
- 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.
- abstract 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
- Raises
SBOLError if the given uri is not found
- abstract 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) sbol2.collection.Collection ¶
- 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)¶
Read an RDF/XML string and attach the SBOL objects to this Document.
Existing contents of the Document will be wiped.
- 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, overwrite: bool = False)¶
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). :param overwrite: Boolean indicating whether to overwrite existing objects :return: None
- appendString(self, sbol_str: str, overwrite: bool = False)¶
Read an RDF/XML document from a string and attach the SBOL objects to this Document.
New objects will be added to the existing contents of the Document. :param sbol_str: A string of RDF/XML :param overwrite: Boolean indicating whether to overwrite existing objects :return: None
- _append_graph(self, new_graph: rdflib.Graph, overwrite: bool)¶
- 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)¶
- abstract 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
- abstract query_repository(self, command)¶
- Parameters
command –
- Returns
str
- abstract 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 validation tool (locally or online, depending on configuration)
- 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)¶
- abstract 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)¶
- 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)¶
- importFromFormat(self, input_path: str, overwrite=False)¶
Import the specified file into this document.
- getExtensionObject(self, uri: str) sbol2.object.SBOLObject ¶
Deprecated. Use Document.get instead.
- Parameters
uri (str) – URI of the extension object
- Returns
The matching SBOLObject
- Return type
- Raises
SBOLError if the given uri is not found
- addExtensionObject(self, obj: sbol2.object.SBOLObject) None ¶
Deprecated. Use Document.add instead.
- Parameters
obj (SBOLObject) – An SBOLObject to add to this document
- Returns
None
- sbol2.document._make_validation_request(options: Mapping[str, Union[bool, str]])¶
- sbol2.document.igem_assembly_scars = Multiline-String¶
Show Value
1<?xml version="1.0" encoding="utf-8"?> 2<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" 3xmlns:dcterms="http://purl.org/dc/terms/" 4xmlns:gbconv="http://sbols.org/genBankConversion#" 5xmlns:genbank="http://www.ncbi.nlm.nih.gov/genbank#" 6xmlns:igem="http://wiki.synbiohub.org/wiki/Terms/igem#" 7xmlns:ncbi="http://www.ncbi.nlm.nih.gov#" 8xmlns:obo="http://purl.obolibrary.org/obo/" 9xmlns:om="http://www.ontology-of-units-of-measure.org/resource/om-2/" 10xmlns:prov="http://www.w3.org/ns/prov#" 11xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 12xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 13xmlns:sbh="http://wiki.synbiohub.org/wiki/Terms/synbiohub#" 14xmlns:sbol="http://sbols.org/v2#" 15xmlns:sybio="http://www.sybio.ncl.ac.uk#" 16xmlns:synbiohub="http://synbiohub.org#" 17xmlns:xsd="http://www.w3.org/2001/XMLSchema#dateTime/"> 18<sbol:ComponentDefinition rdf:about="https://synbiohub.org/public/igem/BBa_G0000/1"> 19<dc:creator>Reshma Shetty</dc:creator> 20<dcterms:created>2007-07-22T11:00:00Z</dcterms:created> 21<dcterms:description>SpeI/XbaI scar for RBS-CDS junctions</dcterms:description> 22<dcterms:modified>2015-08-31T04:07:27Z</dcterms:modified> 23<dcterms:title>scar</dcterms:title> 24<sbol:displayId>BBa_G0000</sbol:displayId> 25<sbol:persistentIdentity rdf:resource="https://synbiohub.org/public/igem/BBa_G0000"/> 26<sbol:role rdf:resource="http://identifiers.org/so/SO:0000110"/> 27<sbol:role rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#partType/DNA"/> 28<sbol:sequence 29 rdf:resource="https://synbiohub.org/public/igem/BBa_G0000_sequence/1"/> 30<sbol:type rdf:resource="http://www.biopax.org/release/biopax-level3.owl#DnaRegion"/> 31<sbol:version>1</sbol:version> 32<igem:discontinued>false</igem:discontinued> 33<igem:dominant>true</igem:dominant> 34<igem:experience 35 rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#experience/None"/> 36<igem:group_u_list>_41_</igem:group_u_list> 37<igem:m_user_id>0</igem:m_user_id> 38<igem:owner_id>126</igem:owner_id> 39<igem:owning_group_id>162</igem:owning_group_id> 40<igem:sampleStatus>Not in stock</igem:sampleStatus> 41<igem:status 42 rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#status/Unavailable"/> 43<sbh:bookmark>false</sbh:bookmark> 44<sbh:mutableDescription> 45 This is the sequence of the SpeI/XbaI scar for RBS-CDS junctions in 46 BioBricks standard assembly. 47</sbh:mutableDescription> 48<sbh:mutableNotes> 49 This is a shorter scar to ensure proper spacing between the RBS and CDS. 50</sbh:mutableNotes> 51<sbh:mutableProvenance>SpeI/XbaI scar</sbh:mutableProvenance> 52<sbh:ownedBy rdf:resource="https://synbiohub.org/user/james"/> 53<sbh:ownedBy rdf:resource="https://synbiohub.org/user/myers"/> 54<sbh:star>false</sbh:star> 55<sbh:topLevel rdf:resource="https://synbiohub.org/public/igem/BBa_G0000/1"/> 56<prov:wasDerivedFrom rdf:resource="http://parts.igem.org/Part:BBa_G0000"/> 57<prov:wasGeneratedBy rdf:resource="https://synbiohub.org/public/igem/igem2sbol/1"/> 58</sbol:ComponentDefinition> 59<sbol:Sequence rdf:about="https://synbiohub.org/public/igem/BBa_G0000_sequence/1"> 60<sbol:displayId>BBa_G0000_sequence</sbol:displayId> 61<sbol:elements>tactag</sbol:elements> 62<sbol:encoding rdf:resource="http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"/> 63<sbol:persistentIdentity 64 rdf:resource="https://synbiohub.org/public/igem/BBa_G0000_sequence"/> 65<sbol:version>1</sbol:version> 66<sbh:ownedBy rdf:resource="https://synbiohub.org/user/james"/> 67<sbh:ownedBy rdf:resource="https://synbiohub.org/user/myers"/> 68<sbh:topLevel rdf:resource="https://synbiohub.org/public/igem/BBa_G0000_sequence/1"/> 69<prov:wasDerivedFrom rdf:resource="http://parts.igem.org/Part:BBa_G0000"/> 70<prov:wasGeneratedBy rdf:resource="https://synbiohub.org/public/igem/igem2sbol/1"/> 71</sbol:Sequence> 72<sbol:ComponentDefinition rdf:about="https://synbiohub.org/public/igem/BBa_G0002/1"> 73<dc:creator>Reshma Shetty</dc:creator> 74<dcterms:created>2007-02-26T12:00:00Z</dcterms:created> 75<dcterms:description>SpeI/XbaI mixed site</dcterms:description> 76<dcterms:modified>2015-08-31T04:07:27Z</dcterms:modified> 77<dcterms:title>SX scar</dcterms:title> 78<sbol:displayId>BBa_G0002</sbol:displayId> 79<sbol:persistentIdentity rdf:resource="https://synbiohub.org/public/igem/BBa_G0002"/> 80<sbol:role rdf:resource="http://identifiers.org/so/SO:0000110"/> 81<sbol:role rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#partType/DNA"/> 82<sbol:sequence rdf:resource="https://synbiohub.org/public/igem/BBa_G0002_sequence/1"/> 83<sbol:type rdf:resource="http://www.biopax.org/release/biopax-level3.owl#DnaRegion"/> 84<sbol:version>1</sbol:version> 85<igem:discontinued>false</igem:discontinued> 86<igem:dominant>true</igem:dominant> 87<igem:experience 88 rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#experience/None"/> 89<igem:group_u_list>_41_</igem:group_u_list> 90<igem:m_user_id>0</igem:m_user_id> 91<igem:owner_id>126</igem:owner_id> 92<igem:owning_group_id>70</igem:owning_group_id> 93<igem:sampleStatus>Not in stock</igem:sampleStatus> 94<igem:status 95 rdf:resource="http://wiki.synbiohub.org/wiki/Terms/igem#status/Unavailable"/> 96<sbh:bookmark>false</sbh:bookmark> 97<sbh:mutableDescription> 98 XbaI/SpeI mixed site. Simply used to aid in entry of parts into the registry. 99</sbh:mutableDescription> 100<sbh:mutableNotes>None.</sbh:mutableNotes> 101<sbh:mutableProvenance>XbaI and SpeI sites</sbh:mutableProvenance> 102<sbh:ownedBy rdf:resource="https://synbiohub.org/user/james"/> 103<sbh:ownedBy rdf:resource="https://synbiohub.org/user/myers"/> 104<sbh:star>false</sbh:star> 105<sbh:topLevel rdf:resource="https://synbiohub.org/public/igem/BBa_G0002/1"/> 106<prov:wasDerivedFrom rdf:resource="http://parts.igem.org/Part:BBa_G0002"/> 107<prov:wasGeneratedBy rdf:resource="https://synbiohub.org/public/igem/igem2sbol/1"/> 108</sbol:ComponentDefinition> 109<sbol:Sequence rdf:about="https://synbiohub.org/public/igem/BBa_G0002_sequence/1"> 110<sbol:displayId>BBa_G0002_sequence</sbol:displayId> 111<sbol:elements>tactagag</sbol:elements> 112<sbol:encoding rdf:resource="http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"/> 113<sbol:persistentIdentity 114 rdf:resource="https://synbiohub.org/public/igem/BBa_G0002_sequence"/> 115<sbol:version>1</sbol:version> 116<sbh:ownedBy rdf:resource="https://synbiohub.org/user/james"/> 117<sbh:ownedBy rdf:resource="https://synbiohub.org/user/myers"/> 118<sbh:topLevel rdf:resource="https://synbiohub.org/public/igem/BBa_G0002_sequence/1"/> 119<prov:wasDerivedFrom rdf:resource="http://parts.igem.org/Part:BBa_G0002"/> 120<prov:wasGeneratedBy rdf:resource="https://synbiohub.org/public/igem/igem2sbol/1"/> 121</sbol:Sequence> 122<prov:Activity rdf:about="https://synbiohub.org/public/igem/igem2sbol/1"> 123<dc:creator>Chris J. Myers</dc:creator> 124<dc:creator>James Alastair McLaughlin</dc:creator> 125<dcterms:description>Conversion of the iGEM parts registry to SBOL2.1 126</dcterms:description> 127<dcterms:title>iGEM to SBOL conversion</dcterms:title> 128<sbol:displayId>igem2sbol</sbol:displayId> 129<sbol:persistentIdentity rdf:resource="https://synbiohub.org/public/igem/igem2sbol"/> 130<sbol:version>1</sbol:version> 131<sbh:ownedBy rdf:resource="https://synbiohub.org/user/james"/> 132<sbh:ownedBy rdf:resource="https://synbiohub.org/user/myers"/> 133<sbh:topLevel rdf:resource="https://synbiohub.org/public/igem/igem2sbol/1"/> 134<prov:endedAtTime>2017-03-06T15:00:00.000Z</prov:endedAtTime> 135</prov:Activity> 136</rdf:RDF>
- sbol2.document.IGEM_STANDARD_ASSEMBLY(parts_list)¶