BuildACell / bioCRNpyler

A modular compiler for biological chemical reaction networks
BSD 3-Clause "New" or "Revised" License
40 stars 24 forks source link

How to modify k_forward after model built? #283

Open wupeng1998 opened 1 month ago

wupeng1998 commented 1 month ago

I tried to use the code to build model: Combine_PURE=ChemicalReactionNetwork(species = flatten([CRN_TX.species, CRN_TL.species, gfp_species,degraded_species]), reactions = flatten([CRN_TX.reactions, CRN_TL.reactions, Rxn_folding, Rxn_mRNA_degraded, Rxn_protein_degraded]))

After the model is built, i try to modify the k_forward value, such as

Combine_PURE.reactions[0].propensity_type.propensity_dict['parameters']['k_forward'] = 10 or Combine_PURE.reactions[0].propensity_type.k_forward = 10,

but all the attempted updates have not changed. Can the k_forward value only be initialized when the model is built?

ayush9pandey commented 1 month ago

Hi @wupeng1998

To update a parameter, you'd need to change its value and then recompile the CRN for the change to show up in the model. Various ways in which you might change the parameters is described here: https://github.com/BuildACell/bioCRNpyler/blob/master/examples/5.%20Parameters.ipynb

For quicker turnarounds with changing parameter values, you could use your preferred SBML simulator's parameter update functions after building the CRN structure with BioCRNpyler and saving it as SBML.

wupeng1998 commented 1 month ago

okay,thanks,i will try it