KarrLab / wc_sim

A multi-algorithmic simulator for whole-cell models
MIT License
6 stars 2 forks source link

Support dynamic compartment volumes #34

Closed jonrkarr closed 4 years ago

artgoldberg commented 5 years ago

dynamic compartment volume is already supported via V = mass/density in biochemical compartments. But I suspect you want another way to specify V varying with time. How would that be specified?

jonrkarr commented 5 years ago

wc-sim no longer needs to calculate compartment volumes. I've re-factored wc-lang so that modelers can define functions for volumes and how they should be calculated.

This is the scheme for dynamic calculation of volumes and their usage in rate laws:

  1. wc-sim calculates the total mass of each compartment
  2. Modelers define a density parameter for each compartment (wc_lang.Compartment.density)
  3. If necessary, modelers define a volume function for each compartment (wc_lang.Function) whose expression (wc_lang.Function.expression.expression) is equal to comp_id / comp_density_param_id
  4. Modelers can use these functions in rate laws (e.g. v = k_cat * E[c] * S[c] / (K_m * Avogadro * c + S[c]) where the units of E[c] and S[c] are molecule

The other place where we're doing calculations that involve volume is during the calculation of initial conditions which can be specified as (random distributions of) volumes of compartments and (random distributions of) concentrations. This is the intended scheme:

  1. Modeler defines the random distributions of compartment volumes (wc_lang.Compartment.mean_init_volume)
  2. Modeler defines the random distribution of species counts/concentrations (wc_lang.DistributionInitConcentration)
  3. wc-sim samples from the random distributions of compartment volumes
  4. wc-sim samples from the random distribution of species counts/concentrations. For concentration-valued quantities, wc-sim uses the compartment volumes sampled from Step 3.
  5. After the initial conditions are sampled, wc-sim sets the values of the density parameters of each compartment (wc_lang.Compartment.density.value) equal to comp.mass() / comp.init_volume

Todo

johnsekar commented 5 years ago

Here, it would make sense to have volume sampling outside the main wc-sim framework. Defining a distribution of initial conditions is more correctly a simulation protocol rather than a part of the model structure.

On Thu, 20 Dec 2018, 11:05 Jonathan Karr <notifications@github.com wrote:

wc-sim no longer needs to calculate compartment volumes. I've re-factored wc-lang so that modelers can define functions for volumes and how they should be calculated.

This is the scheme for dynamic calculation of volumes and their usage in rate laws:

  1. wc-sim calculates the total mass of each compartment
  2. Modeler's define a density parameter for each compartment ( wc_lang.Compartment.density)
  3. If necessary, modeler's define a volume function for each compartment (wc_lang.Function) whose expression ( wc_lang.Function.expression.expression) is equal to comp_id / comp_density_param_id
  4. Modelers can use these functions in rate laws (e.g. v = k_cat E[c] S[c] / (K_m Avogadro c + S[c]) where the units of E[c] and S[c] are molecule

The other place where we're doing calculations that involve volume is during the calculation of initial conditions which can be specified as (random distributions of) volumes of compartments and (random distributions of) concentrations. This is the intended scheme:

  1. Modeler defines the random distributions of compartment volumes ( wc_lang.Compartment.mean_init_volume)
  2. Molecular defines the random distribution of species counts/concentrations (wc_lang.DistributionInitConcentration)
  3. wc-sim samples from the random distributions of compartment volumes
  4. wc-sim samples from the random distribution of species counts/concentrations. For concentration-valued quantities, wc-sim uses the compartment volumes sampled from Step 3.
  5. After the initial conditions are sampled, wc-sim sets the values of the density parameters of each compartment ( wc_lang.Compartment.density.value) equal to comp.mass() / comp.init_volume

wc_sim.multialgorithm.multialgorithm_simulation needs to refactored to implement Step 4.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KarrLab/wc_sim/issues/34#issuecomment-449048317, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiTwcpYMIeAQQQUfc5qyFpU2MbZSNa9ks5u67VbgaJpZM4X25cM .

jonrkarr commented 5 years ago

Usually, initial conditions are considered a property of a simulation. But, in our case I think it makes sense to think of initial conditions as part of models. In any case, the implementation should be modular from the construction of the wc-sim object graph and the dynamical simulation as I discussed in the issues.

On Sat, Dec 22, 2018, 6:07 PM John Sekar <notifications@github.com wrote:

Here, it would make sense to have volume sampling outside the main wc-sim framework. Defining a distribution of initial conditions is more correctly a simulation protocol rather than a part of the model structure.

On Thu, 20 Dec 2018, 11:05 Jonathan Karr <notifications@github.com wrote:

wc-sim no longer needs to calculate compartment volumes. I've re-factored wc-lang so that modelers can define functions for volumes and how they should be calculated.

This is the scheme for dynamic calculation of volumes and their usage in rate laws:

  1. wc-sim calculates the total mass of each compartment
  2. Modeler's define a density parameter for each compartment ( wc_lang.Compartment.density)
  3. If necessary, modeler's define a volume function for each compartment (wc_lang.Function) whose expression ( wc_lang.Function.expression.expression) is equal to comp_id / comp_density_param_id
  4. Modelers can use these functions in rate laws (e.g. v = k_cat E[c] S[c] / (K_m Avogadro c + S[c]) where the units of E[c] and S[c] are molecule

The other place where we're doing calculations that involve volume is during the calculation of initial conditions which can be specified as (random distributions of) volumes of compartments and (random distributions of) concentrations. This is the intended scheme:

  1. Modeler defines the random distributions of compartment volumes ( wc_lang.Compartment.mean_init_volume)
  2. Molecular defines the random distribution of species counts/concentrations (wc_lang.DistributionInitConcentration)
  3. wc-sim samples from the random distributions of compartment volumes
  4. wc-sim samples from the random distribution of species counts/concentrations. For concentration-valued quantities, wc-sim uses the compartment volumes sampled from Step 3.
  5. After the initial conditions are sampled, wc-sim sets the values of the density parameters of each compartment ( wc_lang.Compartment.density.value) equal to comp.mass() / comp.init_volume

wc_sim.multialgorithm.multialgorithm_simulation needs to refactored to implement Step 4.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KarrLab/wc_sim/issues/34#issuecomment-449048317, or mute the thread < https://github.com/notifications/unsubscribe-auth/ABiTwcpYMIeAQQQUfc5qyFpU2MbZSNa9ks5u67VbgaJpZM4X25cM

.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/KarrLab/wc_sim/issues/34#issuecomment-449603065, or mute the thread https://github.com/notifications/unsubscribe-auth/ACt2Kdq52FcDE2P733q4Sb8JCXS_fMlyks5u7rspgaJpZM4X25cM .

artgoldberg commented 4 years ago

done