main content

object containing expression for post-凯发k8网页登录

object containing expression for post-simulation calculations

since r2020a

description

an observable object is a mathematical expression that lets you perform post-simulation calculations. for example, you can define an observable expression to compute the fraction of a ligand that is bound to a receptor at each time step, or compute some statistics such as area under the curve (auc) of a drug concentration profile. you can also use an observable object as a response in simulation, data fitting, and global sensitivity analysis.

the name of each observable object in a simbiology® model must be unique, meaning no observable object can have the same name as another observable, species, compartment, parameter, reaction, variant, or dose in the model. an observable object can reference any model quantities that are logged (in statestolog). it can also reference other active observable objects provided that the expressions contain no algebraic loops. the object expression can reference simulation time using the variable time. follow the recommended for expression evaluations. for instance, if a quantity name is not a valid matlab® variable name, enclose the name in brackets [] when referring to it in an expression.

simbiology evaluates the object expression using the entire time course of any referenced states or observables. the result of an observable expression must be a numeric scalar or vector. if it is a vector, it must be of the same length as the simulation time vector. the result is stored in the returned simdata object. specifically, if the observable expression is scalar-valued, the result is stored in the simdata.scalarobservables property. otherwise, it is stored in simdata.vectorobservables.

note

  • make sure to correctly vectorize the expressions. for example, use a./(a b) instead of a/(a b) if a and b are matrices.

  • avoid hardcoding expressions that expect any particular number of points or times. for example, instead of using time(1:1000), use time(1:min(1000,numel(time))).

creation

create an observable object using .

properties

mathematical expression of the observable object, specified as a character vector.

example: 'x.^2'

data types: char

units of the observable expression results, specified as a character vector.

example: 'gram'

data types: char

flag indicating whether to evaluate the observable expression after model simulation, specified as true or false.

example: false

data types: logical

object name, specified as a character vector.

example: 'auc'

data types: char

this property is read-only.

parent object of the observable object, specified as a model object.

description of the object, specified as a character vector.

example: 'drug auc'

data types: char

object label, specified as a character vector.

example: 'area under the curve'

data types: char

this property is read-only.

object type, specified as 'observable'.

data types: char

data to associate with the object, specified as any supported matlab data type.

object functions

copy simbiology object and its children
find out how observable object is used in simbiology model
get simbiology object properties
set simbiology object properties
delete simbiology object
display summary of simbiology object
rename object and update expressions

examples

load the .

sbioloadproject tmdd_with_to.sbproj

set the target occupancy (to) as a response.

cs = getconfigset(m1);
cs.runtimeoptions.statestolog = 'to';

get the dosing information.

d = getdose(m1,'daily dose');

scan over different dose amounts using a simbiology.scenarios object. to do so, first parameterize the amount property of the dose. then vary the corresponding parameter value using the scenarios object.

amountparam = addparameter(m1,'amountparam','units',d.amountunits);
d.amount = 'amountparam';
d.active = 1;
dosesamples = simbiology.scenarios('amountparam',linspace(0,300,31));

create a simfunction to simulate the model. set to as the simulation output.

% suppress informational warnings that are issued during simulation.
warning('off','simbiology:simfunction:doses_not_empty');
f = createsimfunction(m1,dosesamples,'to',d)
f = 
simfunction
parameters:
         name          value        type            units    
    _______________    _____    _____________    ____________
    {'amountparam'}      1      {'parameter'}    {'nanomole'}
observables: 
     name         type               units      
    ______    _____________    _________________
    {'to'}    {'parameter'}    {'dimensionless'}
dosed: 
      targetname                 targetdimension                  amount         amountvalue    amountunits 
    _______________    ___________________________________    _______________    ___________    ____________
    {'plasma.drug'}    {'amount (e.g., mole or molecule)'}    {'amountparam'}         1         {'nanomole'}
timeunits: day
warning('on','simbiology:simfunction:doses_not_empty');

simulate the model using the dose amounts generated by the scenarios object. in this case, the object generates 31 different doses; hence the model is simulated 31 times and generates a simdata array.

dosetable = gettable(d);
sd = f(dosesamples,cs.stoptime,dosetable)
 
   simbiology simulation data array: 31-by-1
 
   modelname:        tmdd
   logged data:
     species:        0
     compartment:    0
     parameter:      1
     sensitivity:    0
     observable:     0
 

plot the simulation results. also add two reference lines that represent the safety and efficacy thresholds for to. in this example, suppose that any to value above 0.85 is unsafe, and any to value below 0.15 has no efficacy.

h = sbioplot(sd);
time = sd(1).time;
h.nextplot = 'add';
safetythreshold = plot(h,[min(time), max(time)],[0.85, 0.85],'displayname','safety threshold');
efficacythreshold = plot(h,[min(time), max(time)],[0.15, 0.15],'displayname','efficacy threshold');

figure contains an axes object. the axes object with title states versus time, xlabel time, ylabel states contains 33 objects of type line. these objects represent run 1 - to, run 2 - to, run 3 - to, run 4 - to, run 5 - to, run 6 - to, run 7 - to, run 8 - to, run 9 - to, run 10 - to, run 11 - to, run 12 - to, run 13 - to, run 14 - to, run 15 - to, run 16 - to, run 17 - to, run 18 - to, run 19 - to, run 20 - to, run 21 - to, run 22 - to, run 23 - to, run 24 - to, run 25 - to, run 26 - to, run 27 - to, run 28 - to, run 29 - to, run 30 - to, run 31 - to, safety threshold, efficacy threshold.

postprocess the simulation results. find out which dose amounts are effective, corresponding to the to responses within the safety and efficacy thresholds. to do so, add an observable expression to the simulation data.

% suppress informational warnings that are issued during simulation.
warning('off','simbiology:sbservices:sb_dimanalysisnotdone_matlabfcn_ucon');
newsd = addobservable(sd,'stat1','max(to) < 0.85 & min(to) > 0.15','units','dimensionless')
 
   simbiology simulation data array: 31-by-1
 
   modelname:        tmdd
   logged data:
     species:        0
     compartment:    0
     parameter:      1
     sensitivity:    0
     observable:     1
 

the addobservable function evaluates the new observable expression for each simdata in sd and returns the evaluated results as a new simdata array, newsd, which now has the added observable (stat1).

simbiology stores the observable results in two different properties of a simdata object. if the results are scalar-valued, they are stored in simdata.scalarobservables. otherwise, they are stored in simdata.vectorobservables. in this example, the stat1 observable expression is scalar-valued.

extract the scalar observable values and plot them against the dose amounts.

scalarobs = vertcat(newsd.scalarobservables);
doseamounts = generate(dosesamples);
figure
plot(doseamounts.amountparam,scalarobs.stat1,'o','markerfacecolor','b')

figure contains an axes object. the axes contains a line object which displays its values using only markers.

the plot shows that dose amounts ranging from 50 to 180 nanomoles provide to responses that lie within the target efficacy and safety thresholds.

you can update the observable expression with different threshold amounts. the function recalculates the expression and returns the results in a new simdata object array.

newsd2 = updateobservable(newsd,'stat1','max(to) < 0.75 & min(to) > 0.30');

rename the observable expression. the function renames the observable, updates any expressions that reference the renamed observable (if applicable), and returns the results in a new simdata object array.

newsd3 = renameobservable(newsd2,'stat1','effectivedose');

restore the warning settings.

warning('on','simbiology:sbservices:sb_dimanalysisnotdone_matlabfcn_ucon');

version history

introduced in r2020a

see also

| | |

网站地图