Combined Doses in Simfunction

4 vues (au cours des 30 derniers jours)
Mehdi
Mehdi le 25 Avr 2024
Commenté : Jeremy Huard le 6 Mai 2024
Hi. I have the code below with two different target for dosing. I plan to use different values (input in the code for different doses) for thoses targets and use simFunction. How should I modify the code. Thanks
setup; %(I build the model here)
params ={'dose_amount','dose_amounta'};
Titles = {'plasma', 'lung','liver','kidney','muscle', 'skin','adipose','bone', 'brain','heart','spleen','pancreas','tumor'};
obs = {'V_tum'};
for i = 1:length(Titles)
Title = Titles{i};
entryAb =['CAb_' Title];
entryADC =['CADC_' Title];
entryPL =['CPL_' Title];
entryPLun =['CPLun_' Title];
obs = [obs;entryAb;entryADC;entryPL;entryPLun];
end
dis=linspace(5,70,numTumors);
for tumNum = 1:numTumors
entryTVR ={sprintf('TVR_tum%d',tumNum)};
entryAb ={sprintf('Ab_tum%d',tumNum)};
entryADC ={sprintf('ADC_tum%d',tumNum)};
entryPL ={sprintf('PL_tum%d',tumNum)};
entryPLun ={sprintf('PLun_tum%d',tumNum)};
obs = [obs;entryTVR; entryAb;entryADC;entryPL;entryPLun];
end
input = [0.5 0;0.5 0.5]*1E6*sbioselect(model, 'Name','BW').value/sbioselect(model, 'Name','MW_ADC').value;
sfxn = createSimFunction(model, params, obs, {'plasma.ADC_plasma','plasma.Ab_plasma'},'UseParallel',true,'AutoAccelerate',false);
doseTable = getTable(d1);
doseTable1 = getTable(d2);
doseTables = [doseTable, doseTable1];
simData = sfxn(input,configsetObj.StopTime,doseTables);
%% Doses
d1 = sbiodose('d1', 'repeat');
d1.Amount = 'dose_amount';
d1.AmountUnits = 'nanomole';
d1.Interval = 'dose_interval';
d1.RepeatCount = 'dose_repeat';
d1.TargetName = 'plasma.ADC_plasma';
d1.StartTime = 0;
d1.TimeUnits=configsetObj.TimeUnits;
d2 = sbiodose('d2', 'repeat');
d2.Amount = 'dose_amounta';
d2.AmountUnits = 'nanomole';
d2.Interval = 'dose_intervala';
d2.RepeatCount = 'dose_repeata';
d2.TargetName = 'plasma.Ab_plasma';
d2.StartTime = 0;
d2.TimeUnits=configsetObj.TimeUnits;

Réponse acceptée

Jeremy Huard
Jeremy Huard le 6 Mai 2024
Modifié(e) : Jeremy Huard le 6 Mai 2024
Hi @Mehdi,
If you want to use both doses for each simulation run, you will need a cell array of size 1xN, where N is the number of doses (here N=2).
You can refer to this doc page to learn about how to use SimFunction.
So, your code could look like this:
setup; %(I build the model here)
params ={'dose_amount','dose_amounta'};
Titles = {'plasma', 'lung','liver','kidney','muscle', 'skin','adipose','bone', 'brain','heart','spleen','pancreas','tumor'};
obs = "V_tum";
Titles = Titles(:); % make it column vector
obs_temp1 = ["CAb","CADC","CDL","CPLun"]; % keep it row vector
obs_temp1 = obs_temp1 + "_" + Titles;
obs_temp2 = ["TVR_tum";"Ab_tum";"ADC_tum";"PL_tum";"PLun_tum"]; % row vector
obs_temp2 = obs_temp2 + (1:numTumors);
obs = [obs; obs_temp1(:); obs_temp2(:)];
dis=linspace(5,70,numTumors);
%% Doses
d1 = sbiodose('d1', 'repeat');
d1.Amount = 'dose_amount';
d1.AmountUnits = 'nanomole';
d1.Interval = 'dose_interval';
d1.RepeatCount = 'dose_repeat';
d1.TargetName = 'plasma.ADC_plasma';
d1.StartTime = 0;
d1.TimeUnits=configsetObj.TimeUnits;
d2 = sbiodose('d2', 'repeat');
d2.Amount = 'dose_amounta';
d2.AmountUnits = 'nanomole';
d2.Interval = 'dose_intervala';
d2.RepeatCount = 'dose_repeata';
d2.TargetName = 'plasma.Ab_plasma';
d2.StartTime = 0;
d2.TimeUnits=configsetObj.TimeUnits;
doses = [d1,d2];
%%
input = [0.5 0;0.5 0.5]*1E6*sbioselect(model, 'Name','BW').value/sbioselect(model, 'Name','MW_ADC').value;
sfxn = createSimFunction(model, params, obs, doses,'UseParallel',true,'AutoAccelerate',false);
doseTables = getTable(doses);
simData = sfxn(input,configsetObj.StopTime,doseTables);
Note that I use strings to build the observable names.
EDIT: changed code to use the doses array.
  3 commentaires
Jeremy Huard
Jeremy Huard le 6 Mai 2024
I had not seen that your doses are parameterized doses, namely their amounts is defined with a parameter.
For SimBiology to know that the dose are parameterized, you will need to pass the dose objects to createSimFunction and not the dose targets:
sfxn = createSimFunction(model, params, obs,[d1,d2],'UseParallel',true,'AutoAccelerate',false);
Jeremy Huard
Jeremy Huard le 6 Mai 2024
Btw, you can make the code more compact with the following:
doses = [d1,d2];
sfxn = createSimFunction(model, params, obs, doses,'UseParallel',true,'AutoAccelerate',false);
doseTables = getTable(doses);

Connectez-vous pour commenter.

Plus de réponses (1)

Mehdi
Mehdi le 30 Avr 2024
Can anybody help?

Communautés

Plus de réponses dans  SimBiology Community

Catégories

En savoir plus sur Scan Parameter Ranges dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by