필터 지우기
필터 지우기

Combined Doses in Simfunction

조회 수: 4 (최근 30일)
Mehdi
Mehdi 2024년 4월 25일
댓글: Jeremy Huard 2024년 5월 6일
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