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

nesting of if-then-else statements in global functions #38

Open
wshlavacek opened this issue Apr 30, 2024 · 13 comments
Open

nesting of if-then-else statements in global functions #38

wshlavacek opened this issue Apr 30, 2024 · 13 comments

Comments

@wshlavacek
Copy link

The level of nesting of if-then-else statements allowed in NFsim is different than in BioNetGen. It seems that 50 levels deep is the max, whereas deeper nesting is possible in BioNetGen. This causes problems when switching from the ODE solver simulation method to the NFsim simulation method. There is probably a setting for the max level of nesting in the NFsim code. Could this setting be modified for consistency with BioNetGen? Below is an example of a function definition that involves nested if-then-else statements.

Data_DailyCases()=if(t<=38,0,
if(t<=39,1,
if(t<=40,0,
if(t<=41,1,
if(t<=42,9,
if(t<=43,11,
if(t<=44,22,
if(t<=45,45,
if(t<=46,17,
if(t<=47,36,
if(t<=48,31,
if(t<=49,44,
if(t<=50,109,
if(t<=51,95,
if(t<=52,189,
if(t<=53,122,
if(t<=54,218,
if(t<=55,425,
if(t<=56,1012,
if(t<=57,1774,
if(t<=58,2952,
if(t<=59,3258,
if(t<=60,4817,
if(t<=61,5711,
if(t<=62,4805,
if(t<=63,7413,
if(t<=64,5941,
if(t<=65,5688,
if(t<=66,8771,
if(t<=67,6266,
if(t<=68,7721,
if(t<=69,8707,
if(t<=70,8153,
if(t<=71,8996,
if(t<=72,10329,
if(t<=73,12274,
if(t<=74,8122,
if(t<=75,9304,
if(t<=76,8314,
if(t<=77,9568,
if(t<=78,10765,
if(t<=79,10794,
if(t<=80,10160,
if(t<=81,8435,
if(t<=82,6548,
if(t<=83,7402,
if(t<=84,11755,
if(t<=85,8631,
if(t<=86,7532,
if(t<=87,7249,
if(t<=88,6199,
if(t<=89,4867,
if(t<=90,4324,
if(t<=91,5659,
if(t<=92,6341,
if(t<=93,8286,
if(t<=94,10683,
if(t<=95,6013,
if(t<=96,4077,
if(t<=97,3285,
if(t<=98,4718,
if(t<=99,4702,
if(t<=100,3879,
if(t<=101,4559,
if(t<=102,3699,
if(t<=103,2524,
if(t<=104,2302,
if(t<=105,2746,
if(t<=106,3526,
if(t<=107,2873,
if(t<=108,2715,
if(t<=109,2138,
if(t<=110,1610,
if(t<=111,1438,
if(t<=112,2123,
if(t<=113,2364,
if(t<=114,2759,
if(t<=115,2185,
if(t<=116,1901,
if(t<=117,1241,
if(t<=118,1479,
if(t<=119,1478,
if(t<=120,2078,
0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

@jrfaeder
Copy link

Hi Bill,

We will look into implementing the change you are requesting to ensure compatibility between BNG and NFsim models. In the meantime, the fuctionality you are looking to implement can be obtained by using a time-dependent function (TFUN) in NFsim. See here for more details.

@wshlavacek
Copy link
Author

wshlavacek commented Apr 30, 2024 via email

@wshlavacek
Copy link
Author

wshlavacek commented Apr 30, 2024 via email

@jrfaeder
Copy link

jrfaeder commented May 1, 2024

Additional detail and a link to an example .dat file are here.

@jrfaeder
Copy link

jrfaeder commented May 1, 2024

There is a full example in the Validate folder of the bng2 subdirectory: https://github.com/RuleWorld/bionetgen/blob/master/bng2/Validate/test_tfun.bngl

@wshlavacek
Copy link
Author

wshlavacek commented May 6, 2024 via email

@wshlavacek
Copy link
Author

wshlavacek commented May 6, 2024 via email

@jrfaeder
Copy link

jrfaeder commented May 7, 2024

We agree that this should work in NFsim and are still working toward a fix. If you could email me the model that is causing the NFsim failure, that would expedite the process.

@wshlavacek
Copy link
Author

wshlavacek commented May 7, 2024 via email

@jrfaeder
Copy link

jrfaeder commented May 7, 2024

I was referring to the model with nested if's.
For the TFUN model, please make sure you are using the latest BioNetGen distribution.

@wshlavacek
Copy link
Author

wshlavacek commented May 7, 2024 via email

@wshlavacek
Copy link
Author

wshlavacek commented May 7, 2024 via email

@jrfaeder
Copy link

Our initial tests showed the NFsim is able to read in the nested if function from the xml file using muParser, but then crashes when checking that the function has been correctly defined. In looking through the code, we discovered that NFsim is using an older version of the muParser code (1.30) than the bionetgen Network3 code (2.2.4). We will investigate whether updating to a more recent version of muParser (either 2.2.4 or 2.3.4 (the latest)) enables the function to work correctly in NFsim.

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