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

Found the bug in ASTNode.toFomula() #259

Open
TlexCypher opened this issue Nov 7, 2023 · 5 comments
Open

Found the bug in ASTNode.toFomula() #259

TlexCypher opened this issue Nov 7, 2023 · 5 comments

Comments

@TlexCypher
Copy link

TlexCypher commented Nov 7, 2023

Hey, all.
I used jsbml-1.6.1, current latest version of jsbml, but I found the method, ASTNode.toFormula() fails to parse the formula.
To be specific, for testcase, I downloaded BIOMD0000000022.xml from BioModels(https://www.ebi.ac.uk/biomodels/search?query=BIOMD0000000022&domain=biomodels), and I wrote the program in C with libsbml.5.18.0 and java with jsbml-1.6.1.
I attached the both result as libsbml-formula.txt and jsbml-formula.txt, so I wanna you'll check these, then you should compare the first line.

libsbml-formula.txt of first line

formula1: compartment_0000003 * (c1 + (B1 + pow(CCn / A1, a)) * s1 / (1 + B1 + pow(CCn / A1, a) + pow(PTn / r1, r)))

jsbml-formula.txt of first line

formula1: compartment_0000003*(c1+((B1+CCn/A1^a)*s1)/(1+B1+CCn/A1^a+PTn/r1^r))

They are completely different. And I checked the related report(Robust oscillations within the interlocked feedback model of Drosophila circadian rhythm., but in this report, result by libsbml is correct.

And, I also checked core/src/org/sbml/jsbml/ASTNode.java.newASTNode, this file was revised 2 years ago, but jsbml-1.6.1 was released in Oct 2022. So even in latest version, jsbml has the bug around ASTNode.toFormula().

Any help, please.

libsbml-formula.txt
jsbml-formula.txt

@luciansmith
Copy link
Member

The trick here is that CCn/A1 needs to be in parentheses in the jsbml version of the formula:

i.e. instead of:

CCn/A1^a

it needs to produce:

(CCn/A1)^a

(It could produce the 'pow' version instead, if that's simpler.)

@TlexCypher
Copy link
Author

@luciansmith Yes, that is what i wanna say!
jsbml-1.6.1 can't parse this formula correctly, I think.

@luciansmith
Copy link
Member

You are correct! Thanks for reporting the issue; hopefully the jsbml team will be able to get to it soon.

@TlexCypher
Copy link
Author

I'm gonna to try fix this bug!

@luciansmith
Copy link
Member

Good luck! Feel free to post here with questions if you have any.

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