Skip to content

Commit

Permalink
Merge branch 'master' into network-analysis-touchup
Browse files Browse the repository at this point in the history
  • Loading branch information
vyudu authored Jan 10, 2025
2 parents 30cf870 + a309a9e commit 288041e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pages = Any[
"Steady state analysis" => Any[
"steady_state_functionality/homotopy_continuation.md",
"steady_state_functionality/nonlinear_solve.md",
#"steady_state_functionality/steady_state_stability_computation.md",
# "steady_state_functionality/steady_state_stability_computation.md",
"steady_state_functionality/bifurcation_diagrams.md",
"steady_state_functionality/dynamical_systems.md"
],
Expand Down
27 changes: 27 additions & 0 deletions test/network_analysis/crn_theory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ let
@test_throws Exception Catalyst.iscomplexbalanced(rn, k)
end

# Test that incomplete rate maps error.
let
rn = @reaction_network begin
(k1, k2), C1 <--> C2
(k3, k4), C2 <--> C3
(k5, k6), C3 <--> C1
end

incorrect_params = Dict(:k1 => 0.5)
@test_throws ErrorException Catalyst.iscomplexbalanced(rn, incorrect_params)
end

# Tests rate matrix computation for various input types.
let
# Declares network and its known rate matrix.
Expand Down Expand Up @@ -60,6 +72,11 @@ let
@test Catalyst.adjacencymat(rn, rates_tup) == rate_mat
@test Catalyst.adjacencymat(rn, rates_dict) == rate_mat
@test_throws Exception Catalyst.adjacencymat(rn, rate_vals)

incorrect_param_dict = Dict(:k1 => 1.0)
@test_throws ErrorException Catalyst.ratematrix(rn, 123)
@test_throws ErrorException Catalyst.ratematrix(rn, incorrect_param_dict)

@test_throws Exception Catalyst.iscomplexbalanced(rn, rates_invalid)

# Test sparse matrix
Expand Down Expand Up @@ -94,6 +111,16 @@ let
@test Catalyst.robustspecies(EnvZ_OmpR) == [6]
end

let
# Define a reaction network with bi-directional reactions
non_deficient_network = @reaction_network begin
(k1, k2), A <--> B
(k3, k4), B <--> C
end

# Test: Check that the error is raised for networks with deficiency != 1
@test_throws ErrorException Catalyst.robustspecies(non_deficient_network)
end

### Complex balance and reversibility tests ###

Expand Down
3 changes: 3 additions & 0 deletions test/reactionsystem_core/reactionsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ end
let
@named rs2 = ReactionSystem(rxs, t)
@test Catalyst.isequivalent(rs, rs2)

# Test with a type mismatch
@test Catalyst.isequivalent(rs, "Not a ReactionSystem") == false
end

# Defaults test.
Expand Down

0 comments on commit 288041e

Please sign in to comment.