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

Add support for species conversion factor #257

Closed
sebapersson opened this issue Oct 20, 2023 · 3 comments · Fixed by #259
Closed

Add support for species conversion factor #257

sebapersson opened this issue Oct 20, 2023 · 3 comments · Fixed by #259
Labels
enhancement New feature or request

Comments

@sebapersson
Copy link
Contributor

Target functionality

With SBML level 3 species conversion factors are allowed, but I do not think SBML.jl supports these yet (I have not found it in the SBML.Model struct). The code I would want to be able to run is;

using SBML
using Downloads
path = Downloads.download("https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/release/cases/semantic/00976/00976-sbml-l3v2.xml", joinpath(@__DIR__, "model.xml"))
model = readSBML(path)
model.species["S1"].conversion_factor

Desired output

In case a species (like S1 here) has a conversion factor I would like the following output :

S1conv

While for species without conversion factor in the SBML.Species struct nothing should be returned.

Optional: Suggestions for implementation

I think this can be implemented by adding a conversion_factor field to SBML.Species , and a check that a given conversion factor is an identifier of a parameter in the model.

The description of conversion factor can be found under the heading The conversionFactor attribute in SBML Level 3 in the libSBML manual https://synonym.caltech.edu/software/libsbml/5.18.0/docs/formatted/python-api/classlibsbml_1_1_species.html.

@exaexa
Copy link
Collaborator

exaexa commented Oct 20, 2023

Hi! This is certainly doable and seems simple enough, thanks for suggestion!

I won't unfortunately have much time in the following few week to attend to this, but should eventually get to it. Pull request would be very welcome :]

(for the possible PR: The implementation can copypaste the handling of e.g. the compartment field, which should be completely isomorphic to this. You just need to change the name in struct Species and use the correct functions to read/write the data in readSBML and writeSBML from here: https://synonym.caltech.edu/software/libsbml/5.18.0/docs/formatted/c-api/class_species__t.html#add498e15032528b8b50504c4dcde0de7 )

@exaexa exaexa added the enhancement New feature or request label Oct 20, 2023
@sebapersson
Copy link
Contributor Author

Thanks you, I will take a look at this and hopefully provide a PR within a week!

@exaexa
Copy link
Collaborator

exaexa commented Oct 24, 2023

ok. Feel free to open an incomplete/crashing PR, we can fix some leftover issues too. :]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants