-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identifiability of ModelingToolkit models #128
Comments
Hi @MaAl13 , thank you for the question! Can you share an example of the model you're working with? The code should support the ODE problems defined by ModelingToolkit generally. |
Hello Ilia, thank you so much for your response!!
|
Thank you! One that is expected by I could not run the code without the XML file, but try something like this: using ModelingToolkit
y_functions = @variables t y1(t) y2(t)
y_functions = y_functions[2:end]
measured_quantities = collect(ModelingToolkit.get_states(odesys_SBML))[1:2]
measured_quantities = [y_functions[i] ~ measured_quantities[i] for i in 1:2]
assess_identifiability(odesys_SBML, measured_quantities=measured_quantities)
|
Thank you very much for your input! It definietly makes sene to add the Array of Equations, I modified the code with your suggestions, however there still occurs an error.
This leads to the error By the way, the xml file is downloaded from SBML repository found under the following link, if you want to execute the code :) |
Thanks for linking to the model. I checked the equations: ModelingToolkit.equations(odesys_SBML) returns
The last three are causing the errors issues, since these are not ODEs and I think plugging the last three equations into the first two would work, but this might need to be done manually. |
Do |
@ChrisRackauckas thank you! This works, however, it appears the |
Thank you both! Indeed i also get an error if i use the structural_simplify beforehand. Right now i am checking if the system contains no algebraic equations with the condition that the right hand side of each equation has a differential at the beginning. I use now a pure ODE system but i am still running in an error
[ Info: Preproccessing The file can be downloaded at https://www.ebi.ac.uk/biomodels/BIOMD0000000823#Files |
@MaAl13 for the code you attached the issue was this line: measured_quantities = string.(collect(ModelingToolkit.get_states(odesys_SBML)))[1:num_real_diff_eqs] The string conversion prevented the StructuralIdentifiability code from properly parsing the right-hand side of output equation. removing the string conversion works: using SBMLToolkit
using StructuralIdentifiability
using ModelingToolkit
mdl = readSBML("./Varusai2018.xml", doc -> begin
set_level_and_version(2, 4)(doc) # c.f. Format on BioModels homepage, i.e. SBML (L2V1)
convert_simplify_math(doc)
end)
rs = ReactionSystem(mdl)
odesys_SBML = convert(ODESystem, rs)
#odesys_SBML_new = structural_simplify(odesys_SBML)
eqs = ModelingToolkit.equations(odesys_SBML)
num_real_diff_eqs = 0
for i in 1:length(eqs)
global num_real_diff_eqs
if length(split(string(eqs[i]), "~")[1]) > 12
if "Differential" == split(string(eqs[i]), "~")[1][1:12]
num_real_diff_eqs += 1
end
end
end
if num_real_diff_eqs == length(eqs)
string_y_func = "y_functions = @variables t"
for i in 1:num_real_diff_eqs
global string_y_func
string_y_func = string_y_func * " y$i(t)"
end
eval(Meta.parse(string_y_func))
#y_functions = @variables t y1(t) y2(t)
#y_functions = y_functions[2:end]
measured_quantities = collect(ModelingToolkit.get_states(odesys_SBML))
measured_quantities = [y_functions[i+1] ~ measured_quantities[i] for i in 1:num_real_diff_eqs]
assess_identifiability(odesys_SBML; measured_quantities=measured_quantities)
else
println("System is not a pure ODE and contains algebraic equations!")
end |
In this model, after structural_simplify there are functions in the right-hand side that cause issues: p(t), r(t), g(t): Differential(t)(S(t)) ~ D(t)*g(t) + (2.0p(t) - 1.0)*S(t)*r(t)
Differential(t)(D(t)) ~ (2.0 - 2.0p(t))*S(t)*r(t) - a*D(t) - D(t)*g(t) StructuralIdentifiability does not support variable coefficients in ODE so they would be treated as input variables. Are these the time-varying parameters in the model? |
Ah, thank you for pointing out my error! |
@MaAl13 @iliailmer |
So i have again a problem when trying to run an SBML model. This time the whole program is killed, can you tell me what is causing this error and how i can catch it? I am going through the SBML databse and search for appropriate models for Structural identifiability. Also the warning/errors for float seems to come up, is there a way to make them work aswell?
[ Info: Preproccessing The model causing this error can be found here |
Some preliminary results: it runs out of memory during converting a model from MTK to the internal format. The expressions do not look scary at all, I am looking into it. |
@MaAl13 |
Hello Gleb, thanks for trying to target my problem. Indeed it seems like a complicated problem, would be nice if it would work some day :) |
Hello,
i have the following problem. My goal is to get the identifiability of parameters in SBML models. These are imported via SBMLToolkit into ModelingToolkit format. Is there an easy way to run your package on this ModelingToolkit ODE problem? The observables that i have are currently in a Vector of Strings. Currently i am building your ODESystem macro the hard way with the eval() function, based upon a string. But this is quite nasty....
The text was updated successfully, but these errors were encountered: