Skip to content

Commit cd1100b

Browse files
committed
work to get identities updating
1 parent 72d7f74 commit cd1100b

File tree

6 files changed

+1389
-6
lines changed

6 files changed

+1389
-6
lines changed

SBOL3_simple_library4.nt

Lines changed: 653 additions & 0 deletions
Large diffs are not rendered by default.

SBOL3_simple_library4.xlsx

187 KB
Binary file not shown.

excelutils/excel_sbol_utils/library3.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
import logging
44
import sbol3
5-
import sys
5+
import warnings
66
import excel_sbol_utils.helpers as helpers
77

88

@@ -80,7 +80,7 @@ def subcomponents(rowobj): #UPDATE TO WORK WITH CELL DICT, ALLOW CONSTRAINTS
8080
# if type is compdef do one thing, if combdev do another, else error
8181
if isinstance(rowobj.obj, sbol3.component.Component):
8282
for sub in subcomps:
83-
sub_part = sbol3.SubComponent(f'{sbol3.get_namespace()}{sub}')
83+
sub_part = sbol3.SubComponent(f'{sbol3.get_namespace()}/{sub}')
8484
rowobj.obj.features.append(sub_part)
8585
# self.obj.assemblePrimaryStructure(self.cell_val)
8686
# self.obj.compile(assembly_method=None)
@@ -116,7 +116,7 @@ def subcomponents(rowobj): #UPDATE TO WORK WITH CELL DICT, ALLOW CONSTRAINTS
116116
variant_comps.append(tempLocalSub)
117117
varFeature = sbol3.VariableFeature(cardinality=sbol3.SBOL_ONE, variable=f'{sbol3.get_namespace()}/{temp.display_id}/{tempLocalSub.display_id}')
118118
for part in comp.split(", "):
119-
varFeature.variants.append(f'{sbol3.get_namespace()}{helpers.check_name(part)}')
119+
varFeature.variants.append(f'{sbol3.get_namespace()}/{helpers.check_name(part)}')
120120
rowobj.obj.variable_features.append(varFeature)
121121
if comp_ind != 0:
122122
constr = sbol3.Constraint(restriction=sbol3.SBOL_MEETS, object=tempLocalSub, subject=variant_comps[comp_ind -1])
@@ -173,11 +173,24 @@ def dataSource(rowobj):
173173
else:
174174
ns = datasource_dict[pref]['Namespace']
175175
if len(ns) > 0:
176-
if datasource_dict[pref]['Prefix'] not in rowobj.doc.pref_terms:
176+
if datasource_dict[pref]['Prefix'] not in rowobj.doc_pref_terms:
177177
rowobj.doc.bind(datasource_dict[pref]['Prefix'], ns)
178-
rowobj.doc.pref_terms.append(datasource_dict[pref]['Prefix'])
179-
print(rowobj.obj.display_id, ns, rowobj.doc_pref_terms)
178+
rowobj.doc_pref_terms.append(datasource_dict[pref]['Prefix'])
179+
180+
old_id = rowobj.obj.identity
180181
rowobj.doc.change_object_namespace([rowobj.obj], ns)
182+
new_id = rowobj.obj.identity
183+
rowobj.data_source_id_to_update[old_id] = new_id
184+
if val != rowobj.obj.display_id:
185+
# rowobj.data_source_id_to_update[rowobj.obj.identity] = {'current_id': rowobj.obj.display_id,
186+
# 'update_id': val}
187+
new_identity = str(rowobj.obj.identity).replace(rowobj.obj.display_id, helpers.check_name(val))
188+
id_map = {rowobj.obj.identity:new_identity}
189+
# print(str(id_map))
190+
rowobj.obj.set_identity(new_identity)
191+
rowobj.obj.update_all_dependents(id_map) # this function doesn't yet do everything it should
192+
warnings.warn('not yet possible to have display id that is different from source value')
193+
rowobj.data_source_id_to_update[old_id] = new_identity
181194

182195
def sequence(rowobj):
183196
for col in rowobj.col_cell_dict.keys():

0 commit comments

Comments
 (0)