From e39fdee714f078033ef1eaac554a715939d62e24 Mon Sep 17 00:00:00 2001 From: Taisiia Sherstiukova Date: Mon, 24 Feb 2025 15:08:00 -0700 Subject: [PATCH 1/4] temp commit --- .DS_Store | Bin 6148 -> 6148 bytes excelutils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/library2.py | 28 ++++++++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/.DS_Store b/.DS_Store index 766bc1d2aaaaa6b1375bb8761b89192ce46ec44b..d01d176599bac6ea69642262db42e1f5a2632121 100644 GIT binary patch delta 144 zcmZoMXffEJ#uU4qhk=2Cg+Y%YogtHvOFmUixDEFl;gh*^oU|S*x0D3eS2><{9 diff --git a/excelutils/excel_sbol_utils/.DS_Store b/excelutils/excel_sbol_utils/.DS_Store index 85e162cc974dabd67173081a1c5fd068a400e05a..5fed62877ab3436ed65d2f2b6e75fdefe9022500 100644 GIT binary patch delta 59 zcmZoMXffDe!pNj-J(-75YH|Q04;#;_l6fARCr@CMnOuj=)nW|Te2~$NZDIr4W_FIh F`~VRT5{&== delta 59 zcmZoMXffDe!pJ23VKNV+)Z_q09=5|@YMOmlPoBUiGr11PHCc7azkDf>tF`&72tV`Y O3ygNmo7p-3@&f>8N)+D! diff --git a/excelutils/excel_sbol_utils/library2.py b/excelutils/excel_sbol_utils/library2.py index 9ba1b5e..e9f78dd 100644 --- a/excelutils/excel_sbol_utils/library2.py +++ b/excelutils/excel_sbol_utils/library2.py @@ -14,7 +14,35 @@ # if in lib2 or lib_both for version 2 and lib3 or lib_both for version 3 # would reduce code duplication? +def module(rowobj): + module_name_pref = rowobj.obj_uri.split("/")[-1] + module_name_suf = None + for col in rowobj.col_cell_dict.keys(): + val = rowobj.col_cell_dict[col] + + module_name = f"{module_name_pref}_sample_design_module" + + module_def = sbol2.ModuleDefinition(module_name) + pass + +def funcComp(rowobj): + module_def_name = rowobj.obj_uri.split("/")[-1] + fc_name = None + for col in rowobj.col_cell_dict.keys(): + val = rowobj.col_cell_dict[col] + module_name = f"{module_def_name}_module_definition" + module_def = sbol2.ModuleDefinition(module_name) + fc_name = val + if fc_name not in [fc.displayId for fc in module_def.functionalComponents]: + fc = module_def.functionalComponents.create(fc_name) + fc.definition = val + else: + fc = module_def.functionalComponents.get(fc_name) + + rowobj.doc.addModuleDefinition(module_def) + + pass def objectType(rowobj): # used to decide the object type in the converter function From fe2d272fe2006151c26065b8cd4a650dcf68a87a Mon Sep 17 00:00:00 2001 From: Taisiia Sherstiukova Date: Wed, 26 Feb 2025 17:40:00 -0700 Subject: [PATCH 2/4] funcComp and module functions --- .DS_Store | Bin 6148 -> 6148 bytes excelutils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/library2.py | 63 ++++++++++++++++++------ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.DS_Store b/.DS_Store index d01d176599bac6ea69642262db42e1f5a2632121..3473e05ce020654c6c71b16f2b1656f052c6a436 100644 GIT binary patch delta 153 zcmZoMXffEJ#uWQDje&uIg+Y%YogtH Date: Wed, 19 Mar 2025 15:08:59 -0600 Subject: [PATCH 3/4] added biochemical reaction --- .DS_Store | Bin 6148 -> 6148 bytes .github/.DS_Store | Bin 6148 -> 6148 bytes excelutils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/.DS_Store | Bin 6148 -> 6148 bytes excelutils/excel_sbol_utils/library2.py | 99 ++++++++++++++++++++++++ 5 files changed, 99 insertions(+) diff --git a/.DS_Store b/.DS_Store index 3473e05ce020654c6c71b16f2b1656f052c6a436..f44001aebe3168b95c406d69715458c38c5d1a94 100644 GIT binary patch delta 154 zcmZoMXffEJ$`mIoBgeqNz`~%%kj{|FP?DSP;*yk;p9B=+$mcfu@OAq!M^yO~yz&JZ zhQZ1CxdlKy3=Ap)lbe|w*#vfJo(j4hM^ diff --git a/.github/.DS_Store b/.github/.DS_Store index 81cac08efa99e03ce47baa6ae5a2699023c26201..f9a6ad2ab5590ca95ea5829ca27ec5871e5fc89c 100644 GIT binary patch delta 34 lcmZoMXffCz!_0Oza_i~!+a~)kOH8(6=7DlI`!Mei0RZlG4gLTC delta 34 kcmZoMXffCz!_4+7)#!a<@?;-oiOE*XJW%dtALbn*0M;xFPyhe` diff --git a/excelutils/.DS_Store b/excelutils/.DS_Store index 4990b17fa08382f8879ce6dcd8cd6afe888bd7ef..23ddafc31379b030ea9b62af7816cb661003caac 100644 GIT binary patch delta 63 zcmZoMXffE3&B7F(I60SP5#xr*0<0%E#11dqwsG4r$H{`MW+J)yDK1Gl`AG~63@8$t J6WEpr0s!R~7Z?Bl delta 63 zcmZoMXffE3&BCNTZ*nfnBF2Wv0<0%E*7UsM-m&hO<77crGm+f<6qlr&{3Hej1{8_S I32aLQ0pa-;@c;k- diff --git a/excelutils/excel_sbol_utils/.DS_Store b/excelutils/excel_sbol_utils/.DS_Store index e788913dec0034c058e91afb936fb32c9d1b4d8c..0c1ddf2650ed3e2cf848f4a4217d11380326f19e 100644 GIT binary patch delta 59 zcmZoMXffDe!pP)&cQOy7)Z_q09=5GjE^gNjPM*LhGr10#tHoHb`5>bk+r$R8&Fmb1 F`2kwg6o~); delta 58 zcmZoMXffDe!pNvKc_O3q>Pjj0XH}l4gdfE diff --git a/excelutils/excel_sbol_utils/library2.py b/excelutils/excel_sbol_utils/library2.py index 4418d8d..8ed5eaf 100644 --- a/excelutils/excel_sbol_utils/library2.py +++ b/excelutils/excel_sbol_utils/library2.py @@ -14,6 +14,105 @@ # if in lib2 or lib_both for version 2 and lib3 or lib_both for version 3 # would reduce code duplication? +def biochemical_reaction(rowobj): + chemical_name = rowobj.obj_uri.split("/")[-1] + chemical_uri = rowobj.obj_uri + module_def_name = f"{chemical_name}_production" + + enzyme_name = None + substrate_name = None + + if module_def_name not in [m.displayId for m in rowobj.doc.moduleDefinitions]: + module_def = sbol2.ModuleDefinition(module_def_name) + else: + module_def = rowobj.doc.moduleDefinitions.get(module_def_name) + for col in rowobj.col_cell_dict.keys(): + val = rowobj.col_cell_dict[col] + if col == "Enzyme": + if isinstance(val, str): + enzyme_uri = val + enzyme_name = val.split("/")[-1] + + if col == "Substrate": + if isinstance(val, str): + substrate_uri = val + substrate_name = val.split("/")[-1] + + # enzyme not provided + if substrate_name is None: + print("Substrate not provided. Just FC for enzyme will be created.") + if enzyme_name not in [fc.displayId for fc in module_def.functionalComponents]: + enzyme_fc = module_def.functionalComponents.create(enzyme_name) + enzyme_fc.definition = enzyme_uri + else: + enzyme_fc = module_def.functionalComponents.get(enzyme_name) + rowobj.doc.addModuleDefinition(module_def) + return + + # substrate not provided + if enzyme_name is None: + print("Enzyme not provided. Just FC for substrate will be created.") + if substrate_name not in [fc.displayId for fc in module_def.functionalComponents]: + substrate_fc = module_def.functionalComponents.create(substrate_name) + substrate_fc.definition = substrate_uri + else: + substrate_fc = module_def.functionalComponents.get(substrate_name) + rowobj.doc.addModuleDefinition(module_def) + return + + + # substrate fc + if substrate_name not in [fc.displayId for fc in module_def.functionalComponents]: + substrate_fc = module_def.functionalComponents.create(substrate_name) + substrate_fc.definition = substrate_uri + else: + substrate_fc = module_def.functionalComponents.get(substrate_name) + + # enzyme fc + if enzyme_name not in [fc.displayId for fc in module_def.functionalComponents]: + enzyme_fc = module_def.functionalComponents.create(enzyme_name) + enzyme_fc.definition = enzyme_uri + else: + enzyme_fc = module_def.functionalComponents.get(enzyme_name) + + # chemical fc + if chemical_name not in [fc.displayId for fc in module_def.functionalComponents]: + chemical_fc = module_def.functionalComponents.create(chemical_name) + chemical_fc.definition = chemical_uri + else: + chemical_fc = module_def.functionalComponents.get(chemical_name) + + # participation for substrate + participation_substrate = sbol2.Participation(uri = f'{substrate_name}_reactant') + participation_substrate.participant = substrate_fc + participation_substrate.uri = f'{substrate_name}_reactant' + participation_substrate.roles = [sbol2.SBO_REACTANT] + + # participation for enzyme + participation_enzyme = sbol2.Participation(uri = f'{enzyme_name}_modifier') + participation_enzyme.participant = enzyme_fc + participation_enzyme.uri = f'{enzyme_name}_modifier' + participation_enzyme.roles = ["http://identifiers.org/biomodels.sbo/SBO:0000019"] #'SBO_MODIFIER' + + # participation for profuct + participation_product = sbol2.Participation(uri = f'{chemical_name}_product') + participation_product.participant = chemical_fc + participation_product.uri = f'{chemical_name}_product' + participation_product.roles = [sbol2.SBO_PRODUCT] + + # define the interaction + interaction_name = f'{chemical_name}_biochemical_reaction' + interaction_type = sbol2.SBO_BIOCHEMICAL_REACTION + interaction = sbol2.Interaction(interaction_name, interaction_type) + + interaction.participations.add(participation_substrate) + interaction.participations.add(participation_enzyme) + interaction.participations.add(participation_product) + + module_def.interactions.add(interaction) + rowobj.doc.addModuleDefinition(module_def) + + def module(rowobj): module_name_pref = rowobj.obj_uri.split("/")[-1] # print("Module Def Name: ", module_name_pref) From 4d143e1b007a32fb3a1eaaaa2b8b0f41316f60a2 Mon Sep 17 00:00:00 2001 From: Taisiia Sherstiukova Date: Wed, 19 Mar 2025 15:35:08 -0600 Subject: [PATCH 4/4] removed trailing whitespace from domain name --- excelutils/excel_sbol_utils/library2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/excelutils/excel_sbol_utils/library2.py b/excelutils/excel_sbol_utils/library2.py index 8ed5eaf..eb37ed2 100644 --- a/excelutils/excel_sbol_utils/library2.py +++ b/excelutils/excel_sbol_utils/library2.py @@ -193,7 +193,7 @@ def displayId(rowobj): dict = os.getenv("SBOL_DICTIONARY") data = json.loads(dict) - url = data["Domain"] + url = data["Domain"].strip() if url.endswith('/'): url = url[:-1] collection = data["Library Name"]