Can't remove a custom-made kinetic law using sbioremovefromlibrary

1 次查看(过去 30 天)
I am using MATLAB R2022b in case it is relevant.
I am trying to remove a kinetic law that I have added in my user-defined library. I have called it "Uni-Uni MM reversible with e0". I use sbioremovefromlibrary function for such a purpose. However, I only get the following as output:
Warning: Kinetic law named 'Uni-Uni MM reversible with e0' is being used by reaction kinetic
law(s), and cannot be deleted. Type the following command to find kinetic laws using it.
klusedby = sbioselect('Type','kineticlaw','KineticLawName','Uni-Uni MM reversible with e0')
How do I proceed from here? I would also want to change the rate expression instead of removing it from the library. However, I don't know if that is possible

采纳的回答

Jeremy Huard
Jeremy Huard 2023-4-24
Hi,
the easiest way to manage the user-defined library might be from within the Model Builder app:
That said, you can still modify a user-defined kinetic law programmatically with:
kl = sbioselect(sbioroot, Name='Uni-Uni MM reversible with e0',Type='abstract_kinetic_law');
kl.Expression = '<edit the expression here>'
If you want to remove an existing user-defined kinetic law programmatically that is already used in a model, you can do the following:
kl = sbioselect(sbioroot, Name='mylaw1',Type='abstract_kinetic_law');
% find reactions in model that use this kinetic law
reacObj = findUsages(kl, modelObj);
% set the kinetic law of these reaction to 'Unknown' but keeping the same reaction rates
% by reassigning the Reaction Rate to itself
arrayfun(@(x) set(x,'ReactionRate',x.Reaction.Rate), reacObj);
% remove kinetic law from library
sbioremovefromlibrary(kl)
Best regards,
Jérémy

更多回答(0 个)

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Extend Modeling Environment 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by