Latexify/Catalyst introduces extra exponent - issue with mm and hill?

‘‘‘ ppGppSys1 = @reaction_network begin

kin,    ∅ --> G6P           

hill(G6P,v01,k01,1), G6P → F6P

end

odesys = convert(ODESystem, ppGppSys1; combinatoric_ratelaws=false, remove_conserved = true)

latexify(odesys)‘‘‘

produces

\begin{align}
\frac{\mathrm{d} \mathtt{G6P}\left( t \right)}{\mathrm{d}t} &= \mathtt{kin} + \frac{ - \left( \mathtt{G6P}\left( t \right) \right)^{2} \mathtt{v01}}{\mathtt{k01} + \mathtt{G6P}\left( t \right)} \
\frac{\mathrm{d} \mathtt{F6P}\left( t \right)}{\mathrm{d}t} &= \frac{\left( \mathtt{G6P}\left( t \right) \right)^{2} \mathtt{v01}}{\mathtt{k01} + \mathtt{G6P}\left( t \right)}
\end{align}

I realise that the issue is not with “latexify” but rather the definition of Catalyst.mm and Catalyst.hill.

If I define a “model” with few reactions using these rates and then use the following code to check the ode rate laws:

rxs = reactions(lmodel)

ν = oderatelaw.(rxs)

I can see that the “mm” and ”hill” functions generate substrates to the square in the numerator.

Can you please provide a full MWE that is properly formatted as code in your post so it can be copied and pasted to run?

1 Like

See PSA: how to quote code with backticks for info on formatting Discourse posts.

Thanks - I figures another way, in which “mm” behaves as expected.

Here is the code to illustrate. The first reaction (M0 to M1) is written, as I understand the “mm” usage from example in the docs and gives be the squared dependency on M0 concentration:


mmModel = @reaction_network begin
    
    kin,    ∅ --> M0               
    mm(M0,v01,k01),            M0 --> M1        #usage implied by Julia example
    mm(v01,k01,M1),            M1 --> M2        #usgae that gives expected behavior
    kout, M2 --> ∅ 

end
odesys = convert(ODESystem, mmModel; combinatoric_ratelaws=false, remove_conserved = true)
rxs = reactions(mmModel)
ν = oderatelaw.(rxs)
display(ν)
display(latexify(odesys))

It seems like maybe there is a misunderstanding about how Catalyst arrows work. When you use --> Catalyst always generates a mass action term for the rate law defined by the substrate stoichiometry that multiplies whatever your “rate” term is. i.e. all the terms that multiply k here. In your case k would be replaced by kin, mm(...), or kout for each of your four reactions.

So the “rate”, which in your case is the Michaelis-Menten term, gets multiplied by M0 for the second reaction and M1 for the third. If you don’t want Catalyst to auto-generate mass action rate law terms you need to use a different arrow type, for example =>. See here.

So just to add a concrete example,

mm(M0,v01,k01),   M0 + 2A --> M1 

should give the rate law of

mm(M0,v01,k01) * M0 * (A^2/2)

per that page I linked. If you only want the mm term you can use

mm(M0,v01,k01),   M0 + 2A => M1 

which should just give a rate law of

mm(M0,v01,k01)