You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did a workaround for models with one compartment or many but with rules only referring to one compartment. For instance, I took the model MODEL1608100000 from Biomodels. It has two compartments, but the 4 rules refer to only one. The export to kappa isn't allowed because of the model.compartments is non-empty.
The model has no expressions, so I copy the attribute (model.compartments = model.expressions, and because deletion isn't allowed by the exporter). The resulting model in kappa language has @compartment and @compartment: statements, but removing them makes the model executable by KaSim (and also repairing an agent mismatch in rule R3).
It would be useful for the user to declare an option allowing the conversion.
Thanks for your time and best regards.
The text was updated successfully, but these errors were encountered:
Thanks for the report. It's possible to manually strip out compartments from a model, see the example code below, which you could use like this: new_model = remove_compartments(model).
Not sure how useful this would be as a helper function in PySB, since it will break model functionality in general. Perhaps @jmuhlich or @lh64 have thoughts on whether something along these lines is worth adding to PySB?
frompysb.coreimportComponentSetimportcopydef_remove_compartment_complex_pattern(cp):
cp.compartment=Noneformpincp.monomer_patterns:
mp.compartment=Nonedefremove_compartments(model):
""" Return a new copy of the model with compartments removed """model=copy.deepcopy(model)
forruleinmodel.rules:
forcpinrule.reactant_pattern.complex_patterns:
_remove_compartment_complex_pattern(cp)
forcpinrule.product_pattern.complex_patterns:
_remove_compartment_complex_pattern(cp)
forobsinmodel.observables:
forcpinobs.reaction_pattern:
_remove_compartment_complex_pattern(cp)
model.compartments=ComponentSet()
returnmodel
Hello everyone,
I did a workaround for models with one compartment or many but with rules only referring to one compartment. For instance, I took the model MODEL1608100000 from Biomodels. It has two compartments, but the 4 rules refer to only one. The export to kappa isn't allowed because of the model.compartments is non-empty.
The model has no expressions, so I copy the attribute (
model.compartments = model.expressions
, and because deletion isn't allowed by the exporter). The resulting model in kappa language has@compartment
and@compartment:
statements, but removing them makes the model executable by KaSim (and also repairing an agent mismatch in rule R3).It would be useful for the user to declare an option allowing the conversion.
Thanks for your time and best regards.
The text was updated successfully, but these errors were encountered: