Academic Block

Logo of Academicblock.net

SimBiology in MATLAB

SimBiology is a MATLAB tool used for modeling, simulating, and analyzing biological systems, including pharmacokinetics, pharmacodynamics, and systems biology. It provides a graphical environment and programmatic interface for working with models.

Basic Concepts of Using SimBiology in Matlab

SimBiology works with models that consist of compartments, species, parameters, reactions, and rules. Here is a brief overview:

  • Compartments: Define the space where reactions occur.
  • Species: Represent chemical or biological entities.
  • Parameters: Represent constants such as rate constants.
  • Reactions: Define how species interact.
  • Rules: Define mathematical relationships.

Creating and Simulating a Model

Here’s how to create and simulate a simple reaction model using SimBiology:

% Creating a SimBiology model
model = sbiomodel('SimpleReaction');
compartment = addcompartment(model, 'Cell');
speciesA = addspecies(compartment, 'A', 'InitialAmount', 10);
speciesB = addspecies(compartment, 'B', 'InitialAmount', 0);
reaction = addreaction(model, 'A -> B');
kineticLaw = addkineticlaw(reaction, 'MassAction');
param = addparameter(kineticLaw, 'k', 'Value', 0.1);
set(kineticLaw, 'ParameterVariableNames', 'k');

% Simulating the model
config = getconfigset(model, 'active');
set(config, 'SolverType', 'ode15s');
[t, x, names] = sbiosimulate(model);

% Plotting results
plot(t, x);
xlabel('Time'); ylabel('Concentration');
legend(names);

Output Example:

Time vs Concentration graph showing the decay of A and the production of B.
    

Pharmacokinetics Modeling

SimBiology is widely used for pharmacokinetics (PK) modeling. Here’s an example of modeling a one-compartment PK model with oral dosing:

% One-compartment PK model
model = sbiomodel('OneCompartmentPK');
compartment = addcompartment(model, 'Central', 'Capacity', 1);
speciesDrug = addspecies(compartment, 'Drug', 'InitialAmount', 0);
paramCL = addparameter(model, 'CL', 'Value', 1, 'Units', 'L/hr');
paramV = addparameter(model, 'V', 'Value', 10, 'Units', 'L');
reaction = addreaction(model, 'Drug -> null');
kineticLaw = addkineticlaw(reaction, 'MassAction');
set(kineticLaw, 'ParameterVariableNames', 'CL');

% Adding a dosing regimen
dose = adddose(model, 'OralDose', 'TargetName', 'Central.Drug');
set(dose, 'Amount', 100, 'Interval', 24, 'RepeatCount', 5);

% Simulating the model
[t, x, names] = sbiosimulate(model);
plot(t, x);
xlabel('Time (hours)'); ylabel('Drug Concentration (mg/L)');
legend(names);

Output Example:

Time vs Drug Concentration graph showing a concentration peak after each dose.
    

Advance Example Problems: SimBiology in MATLAB

Example 1: Two-Compartment Pharmacokinetic Model

In this example, we model a two-compartment pharmacokinetic system. Drug absorption occurs in the central compartment, and there is an exchange of the drug between the central and peripheral compartments. The drug is also eliminated from the central compartment.

% Create a SimBiology model
model = sbiomodel('TwoCompartmentPK');

% Add compartments
central = addcompartment(model, 'Central', 'Capacity', 1);
peripheral = addcompartment(model, 'Peripheral', 'Capacity', 1);

% Add species
drugCentral = addspecies(central, 'Drug_Central', 'InitialAmount', 0);
drugPeripheral = addspecies(peripheral, 'Drug_Peripheral', 'InitialAmount', 0);

% Add parameters
addparameter(model, 'CL', 1, 'Units', 'L/hr'); % Clearance
addparameter(model, 'Q', 0.5, 'Units', 'L/hr'); % Inter-compartmental clearance
addparameter(model, 'V1', 10, 'Units', 'L'); % Volume of central compartment
addparameter(model, 'V2', 20, 'Units', 'L'); % Volume of peripheral compartment

% Add reactions
addreaction(model, 'Drug_Central -> null', 'ReactionRate', 'CL/V1 * Drug_Central');
addreaction(model, 'Drug_Central <-> Drug_Peripheral', 'ReactionRate', 'Q/V1 * Drug_Central - Q/V2 * Drug_Peripheral');

% Add a dosing regimen
dose = adddose(model, 'BolusDose', 'TargetName', 'Central.Drug_Central');
set(dose, 'Amount', 100, 'Time', 0);

% Simulate the model
[t, x, names] = sbiosimulate(model);

% Plot results
plot(t, x);
xlabel('Time (hours)'); ylabel('Drug Concentration (mg/L)');
legend(names);

Output Example:

Time vs Concentration graph showing drug distribution between compartments and elimination.
    

Example 2: Modeling Tumor Growth with Drug Intervention

In this example, we model tumor growth using a Gompertzian growth model and include the effect of a therapeutic drug that reduces the tumor size.

% Create a SimBiology model
model = sbiomodel('TumorGrowth');

% Add compartments
compartment = addcompartment(model, 'Body', 'Capacity', 1);

% Add species
tumor = addspecies(compartment, 'Tumor', 'InitialAmount', 1); % Initial tumor size
drug = addspecies(compartment, 'Drug', 'InitialAmount', 0); % Drug concentration

% Add parameters
addparameter(model, 'k_g', 0.1, 'Units', '1/day'); % Tumor growth rate
addparameter(model, 'k_d', 0.05, 'Units', '1/day'); % Tumor shrinkage rate
addparameter(model, 'E_max', 0.2, 'Units', '1/day'); % Maximum drug effect
addparameter(model, 'EC50', 1, 'Units', 'mg/L'); % Drug concentration for half-maximal effect

% Add reactions
addreaction(model, 'null -> Tumor', 'ReactionRate', 'k_g * Tumor * log(1/Tumor) - E_max * Drug/(EC50 + Drug) * Tumor');
addreaction(model, 'null -> Drug', 'ReactionRate', '0'); % Placeholder for drug administration

% Add dosing regimen
dose = adddose(model, 'DrugDose', 'TargetName', 'Body.Drug');
set(dose, 'Amount', 10, 'Interval', 7, 'RepeatCount', 10);

% Simulate the model
[t, x, names] = sbiosimulate(model);

% Plot results
subplot(2, 1, 1);
plot(t, x(:,1));
xlabel('Time (days)'); ylabel('Tumor Size');
title('Tumor Growth Over Time');

subplot(2, 1, 2);
plot(t, x(:,2));
xlabel('Time (days)'); ylabel('Drug Concentration');
title('Drug Concentration Over Time');

Output Example:

Two subplots showing (1) Tumor growth dynamics and (2) Drug concentration over time.
    

Example 3: Enzyme Kinetics

In this example, we model a simple Michaelis-Menten enzyme kinetics system where a substrate is converted into a product via an enzyme.

% Create a SimBiology model
model = sbiomodel('EnzymeKinetics');

% Add compartments
compartment = addcompartment(model, 'ReactionSpace', 'Capacity', 1);

% Add species
substrate = addspecies(compartment, 'Substrate', 'InitialAmount', 10);
product = addspecies(compartment, 'Product', 'InitialAmount', 0);
enzyme = addspecies(compartment, 'Enzyme', 'InitialAmount', 1);

% Add parameters
addparameter(model, 'Vmax', 5, 'Units', '1/s');
addparameter(model, 'Km', 2, 'Units', 'mM');

% Add reaction
addreaction(model, 'Substrate -> Product', 'ReactionRate', 'Vmax * Substrate/(Km + Substrate)');

% Simulate the model
[t, x, names] = sbiosimulate(model);

% Plot results
plot(t, x);
xlabel('Time (s)'); ylabel('Concentration (mM)');
legend(names);

Output Example:

Time vs Concentration graph showing substrate depletion and product formation.
    

Useful MATLAB Functions for SimBiology

Function
Explanation
sbiomodel
Creates a new SimBiology model.
addcompartment
Adds a compartment to the model.
addspecies
Adds a species to a compartment.
addreaction
Defines a reaction in the model.
sbiosimulate
Simulates the model.
adddose
Adds a dosing regimen to the model.
getconfigset
Configures simulation settings.

Practice Questions

Test Yourself

1. Create a two-compartment PK model and simulate it.

2. Add a reaction to convert one species into another in a compartment.

3. Simulate a model with multiple doses and plot the results.

4. Extend the two-compartment model to include nonlinear elimination kinetics.

5. Modify the tumor growth model to include resistance to the drug effect.

6. Model a competitive inhibition enzyme reaction and plot the effect of inhibitor concentration on product formation.