Browse Source

Update Catalyst usage

pull/63/head
bosonbaas 4 months ago
parent
commit
c3cbdc855c
  1. 5
      docs/Project.toml
  2. 7
      src/CatalystInterop.jl

5
docs/Project.toml

@ -10,8 +10,3 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
[compat]
Symbolics = "~0.1.32"

7
src/CatalystInterop.jl

@ -8,6 +8,7 @@ module CatalystInterop
using AlgebraicPetri
using Catlab.CategoricalAlgebra
using ...Catalyst
using ...Catalyst.Symbolics: scalarize
import ...Catalyst: ReactionSystem
counter(a) = [count(==(i),a) for i in unique(a)]
@ -28,9 +29,11 @@ module CatalystInterop
otpts = pn[incident(pn, t, :ot),:os]
in_count = collect(counter(inpts))
ot_count = collect(counter(otpts))
Reaction(k[t], S[unique(inpts)], S[unique(otpts)], in_count, ot_count)
Reaction(k[t], [S[i] for i in unique(inpts)],
[S[o] for o in unique(otpts)],
in_count, ot_count)
end
ReactionSystem(rxs, t, S, k)
ReactionSystem(rxs, t, scalarize(S), scalarize(k))
end
end

Loading…
Cancel
Save