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

Functionality for converting non-MA jumps to MA jumps #747

Closed
TorkelE opened this issue Dec 12, 2023 · 3 comments
Closed

Functionality for converting non-MA jumps to MA jumps #747

TorkelE opened this issue Dec 12, 2023 · 3 comments

Comments

@TorkelE
Copy link
Member

TorkelE commented Dec 12, 2023

SBMLToolkit and SBMLImporter have a problem in that sbml provides a propensity and then which reactants get updated. Hence, the following reaction

k, X --> Y

in SBML is straightforwardly written as

k*X, X => Y

now, this is bad for jump simulations.

At some point, either in these packages, or in Catalyst, it would make sense to write a function which takes a reaction and, if it is not a mass action reaction, checks if it can be rewritten as such.

For a starter, with reactions encoded using =>, we could probably just check all, 0th (technically no diff, but still might be nicer to convert => to -->, 1st, 2nd, and 3rd order reaction, having alternatives for all possible combinations:

# 0th order
..., 0 => ...

# 1st order
... * X, X => ...

# 2nd order
... * X*Y, X + Y => ...
... * X^2, 2X => ...

# 3rd order
... * X*Y*Z, X + Y + Z  => ...
... * X*Y^2, X + 2Y  => ...
... * X^3, 3X  => ...

and convert them appropriately.

I think it would make sense to write this in Catalyst, we might also be able to reuse it for other stuff. We could also make it work on some --> reactions, like rewriting

k*E, X --> Y

to

k, X + E --> Y + E

Finally, we could also write a "detector" which checks if such rewritings would be possible, and throws a warning when e.g. Jump simulations are carried out.

It needs not be perfect, but I think we should be able to, relatively easily, write something that covers 95% of cases.

@isaacsas
Copy link
Member

I think this is more of a SBMLToolkit reaction construction issue, since we generally expect users to specify their reaction as they want it represented.

There is an open issue there about this: SciML/SBMLToolkit.jl#68

@TorkelE
Copy link
Member Author

TorkelE commented Dec 12, 2023

Still, since it is an operation on a ReactionSystem, and it is going to be written, wouldn't in make sense to have it as a utility function within Catalyst? E.g. in this case it would mean that both https://github.com/SciML/SBMLToolkit.jl and https://github.com/sebapersson/SBMLImporter.jl could utilise it. Similarily, other uses might appear.

@isaacsas
Copy link
Member

I don't see it as an operation on a ReactionSystem though. It should be an internal operation within the SBML parsers, which should be detecting that the reaction they are parsing is mass action and building a correct Reaction in Catalyst.

It seems computationally inefficient to build an incorrect ReactionSystem and transform it instead of just building the correct system from the start.

@TorkelE TorkelE closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants