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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Jeremy Huard
Jeremy Huard il 24 Apr 2023
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

Più risposte (0)

Community

Più risposte nel  SimBiology Community

Categorie

Scopri di più su Extend Modeling Environment in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by