-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Update Reaction
constructor
#856
Conversation
src/reaction.jl
Outdated
"""The rate function (excluding mass action terms).""" | ||
rate::Any | ||
"""Reaction substrates.""" | ||
substrates::Vector | ||
substrates::Vector{BasicSymbolic{Real}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should know that species are BasicSymbolic{Real}
.
Technically, someone could declare a constantspecies parameter, and set it to a non-default type (i.e. BasicSymbolic{Int64}
). However, we probably should not permit this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a reason this was left untyped I believe but I'm not remembering it. The case you mention is one possibility for someone making a jump model though. If we want to type these maybe they should be Any
. Let me think about it a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know when you've reverted this and updated the PR as we discussed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The decision is to change to
substrates::Vector{S}
products::Vector{R}
for now
(sorry, was a bit unsure what the final conclusion was if there was one, more than happy to make this switch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was to just leave them untyped as they currently are.
@@ -85,9 +92,6 @@ function get_netstoich(subs, prods, sstoich, pstoich) | |||
[el for el in nsdict if !_iszero(el[2])] | |||
end | |||
|
|||
# Get the net stoichiometries' type. | |||
netstoich_stoichtype(::Vector{Pair{S, T}}) where {S, T} = T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed as we need to check both S
and T
(as S
might now need to be converted from Num
to BasicSymbolic{Real}
.
Actually, now I think this is a bad idea. Someone has made the confusing choice to define I think if we want such a function for |
Do you mean this definition: # determine which unknowns a reaction depends on
function MT.get_variables!(deps::Set, rx::Reaction, variables)
(rx.rate isa Symbolic) && get_variables!(deps, rx.rate, variables)
for s in rx.substrates
# parametric stoichiometry means may have a parameter as a substrate
any(isequal(s), variables) && push!(deps, s)
end
deps
end and this PR #855? To do |
9d960ca
to
9844a99
Compare
isempty(vec) && (return type[]) | ||
type[value(v) for v in vec] | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper function to ensure something have the best type
97b6842
to
82c7730
Compare
[]
andnothing
to be used interchangeably (previously there were some cases which unintentionally would not work).Reaction
structure is concretely typed.