|
2 | 2 | import re
|
3 | 3 | import logging
|
4 | 4 | import sbol3
|
5 |
| -import sys |
| 5 | +import warnings |
6 | 6 | import excel_sbol_utils.helpers as helpers
|
7 | 7 |
|
8 | 8 |
|
@@ -80,7 +80,7 @@ def subcomponents(rowobj): #UPDATE TO WORK WITH CELL DICT, ALLOW CONSTRAINTS
|
80 | 80 | # if type is compdef do one thing, if combdev do another, else error
|
81 | 81 | if isinstance(rowobj.obj, sbol3.component.Component):
|
82 | 82 | for sub in subcomps:
|
83 |
| - sub_part = sbol3.SubComponent(f'{sbol3.get_namespace()}{sub}') |
| 83 | + sub_part = sbol3.SubComponent(f'{sbol3.get_namespace()}/{sub}') |
84 | 84 | rowobj.obj.features.append(sub_part)
|
85 | 85 | # self.obj.assemblePrimaryStructure(self.cell_val)
|
86 | 86 | # self.obj.compile(assembly_method=None)
|
@@ -116,7 +116,7 @@ def subcomponents(rowobj): #UPDATE TO WORK WITH CELL DICT, ALLOW CONSTRAINTS
|
116 | 116 | variant_comps.append(tempLocalSub)
|
117 | 117 | varFeature = sbol3.VariableFeature(cardinality=sbol3.SBOL_ONE, variable=f'{sbol3.get_namespace()}/{temp.display_id}/{tempLocalSub.display_id}')
|
118 | 118 | 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)}') |
120 | 120 | rowobj.obj.variable_features.append(varFeature)
|
121 | 121 | if comp_ind != 0:
|
122 | 122 | constr = sbol3.Constraint(restriction=sbol3.SBOL_MEETS, object=tempLocalSub, subject=variant_comps[comp_ind -1])
|
@@ -173,11 +173,24 @@ def dataSource(rowobj):
|
173 | 173 | else:
|
174 | 174 | ns = datasource_dict[pref]['Namespace']
|
175 | 175 | 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: |
177 | 177 | 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 |
180 | 181 | 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 |
181 | 194 |
|
182 | 195 | def sequence(rowobj):
|
183 | 196 | for col in rowobj.col_cell_dict.keys():
|
|
0 commit comments