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

PySBPetab sets incorrect value for edata.reinitializeFixedParameterInitialStates #1405

Open
FFroehlich opened this issue Feb 9, 2021 · 11 comments
Labels
PEtab PEtab-import related PySB PySB import related

Comments

@FFroehlich
Copy link
Member

FFroehlich commented Feb 9, 2021

prevents use of reinitialization with multithreading pysb models? 💩

@FFroehlich FFroehlich changed the title Model.reinitialize_fixed_parameter_initial_states_ is ignored during model cloning PySBPetab does sets incorrect value for edata.reinitializeFixedParameterInitialStates Feb 9, 2021
@dweindl
Copy link
Member

dweindl commented Feb 12, 2021

@FFroehlich : Can you provide some more details?

@dweindl dweindl added PEtab PEtab-import related PySB PySB import related labels Feb 12, 2021
@FFroehlich
Copy link
Member Author

FFroehlich commented Feb 20, 2021

petab problem defines preequilibration conditions with different parameters, but edata.reinitializeFixedParameterInitialStates is not set to true.

@dweindl
Copy link
Member

dweindl commented Feb 21, 2021

You are right. However, I am not sure if this is currently well-defined in PEtab. If there are states/species in the condition table, then it's clear what to do. But for parameters, not really. Needs clarification there in my opinion.

@FFroehlich
Copy link
Member Author

You are right. However, I am not sure if this is currently well-defined in PEtab. If there are states/species in the condition table, then it's clear what to do. But for parameters, not really. Needs clarification there in my opinion.

Pretty much makes PySB-Petab de facto unusable for me.

@dweindl
Copy link
Member

dweindl commented Feb 24, 2021

Pretty much makes PySB-Petab de facto unusable for me.

Maybe you want to make a proposal on how that should be handled...

@FFroehlich
Copy link
Member Author

Pretty much makes PySB-Petab de facto unusable for me.

Maybe you want to make a proposal on how that should be handled...

Extend parameter table by an optional column that indicates whether changing this parameter through a condition should trigger reinitialization of all states that have initial states depending on this parameter.

@dweindl
Copy link
Member

dweindl commented Feb 24, 2021

Extend parameter table by an optional column that indicates whether changing this parameter through a condition should trigger reinitialization of all states that have initial states depending on this parameter.

Sounds fine for the moment, but I'm wondering how compatible that would be with the (hopefully soon implemented) case of having multiple simulation conditions in a row, beyond just preequilibration/presimulation. I guess one would want to have that setting for each change of parameters then.

Specifying species/patterns for reinitialization as done for PEtab/SBML would not work for you? (currently not possible here, but if it were...)

@FFroehlich
Copy link
Member Author

Extend parameter table by an optional column that indicates whether changing this parameter through a condition should trigger reinitialization of all states that have initial states depending on this parameter.

Sounds fine for the moment, but I'm wondering how compatible that would be with the (hopefully soon implemented) case of having multiple simulation conditions in a row, beyond just preequilibration/presimulation. I guess one would want to have that setting for each change of parameters then.

Specifying species/patterns for reinitialization as done for PEtab/SBML would not work for you? (currently not possible here, but if it were...)

Hmm patterns would probably work, but thats conceptually a bit tricky to do since a pure reinitialization approach would affect network generation. For example, for a drug, I would not add and initial to the model, so the reinitialization would have to add an initial to the model. Accordingly, things like model generation may not behave as expected, as the generated model will probably depend on the specified condition. I can easily see that causing trouble.

@dweindl
Copy link
Member

dweindl commented Feb 25, 2021

Hm, wouldn't you add an Initial(..., 0.0) for anything that will have a non-zero amount due to reinitialization anyways?

For the proposed extra "triggersReinitialization" column, how would you handle that for multiple parameter changes (e.g., simulation phase 1, simulation phase 2, simulation phase 3)? With one column there, you could not reinitialize the state only once (e.g., you could not only reinitialize at beginning of phase 2, while not reinitializing for phase 3). Adding multiple columns would require that you always have the same type of experimental setup.

@FFroehlich
Copy link
Member Author

Hm, wouldn't you add an Initial(..., 0.0) for anything that will have a non-zero amount due to reinitialization anyways?

I would argue you wouldn't, unless you specifically build the model for the purposes of petab. Initial(..., 0.0) will mostly just create a larger network which contains species that are always zero. I would argue that most models contain a parametrized initial that can be changed by changing parameter values.

I think the general dogma should be that experimental conditions shouldn't be encoded in the model and I would argue that allowing condition parameters to change the model would violate that assumption. So it would have to be enforced that patterns for reinitialization may only refer to species that are already contained in the model.

For the proposed extra "triggersReinitialization" column, how would you handle that for multiple parameter changes (e.g., simulation phase 1, simulation phase 2, simulation phase 3)? With one column there, you could not reinitialize the state only once (e.g., you could not only reinitialize at beginning of phase 2, while not reinitializing for phase 3). Adding multiple columns would require that you always have the same type of experimental setup.

I agree, I don't think that can be implemented.

@FFroehlich
Copy link
Member Author

FFroehlich commented Feb 26, 2021

It should be noted though that without unit transformation baked into petab, setting initial values by explicitely by specifying pattern abundances is not very convenient. My model has everything in uM, but ligand concentrations are specified in ng/ml, which have to be converted. With parameterized initials, I can use expressions to do the transformation and specify the condition in a familiar units. Without this transformation, numerical values get pretty unwieldy.

@dweindl dweindl changed the title PySBPetab does sets incorrect value for edata.reinitializeFixedParameterInitialStates PySBPetab sets incorrect value for edata.reinitializeFixedParameterInitialStates Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PEtab PEtab-import related PySB PySB import related
Projects
None yet
Development

No branches or pull requests

2 participants