0001 function pathway = constructPathwayFromCelldesigner(inputFile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 ravenPath=findRAVENroot();
0070
0071
0072 cp=pwd;
0073 xt=fullfile(ravenPath,'software','xml_toolbox');
0074
0075
0076 cd(xt);
0077 v = xml_parseany(fileread(inputFile));
0078 cd(cp);
0079
0080
0081 for i=1:length(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}.compartmentAlias)
0082 pathway.listOfCompartments(i).x=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0083 .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.x);
0084 pathway.listOfCompartments(i).y=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0085 .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.y);
0086 pathway.listOfCompartments(i).h=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0087 .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.h);
0088 pathway.listOfCompartments(i).w=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0089 .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.w);
0090 pathway.listOfCompartments(i).compartment=v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0091 .compartmentAlias{1,i}.ATTRIBUTE.compartment;
0092 pathway.listOfCompartments(i).id=v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0093 .compartmentAlias{1,i}.ATTRIBUTE.id;
0094
0095
0096 for j=1:length(v.model{1,1}.listOfCompartments{1,1}.compartment)
0097 if strcmpi(v.model{1,1}.listOfCompartments{1,1}.compartment{1,j}.ATTRIBUTE.id,...
0098 pathway.listOfCompartments(i).compartment)
0099 pathway.listOfCompartments(i).name=v.model{1,1}.listOfCompartments{1,1}.compartment{1,j}.ATTRIBUTE.name;
0100 break;
0101 end
0102 end
0103 end
0104
0105
0106 for i=1:length(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}.speciesAlias)
0107 pathway.listOfSpecies(i).x=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0108 .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.x);
0109 pathway.listOfSpecies(i).y=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0110 .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.y);
0111 pathway.listOfSpecies(i).h=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0112 .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.h);
0113 pathway.listOfSpecies(i).w=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0114 .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.w);
0115 pathway.listOfSpecies(i).alias=v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0116 .speciesAlias{1,i}.ATTRIBUTE.id;
0117 pathway.listOfSpecies(i).species=v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0118 .speciesAlias{1,i}.ATTRIBUTE.species;
0119
0120 for j=1:length(v.model{1,1}.listOfSpecies{1,1}.species)
0121 if strcmpi(v.model{1,1}.listOfSpecies{1,1}.species{1,j}.ATTRIBUTE.id,...
0122 pathway.listOfSpecies(i).species)
0123 pathway.listOfSpecies(i).name=v.model{1,1}.listOfSpecies{1,1}.species{1,j}.ATTRIBUTE.name;
0124 pathway.listOfSpecies(i).type=v.model{1,1}.listOfSpecies{1,1}.species{1,j}.annotation{1,1}...
0125 .speciesIdentity{1,1}.class{1,1}.CONTENT;
0126
0127
0128
0129
0130
0131
0132
0133 if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN')
0134 if isfield(v.model{1,1}.listOfSpecies{1,1}.species{1,j},'notes')
0135 pathway.listOfSpecies(i).note=cellstr(strtrim(v.model{1,1}.listOfSpecies{1,1}.species{1,j}...
0136 .notes{1,1}.html{1,1}.body{1,1}.CONTENT));
0137 end
0138 end
0139 break;
0140 end
0141 end
0142 end
0143
0144
0145 for i=1:length(v.model{1,1}.listOfReactions{1,1}.reaction)
0146
0147
0148 if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.ATTRIBUTE,'reversible')
0149 pathway.listOfReactions(i).reversible=v.model{1,1}.listOfReactions{1,1}...
0150 .reaction{1,i}.ATTRIBUTE.reversible;
0151 else
0152 pathway.listOfReactions(i).reversible='true';
0153 end
0154
0155
0156
0157
0158
0159 baseReactant=v.model{1,1}.listOfReactions{1,1}...
0160 .reaction{1,i}.annotation{1,1}.baseReactants{1,1}.baseReactant{1,1}...
0161 .ATTRIBUTE.alias;
0162
0163
0164 baseProduct=v.model{1,1}.listOfReactions{1,1}...
0165 .reaction{1,i}.annotation{1,1}.baseProducts{1,1}.baseProduct{1,1}...
0166 .ATTRIBUTE.alias;
0167
0168
0169 [x1,y1]=getBindingPos(pathway,baseReactant,...
0170 v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0171 .baseReactants{1,1}.baseReactant{1,1}.linkAnchor{1,1}.ATTRIBUTE.position);
0172 [x2,y2]=getBindingPos(pathway,baseProduct,...
0173 v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0174 .baseProducts{1,1}.baseProduct{1,1}.linkAnchor{1,1}.ATTRIBUTE.position);
0175 pathway.listOfReactions(i).middlePoint(1)=x1+(x2-x1)/2;
0176 pathway.listOfReactions(i).middlePoint(2)=y1+(y2-y1)/2;
0177
0178
0179 counter=1;
0180
0181
0182 pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0183 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseReactants{1,1}...
0184 .baseReactant{1,1}.ATTRIBUTE.alias;
0185 pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0186 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseReactants{1,1}...
0187 .baseReactant{1,1}.ATTRIBUTE.species;
0188 [x,y]=getBindingPos(pathway,baseReactant,v.model{1,1}.listOfReactions{1,1}...
0189 .reaction{1,i}.annotation{1,1}.baseReactants{1,1}.baseReactant{1,1}...
0190 .linkAnchor{1,1}.ATTRIBUTE.position);
0191 pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0192 pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0193 pathway.listOfReactions(i).componentList(counter).baseReactant='true';
0194 pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0195
0196
0197 pathway.listOfReactions(i).componentList(counter).toArrow=...
0198 pathway.listOfReactions(i).reversible;
0199 pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0200 pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0201 counter=counter+1;
0202
0203
0204 pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0205 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseProducts{1,1}...
0206 .baseProduct{1,1}.ATTRIBUTE.alias;
0207 pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0208 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseProducts{1,1}...
0209 .baseProduct{1,1}.ATTRIBUTE.species;
0210 [x,y]=getBindingPos(pathway,baseProduct,v.model{1,1}.listOfReactions{1,1}...
0211 .reaction{1,i}.annotation{1,1}.baseProducts{1,1}.baseProduct{1,1}...
0212 .linkAnchor{1,1}.ATTRIBUTE.position);
0213 pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0214 pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0215 pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0216 pathway.listOfReactions(i).componentList(counter).baseProduct='true';
0217 pathway.listOfReactions(i).componentList(counter).toArrow='true';
0218 pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0219 pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0220 counter=counter+1;
0221
0222
0223
0224 if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0225 ,'listOfReactantLinks')
0226 for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0227 .listOfReactantLinks{1,1}.reactantLink)
0228 pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0229 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0230 .listOfReactantLinks{1,1}.reactantLink{1,j}.ATTRIBUTE.alias;
0231 pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0232 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0233 .listOfReactantLinks{1,1}.reactantLink{1,j}.ATTRIBUTE.reactant;
0234 [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0235 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0236 .listOfReactantLinks{1,1}.reactantLink{1,j}.linkAnchor{1,1}...
0237 .ATTRIBUTE.position);
0238 pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0239 pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0240 pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0241 pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0242 pathway.listOfReactions(i).componentList(counter).toArrow='false';
0243 pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0244 pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0245 counter=counter+1;
0246 end
0247 end
0248
0249
0250
0251 if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0252 ,'listOfProductLinks')
0253 for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0254 .listOfProductLinks{1,1}.productLink)
0255 pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0256 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0257 .listOfProductLinks{1,1}.productLink{1,j}.ATTRIBUTE.alias;
0258 pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0259 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0260 .listOfProductLinks{1,1}.productLink{1,j}.ATTRIBUTE.product;
0261 [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0262 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0263 .listOfProductLinks{1,1}.productLink{1,j}.linkAnchor{1,1}...
0264 .ATTRIBUTE.position);
0265 pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0266 pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0267 pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0268 pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0269 pathway.listOfReactions(i).componentList(counter).toArrow='true';
0270 pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0271 pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0272 counter=counter+1;
0273 end
0274 end
0275
0276
0277 if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0278 ,'listOfModification')
0279 for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0280 .listOfModification{1,1}.modification)
0281 pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0282 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.listOfModification{1,1}...
0283 .modification{1,j}.linkTarget{1,1}.ATTRIBUTE.alias;
0284 pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0285 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.listOfModification{1,1}...
0286 .modification{1,j}.linkTarget{1,1}.ATTRIBUTE.species;
0287 [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0288 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0289 .listOfModification{1,1}.modification{1,j}.linkTarget{1,1}...
0290 .linkAnchor{1,1}.ATTRIBUTE.position);
0291 pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0292 pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0293 pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0294 pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0295 pathway.listOfReactions(i).componentList(counter).toArrow='false';
0296 pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0297 pathway.listOfReactions(i).componentList(counter).type='ENZYME';
0298 counter=counter+1;
0299 end
0300 end
0301 end
0302 end
0303
0304 function [x,y]=getBindingPos(pathway,speciesAlias,bindingSite)
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320 for i=1:length(pathway.listOfSpecies)
0321 if strcmpi(pathway.listOfSpecies(i).alias,speciesAlias)
0322 xpos=pathway.listOfSpecies(i).x;
0323 ypos=pathway.listOfSpecies(i).y;
0324 h=pathway.listOfSpecies(i).h;
0325 w=pathway.listOfSpecies(i).w;
0326
0327
0328
0329
0330 if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN')
0331
0332 if strcmpi(bindingSite,'N')
0333 x=xpos+0.5*w;
0334 y=ypos;
0335 break;
0336 end
0337 if strcmpi(bindingSite,'NNE')
0338 x=xpos+0.75*w;
0339 y=ypos;
0340 break;
0341 end
0342 if strcmpi(bindingSite,'NE')
0343 x=xpos+w;
0344 y=ypos;
0345 break;
0346 end
0347 if strcmpi(bindingSite,'ENE')
0348 x=xpos+w;
0349 y=ypos+0.25*h;
0350 break;
0351 end
0352 if strcmpi(bindingSite,'E')
0353 x=xpos+w;
0354 y=ypos+0.5*h;
0355 break;
0356 end
0357 if strcmpi(bindingSite,'ESE')
0358 x=xpos+w;
0359 y=ypos+0.75*h;
0360 break;
0361 end
0362 if strcmpi(bindingSite,'SE')
0363 x=xpos+w;
0364 y=ypos+h;
0365 break;
0366 end
0367 if strcmpi(bindingSite,'SSE')
0368 x=xpos+0.75*w;
0369 y=ypos+h;
0370 break;
0371 end
0372 if strcmpi(bindingSite,'S')
0373 x=xpos+0.5*w;
0374 y=ypos+h;
0375 break;
0376 end
0377 if strcmpi(bindingSite,'SSW')
0378 x=xpos+0.25*w;
0379 y=ypos+h;
0380 break;
0381 end
0382 if strcmpi(bindingSite,'SW')
0383 x=xpos;
0384 y=ypos+h;
0385 break;
0386 end
0387 if strcmpi(bindingSite,'WSW')
0388 x=xpos;
0389 y=ypos+0.75*h;
0390 break;
0391 end
0392 if strcmpi(bindingSite,'W')
0393 x=xpos;
0394 y=ypos+0.5*h;
0395 break;
0396 end
0397 if strcmpi(bindingSite,'WNW')
0398 x=xpos;
0399 y=ypos+0.25*h;
0400 break;
0401 end
0402 if strcmpi(bindingSite,'NW')
0403 x=xpos;
0404 y=ypos;
0405 break;
0406 end
0407 if strcmpi(bindingSite,'NNW')
0408 x=xpos+0.25*w;
0409 y=ypos;
0410 break;
0411 end
0412 end
0413
0414
0415
0416
0417 if strcmpi(pathway.listOfSpecies(i).type,'SIMPLE_MOLECULE')
0418
0419 centerX=xpos+0.5*w;
0420 centerY=ypos+0.5*h;
0421
0422
0423 if strcmpi(bindingSite,'N')
0424 angle=(4/8)*pi;
0425 end
0426 if strcmpi(bindingSite,'NNE')
0427 angle=(5/8)*pi;
0428 end
0429 if strcmpi(bindingSite,'NE')
0430 angle=(6/8)*pi;
0431 end
0432 if strcmpi(bindingSite,'ENE')
0433 angle=(7/8)*pi;
0434 end
0435 if strcmpi(bindingSite,'E')
0436 angle=(8/8)*pi;
0437 end
0438 if strcmpi(bindingSite,'ESE')
0439 angle=(9/8)*pi;
0440 end
0441 if strcmpi(bindingSite,'SE')
0442 angle=(10/8)*pi;
0443 end
0444 if strcmpi(bindingSite,'SSE')
0445 angle=(11/8)*pi;
0446 end
0447 if strcmpi(bindingSite,'S')
0448 angle=(12/8)*pi;
0449 end
0450 if strcmpi(bindingSite,'SSW')
0451 angle=(13/8)*pi;
0452 end
0453 if strcmpi(bindingSite,'SW')
0454 angle=(14/8)*pi;
0455 end
0456 if strcmpi(bindingSite,'WSW')
0457 angle=(15/8)*pi;
0458 end
0459 if strcmpi(bindingSite,'W')
0460 angle=(16/8)*pi;
0461 end
0462 if strcmpi(bindingSite,'WNW')
0463 angle=(1/8)*pi;
0464 end
0465 if strcmpi(bindingSite,'NW')
0466 angle=(2/8)*pi;
0467 end
0468 if strcmpi(bindingSite,'NNW')
0469 angle=(3/8)*pi;
0470 end
0471 x=centerX-(0.5*w)*cos(angle);
0472 y=centerY-(0.5*h)*sin(angle);
0473 break;
0474 end
0475 end
0476 end
0477 end