Skip to content

Commit

Permalink
add more TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis-Titov committed Feb 28, 2024
1 parent 21bebbf commit b2102fa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/tests_for_rate_eq_fitting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,22 @@ benchmark_result = @benchmark EnzymeFitting.loss_rate_equation($(kinetic_params)
#TODO: make fake data with noise and known params and ensure known params are recovered
fit_result = fit_rate_equation(rate_equation, data, metab_names, param_names; n_iter=20)
@test isapprox(fit_result.loss, 0.08946088323758938, rtol=1e-3)
@test fit_result.params isa NamedTuple{param_names}{NTuple{length(param_names), Float64}}
@test fit_result.params isa NamedTuple{param_names}{NTuple{length(param_names),Float64}}

##
#test the ability of `fit_rate_equation` to recover parameters used to generated data for an arbitrary enzyme
#TODO: use more complex test_rate_equation and add an option to fit real Vmax values instead of fixing Vmax=1.0
#=
TODO: delete PKM2 example above after making below to use more complex test_rate_equation with 1-3 S, P and R and
randomly generated parameters and data around K values.
Add an option to fit real Vmax values instead of fixing Vmax=1.0.
=#
test_rate_equation(metabs, params) = params.Vmax * (metabs.S / params.K_S) / (1 + metabs.S / params.K_S)
param_names = (:Vmax, :K_S)
metab_names = (:S,)
params = (Vmax = 10.0, K_S = 1.0)
data = DataFrame(S = [0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0])
params = (Vmax=10.0, K_S=1.0)
data = DataFrame(S=[0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0])
noise_sd = 0.2
data.Rate = [test_rate_equation(row, params) * (1 + noise_sd * randn()) for row in eachrow(data)]
data.source = ["Figure1" for i in 1:nrow(data)]
fit_result = fit_rate_equation(test_rate_equation, data, metab_names, param_names; n_iter=20)
@test isapprox(fit_result.params.K_S, params.K_S, rtol=3*noise_sd)
@test isapprox(fit_result.params.K_S, params.K_S, rtol=3 * noise_sd)

0 comments on commit b2102fa

Please sign in to comment.