Location: Single PASMC model (Gosak et al 2014) @ 2342955c5f05 / Components / assembleModel.m

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2022-04-20 20:29:47+12:00
Desc:
Correct the models and rebuild; Status: the model output is not correct, need to check the parameters.
Permanent Source URI:
https://models.cellml.org/workspace/83f/rawfile/2342955c5f054b3ddf8883e245b20b574acfa8d2/Components/assembleModel.m

load("comp.mat")
% Build models
cmnames=string(extractfield(comp,'name'));
modelnames=cmnames([1:12,19]);
listComp={};
labels=cell(length(modelnames),1);
txtfiles=[];
for i=1:length(modelnames)
    modelname=modelnames(i);
    listComp.name=modelname;
    listComp.def=modelname;
    listComp.from="";
    listComp.impComp="";
    listComp.defaultVars="Y";
    listComp.label=labels{i,1};
    listMap=strings(0,4);
    model=buildModel(modelname,comp,listComp,listMap,idx);
    modelfile=strcat(modelname,'.txt');
    txtfiles=[txtfiles,modelfile];
    writeModel(model,comp,modelfile,idx)
end

modelname="PASMC";
parentnames=cmnames(15);
nm=0;
listComp={};
labels={};
listMap=strings(0,4);
chd=[];
for n=1:length(parentnames)
  icomp=comp(cmnames==parentnames(n));
  chd=[chd;icomp.children];  
end
uni_chd=unique(chd);

for m=1:length(uni_chd)
    ichd=uni_chd(m);   
    listComp(m).name=ichd;
    listComp(m).def=ichd;
    listComp(m).from=strcat(ichd,".cellml");
    listComp(m).impComp=ichd;
    listComp(m).defaultVars="Y";
    listComp(m).label=[]; 
end

for n=1:length(parentnames)
icomp=comp(cmnames==parentnames(n));
chd=icomp.children;
for i=1:length(chd)   
    nm=nm+1;
    ichd=chd(i);    
    listMap(nm,:)=["P",parentnames(n),"C",ichd];
end
m=m+1;
listComp(m).name=parentnames(n);
listComp(m).def=parentnames(n);
listComp(m).from="";
listComp(m).impComp="";
listComp(m).defaultVars="Y";
listComp(m).label=[];
end

listMap_ss=["S","Cai","S","JVOCCi";"S","Cai","S","JNCXi";"S","Cai","S","JSERCAi";"S","Cai","S","JCICRi";"S","Cai","S","JPMCAi";"S","Cai","S","Jleaki";"S","Cai","S","JKi";...
    "S","Casr","S","JSERCAi";"S","Casr","S","JCICRi";"S","Casr","S","Jleaki";...
    "S","Vm","S","JNKAi";"S","Vm","S","JCli";"S","Vm","S","JVOCCi";"S","Vm","S","JNCXi";"S","Vm","S","JKi";"S","Vm","S","JPMCAi";...    
    ];
listMap=[listMap;listMap_ss];
model=buildModel(modelname,comp,listComp,listMap,idx);
modelfile=strcat(modelname,'.txt');
txtfiles=[txtfiles,modelfile];
writeModel(model,comp,modelfile,idx)

modelname="PASMC_test";
listComp={};
m=0;
m=m+1;
listComp(m).name="PASMC";
listComp(m).def="PASMC";
listComp(m).from="../Components/PASMC.cellml";
listComp(m).impComp="PASMC";
listComp(m).defaultVars="Y";
listComp(m).label=[];
m=m+1;
listComp(m).name="output";
listComp(m).def="output";
listComp(m).from="";
listComp(m).impComp="";
listComp(m).defaultVars="Y";
listComp(m).label=[];
m=m+1;
listComp(m).name="clamp_para";
listComp(m).def="clamp_para";
listComp(m).from="";
listComp(m).impComp="";
listComp(m).defaultVars="Y";
listComp(m).label=[];
m=m+1;
listComp(m).name="Para";
listComp(m).def="Para";
listComp(m).from="../Components/Para.cellml";
listComp(m).impComp="Para";
listComp(m).defaultVars="Y";
listComp(m).label=[];
m=m+1;
listComp(m).name="X_clamp_protocol";
listComp(m).def="X_clamp_protocol";
listComp(m).from="../cellLib/Protocols/X_clamp_protocol.cellml";
listComp(m).impComp="X_clamp_protocol";
listComp(m).defaultVars="Y";
listComp(m).label=["X","K_out";"time","t";];
m=m+1;
listComp(m).name="time";
listComp(m).def="time_s";
listComp(m).from="../cellLib/Components/time.cellml";
listComp(m).impComp="time_s";
listComp(m).defaultVars="Y";
listComp(m).label=["time","t";];

listMap=["S","Para","S","PASMC";"S","X_clamp_protocol","S","PASMC";"S","PASMC","S","output";...
   "S","time","S","PASMC";"S","X_clamp_protocol","S","time";"S","time","S","output";...
   "S","clamp_para","S","X_clamp_protocol";"S","X_clamp_protocol","S","output";];

model=buildModel(modelname,comp,listComp,listMap,idx);
modelfile="../Experiments/"+modelname+".txt";
txtfiles=[txtfiles,modelfile];
writeModel(model,comp,modelfile,idx)