Combined Doses in Simfunction

4 次查看(过去 30 天)
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;

采纳的回答

Jeremy Huard
Jeremy Huard 2024-5-6
编辑:Jeremy Huard 2024-5-6
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 个评论
Jeremy Huard
Jeremy Huard 2024-5-6
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 2024-5-6
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);

请先登录,再进行评论。

更多回答(1 个)

Mehdi
Mehdi 2024-4-30
Can anybody help?

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Import Data 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by