Skip to content

Commit

Permalink
Converter between SBOL 2 and 3 for Collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
PrashantVaidyanathan committed Oct 7, 2023
1 parent ea56a5a commit b5a4f7a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions sbol_utilities/sbol3_sbol2_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,14 @@ def visit_binary_prefix(self, a: sbol3.BinaryPrefix):
# Priority: 4
raise NotImplementedError('Conversion of BinaryPrefix from SBOL3 to SBOL2 not yet implemented')

def visit_collection(self, a: sbol3.Collection):
# Priority: 1
raise NotImplementedError('Conversion of Collection from SBOL3 to SBOL2 not yet implemented')
def visit_collection(self, coll3: sbol3.Collection):
# Make a Collection object and add it to the document
coll2 = sbol2.Collection(coll3.identity, version=self._sbol2_version(coll3))
coll2.members = coll3.members
self.doc2.addCollection(coll2)

# Map over all other TopLevel properties and extensions not covered by the constructor
self._convert_toplevel(coll3, coll2)

def visit_combinatorial_derivation(self, a: sbol3.CombinatorialDerivation):
# Priority: 2
Expand Down Expand Up @@ -371,9 +376,12 @@ def visit_attachment(self, a: sbol2.Attachment):
# Priority: 2
raise NotImplementedError('Conversion of Attachment from SBOL2 to SBOL3 not yet implemented')

def visit_collection(self, a: sbol2.Collection):
# Priority: 1
raise NotImplementedError('Conversion of Collection from SBOL2 to SBOL3 not yet implemented')
def visit_collection(self, coll2: sbol2.Collection):
# Make the Sequence object and add it to the document
coll3 = sbol3.Collection(coll2.identity, namespace=self._sbol3_namespace(coll2), members = coll2.members)
self.doc3.add(coll3)
# Map over all other TopLevel properties and extensions not covered by the constructor
self._convert_toplevel(coll2, coll3)

def visit_combinatorial_derivation(self, a: sbol2.CombinatorialDerivation):
# Priority: 2
Expand Down

0 comments on commit b5a4f7a

Please sign in to comment.