A up-regulates B , by being the limiting reagent in the reaction:¶A + X <-> 2B (mostly forward), where X is plentiful¶1st-order kinetics.
If [A] is low, [B] remains low, too. Then, if [A] goes high, then so does [B]. However, at that point, A can no longer bring B down to any substantial extent.
Single-bin reaction
Based on experiment reactions_single_compartment/up_regulate_1
LAST REVISED: May 6, 2024
import set_path # Importing this module will add the project's home directory to sys.path
Added 'D:\Docs\- MY CODE\BioSimulations\life123-Win7' to sys.path
from experiments.get_notebook_info import get_notebook_basename
from src.modules.chemicals.chem_data import ChemData
from src.life_1D.bio_sim_1d import BioSim1D
import plotly.express as px
from src.modules.visualization.graphic_log import GraphicLog
# Initialize the HTML logging
log_file = get_notebook_basename() + ".log.htm" # Use the notebook base filename for the log file
# Set up the use of some specified graphic (Vue) components
GraphicLog.config(filename=log_file,
components=["vue_cytoscape_2"],
extra_js="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.21.2/cytoscape.umd.js")
-> Output will be LOGGED into the file 'up_regulation_1.log.htm'
# Initialize the system
chem_data = ChemData(names=["A", "X", "B"]) # NOTE: Diffusion not applicable (just 1 bin)
# Reaction A + X <-> 2B , with 1st-order kinetics for all species
chem_data.add_reaction(reactants=[("A") , ("X")], products=[(2, "B", 1)],
forward_rate=8., reverse_rate=2.)
chem_data.describe_reactions()
# Send the plot of the reaction network to the HTML log file
chem_data.plot_reaction_network("vue_cytoscape_2")
Number of reactions: 1 (at temp. 25 C)
0: A + X <-> 2 B (kF = 8 / kR = 2 / delta_G = -3,436.6 / K = 4) | 1st order in all reactants & products
Set of chemicals involved in the above reactions: {'X', 'B', 'A'}
[GRAPHIC ELEMENT SENT TO LOG FILE `up_regulation_1.log.htm`]
bio = BioSim1D(n_bins=1, chem_data=chem_data)
bio.set_uniform_concentration(species_name="A", conc=5.) # Scarce
bio.set_uniform_concentration(species_name="X", conc=100.) # Plentiful
# Initially, no "B" is present
bio.describe_state()
SYSTEM STATE at Time t = 0: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [5.] Species 1 (X). Diff rate: None. Conc: [100.] Species 2 (B). Diff rate: None. Conc: [0.]
# Save the state of the concentrations of all species at bin 0 (the only bin in this system)
bio.add_snapshot(bio.bin_snapshot(bin_address = 0))
bio.get_history()
| SYSTEM TIME | A | X | B | caption | |
|---|---|---|---|---|---|
| 0 | 0 | 5.0 | 100.0 | 0.0 |
bio.react(time_step=0.0005, n_steps=30, snapshots={"frequency": 2, "sample_bin": 0}) # At every other step, take a snapshot
# of all species at bin 0
bio.describe_state()
bio.get_history()
SYSTEM STATE at Time t = 0.015: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [0.02617327] Species 1 (X). Diff rate: None. Conc: [95.02617327] Species 2 (B). Diff rate: None. Conc: [9.94765346]
| SYSTEM TIME | A | X | B | caption | |
|---|---|---|---|---|---|
| 0 | 0.000 | 5.000000 | 100.000000 | 0.000000 | |
| 1 | 0.001 | 1.828000 | 96.828000 | 6.344000 | |
| 2 | 0.002 | 0.701002 | 95.701002 | 8.597996 | |
| 3 | 0.003 | 0.281916 | 95.281916 | 9.436168 | |
| 4 | 0.004 | 0.123519 | 95.123519 | 9.752963 | |
| 5 | 0.005 | 0.063287 | 95.063287 | 9.873425 | |
| 6 | 0.006 | 0.040331 | 95.040331 | 9.919337 | |
| 7 | 0.007 | 0.031575 | 95.031575 | 9.936851 | |
| 8 | 0.008 | 0.028233 | 95.028233 | 9.943534 | |
| 9 | 0.009 | 0.026958 | 95.026958 | 9.946084 | |
| 10 | 0.010 | 0.026471 | 95.026471 | 9.947058 | |
| 11 | 0.011 | 0.026285 | 95.026285 | 9.947429 | |
| 12 | 0.012 | 0.026215 | 95.026215 | 9.947571 | |
| 13 | 0.013 | 0.026188 | 95.026188 | 9.947625 | |
| 14 | 0.014 | 0.026177 | 95.026177 | 9.947646 | |
| 15 | 0.015 | 0.026173 | 95.026173 | 9.947653 |
A, as the scarse limiting reagent, stops the reaction.
When A is low, B is also low.
Consistent with the 4/1 ratio of forward/reverse rates (and the 1st order reactions), the systems settles in the following equilibrium:
# Verify that the reaction has reached equilibrium
bio.reaction_dynamics.is_in_equilibrium(rxn_index=0, conc=bio.bin_snapshot(bin_address = 0))
A + X <-> 2 B
Final concentrations: [A] = 0.02617 ; [X] = 95.03 ; [B] = 9.948
1. Ratio of reactant/product concentrations, adjusted for reaction orders: 3.99963
Formula used: [B] / ([A][X])
2. Ratio of forward/reverse reaction rates: 4.0
Discrepancy between the two values: 0.009347 %
Reaction IS in equilibrium (within 1% tolerance)
True
fig = px.line(data_frame=bio.get_history(), x="SYSTEM TIME", y=["A", "X", "B"],
title="Changes in concentrations (reaction A + X <-> 2B)",
color_discrete_sequence = ['red', 'darkorange', 'green'],
labels={"value":"concentration", "variable":"Chemical"})
fig.show()
bio.set_bin_conc(bin_address=0, species_index=0, conc=50.)
bio.describe_state()
SYSTEM STATE at Time t = 0.015: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [50.] Species 1 (X). Diff rate: None. Conc: [95.02617327] Species 2 (B). Diff rate: None. Conc: [9.94765346]
# Save the state of the concentrations of all species at bin 0 (the only bin in this system)
bio.add_snapshot(bio.bin_snapshot(bin_address = 0))
bio.get_history()
| SYSTEM TIME | A | X | B | caption | |
|---|---|---|---|---|---|
| 0 | 0.000 | 5.000000 | 100.000000 | 0.000000 | |
| 1 | 0.001 | 1.828000 | 96.828000 | 6.344000 | |
| 2 | 0.002 | 0.701002 | 95.701002 | 8.597996 | |
| 3 | 0.003 | 0.281916 | 95.281916 | 9.436168 | |
| 4 | 0.004 | 0.123519 | 95.123519 | 9.752963 | |
| 5 | 0.005 | 0.063287 | 95.063287 | 9.873425 | |
| 6 | 0.006 | 0.040331 | 95.040331 | 9.919337 | |
| 7 | 0.007 | 0.031575 | 95.031575 | 9.936851 | |
| 8 | 0.008 | 0.028233 | 95.028233 | 9.943534 | |
| 9 | 0.009 | 0.026958 | 95.026958 | 9.946084 | |
| 10 | 0.010 | 0.026471 | 95.026471 | 9.947058 | |
| 11 | 0.011 | 0.026285 | 95.026285 | 9.947429 | |
| 12 | 0.012 | 0.026215 | 95.026215 | 9.947571 | |
| 13 | 0.013 | 0.026188 | 95.026188 | 9.947625 | |
| 14 | 0.014 | 0.026177 | 95.026177 | 9.947646 | |
| 15 | 0.015 | 0.026173 | 95.026173 | 9.947653 | |
| 16 | 0.015 | 50.000000 | 95.026173 | 9.947653 |
bio.react(time_step=0.0005, n_steps=40, snapshots={"frequency": 2, "sample_bin": 0}) # At every other step, take a snapshot
# of all species at bin 0
bio.describe_state()
bio.get_history()
SYSTEM STATE at Time t = 0.035: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [0.60107953] Species 1 (X). Diff rate: None. Conc: [45.6272528] Species 2 (B). Diff rate: None. Conc: [108.74549439]
| SYSTEM TIME | A | X | B | caption | |
|---|---|---|---|---|---|
| 0 | 0.000 | 5.000000 | 100.000000 | 0.000000 | |
| 1 | 0.001 | 1.828000 | 96.828000 | 6.344000 | |
| 2 | 0.002 | 0.701002 | 95.701002 | 8.597996 | |
| 3 | 0.003 | 0.281916 | 95.281916 | 9.436168 | |
| 4 | 0.004 | 0.123519 | 95.123519 | 9.752963 | |
| 5 | 0.005 | 0.063287 | 95.063287 | 9.873425 | |
| 6 | 0.006 | 0.040331 | 95.040331 | 9.919337 | |
| 7 | 0.007 | 0.031575 | 95.031575 | 9.936851 | |
| 8 | 0.008 | 0.028233 | 95.028233 | 9.943534 | |
| 9 | 0.009 | 0.026958 | 95.026958 | 9.946084 | |
| 10 | 0.010 | 0.026471 | 95.026471 | 9.947058 | |
| 11 | 0.011 | 0.026285 | 95.026285 | 9.947429 | |
| 12 | 0.012 | 0.026215 | 95.026215 | 9.947571 | |
| 13 | 0.013 | 0.026188 | 95.026188 | 9.947625 | |
| 14 | 0.014 | 0.026177 | 95.026177 | 9.947646 | |
| 15 | 0.015 | 0.026173 | 95.026173 | 9.947653 | |
| 16 | 0.015 | 50.000000 | 95.026173 | 9.947653 | |
| 17 | 0.016 | 21.623388 | 66.649561 | 66.700877 | |
| 18 | 0.017 | 12.120737 | 57.146910 | 85.706180 | |
| 19 | 0.018 | 7.471301 | 52.497475 | 95.005051 | |
| 20 | 0.019 | 4.871324 | 49.897498 | 100.205005 | |
| 21 | 0.020 | 3.316949 | 48.343122 | 103.313756 | |
| 22 | 0.021 | 2.351873 | 47.378046 | 105.243908 | |
| 23 | 0.022 | 1.738886 | 46.765059 | 106.469882 | |
| 24 | 0.023 | 1.343971 | 46.370144 | 107.259712 | |
| 25 | 0.024 | 1.087238 | 46.113411 | 107.773177 | |
| 26 | 0.025 | 0.919361 | 45.945534 | 108.108931 | |
| 27 | 0.026 | 0.809169 | 45.835342 | 108.329315 | |
| 28 | 0.027 | 0.736661 | 45.762834 | 108.474332 | |
| 29 | 0.028 | 0.688871 | 45.715044 | 108.569911 | |
| 30 | 0.029 | 0.657340 | 45.683513 | 108.632974 | |
| 31 | 0.030 | 0.636520 | 45.662694 | 108.674613 | |
| 32 | 0.031 | 0.622768 | 45.648941 | 108.702118 | |
| 33 | 0.032 | 0.613680 | 45.639853 | 108.720293 | |
| 34 | 0.033 | 0.607674 | 45.633847 | 108.732305 | |
| 35 | 0.034 | 0.603704 | 45.629877 | 108.740246 | |
| 36 | 0.035 | 0.601080 | 45.627253 | 108.745494 |
A, still the limiting reagent, is again stopping the reaction.
The (transiently) high value of [A] led to a high value of [B]
# Verify the equilibrium
A_eq = bio.bin_concentration(0, 0)
X_eq = bio.bin_concentration(0, 1)
B_eq = bio.bin_concentration(0, 2)
print("Ratio of equilibrium concentrations (B_eq / (A_eq * X_eq)): ", (B_eq / (A_eq * X_eq)))
print("Ratio of forward/reverse rates: ", chem_data.get_forward_rate(0) / chem_data.get_reverse_rate(0))
Ratio of equilibrium concentrations (B_eq / (A_eq * X_eq)): 3.9651079073726363 Ratio of forward/reverse rates: 4.0
fig = px.line(data_frame=bio.get_history(), x="SYSTEM TIME", y=["A", "X", "B"],
title="Changes in concentrations (reaction A + X <-> 2B)",
color_discrete_sequence = ['red', 'darkorange', 'green'],
labels={"value":"concentration", "variable":"Chemical"})
fig.show()
A, still the limiting reagent, is again stopping the reaction.
The (transiently) high value of [A] led to a high value of [B]
bio.set_bin_conc(bin_address=0, species_index=0, conc=30.)
bio.describe_state()
SYSTEM STATE at Time t = 0.035: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [30.] Species 1 (X). Diff rate: None. Conc: [45.6272528] Species 2 (B). Diff rate: None. Conc: [108.74549439]
# Save the state of the concentrations of all species at bin 0 (the only bin in this system)
bio.add_snapshot(bio.bin_snapshot(bin_address = 0))
bio.react(time_step=0.0005, n_steps=70, snapshots={"frequency": 2, "sample_bin": 0}) # At every other step, take a snapshot
# of all species at bin 0
bio.describe_state()
bio.get_history()
SYSTEM STATE at Time t = 0.07: 1 bins and 3 species: Species 0 (A). Diff rate: None. Conc: [2.31631253] Species 1 (X). Diff rate: None. Conc: [17.94356534] Species 2 (B). Diff rate: None. Conc: [164.11286933]
| SYSTEM TIME | A | X | B | caption | |
|---|---|---|---|---|---|
| 0 | 0.000 | 5.000000 | 100.000000 | 0.000000 | |
| 1 | 0.001 | 1.828000 | 96.828000 | 6.344000 | |
| 2 | 0.002 | 0.701002 | 95.701002 | 8.597996 | |
| 3 | 0.003 | 0.281916 | 95.281916 | 9.436168 | |
| 4 | 0.004 | 0.123519 | 95.123519 | 9.752963 | |
| ... | ... | ... | ... | ... | ... |
| 68 | 0.066 | 2.342097 | 17.969350 | 164.061300 | |
| 69 | 0.067 | 2.333888 | 17.961141 | 164.077718 | |
| 70 | 0.068 | 2.326989 | 17.954242 | 164.091517 | |
| 71 | 0.069 | 2.321189 | 17.948442 | 164.103117 | |
| 72 | 0.070 | 2.316313 | 17.943565 | 164.112869 |
73 rows × 5 columns
A, again the scarse limiting reagent, stops the reaction yet again
# Verify the equilibrium
A_eq = bio.bin_concentration(0, 0)
X_eq = bio.bin_concentration(0, 1)
B_eq = bio.bin_concentration(0, 2)
print("Ratio of equilibrium concentrations (B_eq / (A_eq * X_eq)): ", (B_eq / (A_eq * X_eq)))
print("Ratio of forward/reverse rates: ", chem_data.get_forward_rate(0) / chem_data.get_reverse_rate(0))
Ratio of equilibrium concentrations (B_eq / (A_eq * X_eq)): 3.9485418139406785 Ratio of forward/reverse rates: 4.0
fig = px.line(data_frame=bio.get_history(), x="SYSTEM TIME", y=["A", "X", "B"],
title="Changes in concentrations (reaction A + X <-> 2B)",
color_discrete_sequence = ['red', 'darkorange', 'green'],
labels={"value":"concentration", "variable":"Chemical"})
fig.show()
A, again the scarse limiting reagent, stops the reaction yet again.
And, again, the (transiently) high value of [A] up-regulated [B]
Note: A can up-regulate B, but it cannot bring it down.
X will soon need to be replenished, if A is to continue being the limiting reagent.
reactions_single_compartment/up_regulate_1¶