Skip to content
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

Fixes for qssa search parameter snooping #36

Merged
merged 3 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/data_driven_rate_equation_selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ function calculate_all_parameter_removal_codes_w_num_params(
else
filtered_nt_param_removal_codes_max_alpha =
filter_param_removal_codes_for_max_zero_alpha(
nt_param_removal_codes,
filtered_nt_param_removal_codes,
practically_unidentifiable_params,
max_zero_alpha,
)
Expand Down Expand Up @@ -533,7 +533,7 @@ function forward_selection_next_param_removal_codes(
else
filtered_nt_param_removal_codes_max_alpha =
filter_param_removal_codes_for_max_zero_alpha(
nt_param_removal_codes,
filtered_nt_param_removal_codes,
practically_unidentifiable_params,
max_zero_alpha,
)
Expand Down Expand Up @@ -581,7 +581,7 @@ function reverse_selection_next_param_removal_codes(
else
filtered_nt_param_removal_codes_max_alpha =
filter_param_removal_codes_for_max_zero_alpha(
nt_param_removal_codes,
filtered_nt_param_removal_codes,
practically_unidentifiable_params,
max_zero_alpha,
)
Expand Down
53 changes: 25 additions & 28 deletions test/tests_for_optimal_rate_eq_selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,36 +242,29 @@ unidentifiable_params =

#test filter_param_removal_codes_to_prevent_wrong_param_combos
nt_param_removal_codes = [
NamedTuple{(:Vmax, :K_S1, :K_S2, :K_S1_S2)}(combo) for
combo in Iterators.product([[0, 1], [0, 1], [0, 1], [0, 1, 2]]...)
NamedTuple{(:Vmax, :K_S1, :K_S2, :K_S3, :K_S1_S2, :K_S1_S3, :K_S2_S3, :K_S1_S2_S3)}(
combo,
) for combo in Iterators.product(
[[0, 1], [0, 1], [0, 1], [0, 1], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]...,
)
]
metab_names = (:S1, :S2)
metab_names = (:S1, :S2, :S3)
filtered_nt =
DataDrivenEnzymeRateEqs.filter_param_removal_codes_to_prevent_wrong_param_combos(
nt_param_removal_codes,
metab_names,
)
correct_answer = [
(Vmax = 0, K_S1 = 0, K_S2 = 0, K_S1_S2 = 0)
(Vmax = 1, K_S1 = 0, K_S2 = 0, K_S1_S2 = 0)
(Vmax = 0, K_S1 = 1, K_S2 = 0, K_S1_S2 = 0)
(Vmax = 1, K_S1 = 1, K_S2 = 0, K_S1_S2 = 0)
(Vmax = 0, K_S1 = 0, K_S2 = 1, K_S1_S2 = 0)
(Vmax = 1, K_S1 = 0, K_S2 = 1, K_S1_S2 = 0)
(Vmax = 0, K_S1 = 1, K_S2 = 1, K_S1_S2 = 0)
(Vmax = 1, K_S1 = 1, K_S2 = 1, K_S1_S2 = 0)
(Vmax = 0, K_S1 = 0, K_S2 = 0, K_S1_S2 = 1)
(Vmax = 1, K_S1 = 0, K_S2 = 0, K_S1_S2 = 1)
(Vmax = 0, K_S1 = 1, K_S2 = 0, K_S1_S2 = 1)
(Vmax = 1, K_S1 = 1, K_S2 = 0, K_S1_S2 = 1)
(Vmax = 0, K_S1 = 0, K_S2 = 1, K_S1_S2 = 1)
(Vmax = 1, K_S1 = 0, K_S2 = 1, K_S1_S2 = 1)
(Vmax = 0, K_S1 = 1, K_S2 = 1, K_S1_S2 = 1)
(Vmax = 1, K_S1 = 1, K_S2 = 1, K_S1_S2 = 1)
(Vmax = 0, K_S1 = 0, K_S2 = 0, K_S1_S2 = 2)
(Vmax = 1, K_S1 = 0, K_S2 = 0, K_S1_S2 = 2)
]
@test filtered_nt == correct_answer
for filtered_code in filtered_nt
for param in [:K_S1, :K_S2, :K_S3]
if filtered_code[param] == 1
for param_combo in [:K_S1_S2, :K_S1_S3, :K_S2_S3, :K_S1_S2_S3]
if occursin(string(param), string(param_combo))
@test filtered_code[param_combo] != 2
end
end
end
end
end

#test filter_param_removal_codes_for_max_zero_alpha
#TODO: add a test with practically_unidentifiable_alphas
Expand Down Expand Up @@ -405,8 +398,10 @@ reverse_selection_result = @time data_driven_rate_equation_selection(
#TODO: remove the filtering for 4 parameters after we add the automatic determination of the best number of parameters
nt_param_removal_code =
filter(x -> x.num_params .== 4, selection_result.test_results).nt_param_removal_codes[1]
nt_reverse_param_removal_code =
filter(x -> x.num_params .== 4, reverse_selection_result.test_results).nt_param_removal_codes[1]
nt_reverse_param_removal_code = filter(
x -> x.num_params .== 4,
reverse_selection_result.test_results,
).nt_param_removal_codes[1]

using Symbolics
selected_sym_rate_equation = display_rate_equation(
Expand Down Expand Up @@ -524,8 +519,10 @@ reverse_selection_result = @time data_driven_rate_equation_selection(
#TODO: remove the filtering for 3 parameters after we add the automatic determination of the best number of parameters
nt_param_removal_code =
filter(x -> x.num_params .== 3, selection_result.test_results).nt_param_removal_codes[1]
nt_reverse_param_removal_code =
filter(x -> x.num_params .== 3, reverse_selection_result.test_results).nt_param_removal_codes[1]
nt_reverse_param_removal_code = filter(
x -> x.num_params .== 3,
reverse_selection_result.test_results,
).nt_param_removal_codes[1]

using Symbolics
selected_sym_rate_equation = display_rate_equation(
Expand Down