Home > RAVEN > constructPathwayFromCelldesigner.m

constructPathwayFromCelldesigner

PURPOSE ^

constructPathwayFromCelldesigner

SYNOPSIS ^

function pathway = constructPathwayFromCelldesigner(inputFile)

DESCRIPTION ^

 constructPathwayFromCelldesigner
    Constructs a pathway structure from a CellDesigner XML file.

    inputFile   string representing the pathway of the Celldesigner XML 
               file

    pathway
       listOfCompartments      structure with information on the compartments
                               in the Celldesigner file
           x                   the x position
           y                   the y position
           h                   the height
           w                   the width
           compartment         string representing the compartment
           id                  alias of the compartment. Used if there are
                               several instances of the same compartment
           name                the name of the compartment
       listOfSpecies           structure with information on each species in
                               the Celldesigner file. Both metabolites and
                               enzymes are species
           x                   the x position
           y                   the y position
           h                   the height
           w                   the width
           species             string representing the species
           alias               alias of the species. Used if the species is
                               present in several places in the map
           name                the name of the species
           type                the type of the species. At the moment only
                               'SIMPLE_MOLECULE' (for metabolites) and
                               'PROTEIN' (for enzymes) are supported
           note                string that can be used on enzymes to link them
                               to the corresponding reaction in a model
       listOfReactions         structure with information on each of the
                               reactions in the Celldesigner file
           reversible          true if the reaction is reversible
           middlePoint         vector with the x and y points of the middle
                               point of the reaction. All reactions are
                               defines as having one reactant and one product.
                               They may also have a number of modifiers (such
                               as cofactors or enzymes). Each of these
                               modifiers are drawn as being connected to the
                               middle point. The middle point is calculated
                               from the positions of the reactant and the
                               product
           componentList       structure with information on the reactant,
                               product, and modifiers of the reaction
               alias           string representing the alias of the
                               species. Corresponds to the alias in
                               listOfSpecies
               species         string representing the species.
                               Corresponds to the species in listOfSpecies
               anchor          vector with the x and y points of the
                               connecting point of the species
               baseReaction    true if the species is the base reactant
               baseProduct     true if the species is the base product
               toArrow         true if the line connecting the species
                               to the middle point should start with an
                               arrow
               fromArrow       true if the line connecting the species
                               to the middle point should end with an
                               arrow
               type            'METABOLITE' or 'ENZYME'

    Usage: pathway = constructPathwayFromCelldesigner(inputFile)

   Rasmus Agren, 2010-12-16

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function pathway = constructPathwayFromCelldesigner(inputFile)
0002 % constructPathwayFromCelldesigner
0003 %    Constructs a pathway structure from a CellDesigner XML file.
0004 %
0005 %    inputFile   string representing the pathway of the Celldesigner XML
0006 %               file
0007 %
0008 %    pathway
0009 %       listOfCompartments      structure with information on the compartments
0010 %                               in the Celldesigner file
0011 %           x                   the x position
0012 %           y                   the y position
0013 %           h                   the height
0014 %           w                   the width
0015 %           compartment         string representing the compartment
0016 %           id                  alias of the compartment. Used if there are
0017 %                               several instances of the same compartment
0018 %           name                the name of the compartment
0019 %       listOfSpecies           structure with information on each species in
0020 %                               the Celldesigner file. Both metabolites and
0021 %                               enzymes are species
0022 %           x                   the x position
0023 %           y                   the y position
0024 %           h                   the height
0025 %           w                   the width
0026 %           species             string representing the species
0027 %           alias               alias of the species. Used if the species is
0028 %                               present in several places in the map
0029 %           name                the name of the species
0030 %           type                the type of the species. At the moment only
0031 %                               'SIMPLE_MOLECULE' (for metabolites) and
0032 %                               'PROTEIN' (for enzymes) are supported
0033 %           note                string that can be used on enzymes to link them
0034 %                               to the corresponding reaction in a model
0035 %       listOfReactions         structure with information on each of the
0036 %                               reactions in the Celldesigner file
0037 %           reversible          true if the reaction is reversible
0038 %           middlePoint         vector with the x and y points of the middle
0039 %                               point of the reaction. All reactions are
0040 %                               defines as having one reactant and one product.
0041 %                               They may also have a number of modifiers (such
0042 %                               as cofactors or enzymes). Each of these
0043 %                               modifiers are drawn as being connected to the
0044 %                               middle point. The middle point is calculated
0045 %                               from the positions of the reactant and the
0046 %                               product
0047 %           componentList       structure with information on the reactant,
0048 %                               product, and modifiers of the reaction
0049 %               alias           string representing the alias of the
0050 %                               species. Corresponds to the alias in
0051 %                               listOfSpecies
0052 %               species         string representing the species.
0053 %                               Corresponds to the species in listOfSpecies
0054 %               anchor          vector with the x and y points of the
0055 %                               connecting point of the species
0056 %               baseReaction    true if the species is the base reactant
0057 %               baseProduct     true if the species is the base product
0058 %               toArrow         true if the line connecting the species
0059 %                               to the middle point should start with an
0060 %                               arrow
0061 %               fromArrow       true if the line connecting the species
0062 %                               to the middle point should end with an
0063 %                               arrow
0064 %               type            'METABOLITE' or 'ENZYME'
0065 %
0066 %    Usage: pathway = constructPathwayFromCelldesigner(inputFile)
0067 %
0068 %   Rasmus Agren, 2010-12-16
0069 %
0070 
0071 %Loads the specified xml file using XML Toolbox
0072 [ST I]=dbstack('-completenames');
0073 ravenPath=fileparts(ST(I).file);
0074 
0075 %Current path and xml toolbox path
0076 cp=pwd;
0077 xt=fullfile(ravenPath,'software','xml_toolbox');
0078 
0079 %Change path, run the script and change back
0080 cd(xt);
0081 v = xml_parseany(fileread(inputFile));
0082 cd(cp);
0083 
0084 %Saves information on each compartment
0085 for i=1:length(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}.compartmentAlias)
0086    pathway.listOfCompartments(i).x=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0087        .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.x);
0088    pathway.listOfCompartments(i).y=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0089        .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.y);
0090    pathway.listOfCompartments(i).h=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0091        .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.h);
0092    pathway.listOfCompartments(i).w=str2double(v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0093        .compartmentAlias{1,i}.bounds{1,1}.ATTRIBUTE.w);
0094    pathway.listOfCompartments(i).compartment=v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0095        .compartmentAlias{1,i}.ATTRIBUTE.compartment;
0096    pathway.listOfCompartments(i).id=v.model{1,1}.annotation{1,1}.listOfCompartmentAliases{1,1}...
0097        .compartmentAlias{1,i}.ATTRIBUTE.id;
0098    
0099   %Finds the name of the compartment
0100   for j=1:length(v.model{1,1}.listOfCompartments{1,1}.compartment)
0101      if strcmpi(v.model{1,1}.listOfCompartments{1,1}.compartment{1,j}.ATTRIBUTE.id,...
0102              pathway.listOfCompartments(i).compartment)
0103         pathway.listOfCompartments(i).name=v.model{1,1}.listOfCompartments{1,1}.compartment{1,j}.ATTRIBUTE.name;
0104         break;
0105      end
0106   end
0107 end
0108 
0109 %Saves information on each species and enzyme
0110 for i=1:length(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}.speciesAlias)
0111    pathway.listOfSpecies(i).x=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0112        .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.x);
0113    pathway.listOfSpecies(i).y=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0114        .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.y);
0115    pathway.listOfSpecies(i).h=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0116        .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.h);
0117    pathway.listOfSpecies(i).w=str2double(v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0118        .speciesAlias{1,i}.bounds{1,1}.ATTRIBUTE.w);
0119    pathway.listOfSpecies(i).alias=v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0120        .speciesAlias{1,i}.ATTRIBUTE.id;  
0121    pathway.listOfSpecies(i).species=v.model{1,1}.annotation{1,1}.listOfSpeciesAliases{1,1}...
0122        .speciesAlias{1,i}.ATTRIBUTE.species;
0123   %Find the name and type of the species/enzyme
0124   for j=1:length(v.model{1,1}.listOfSpecies{1,1}.species)
0125      if strcmpi(v.model{1,1}.listOfSpecies{1,1}.species{1,j}.ATTRIBUTE.id,...
0126              pathway.listOfSpecies(i).species)
0127         pathway.listOfSpecies(i).name=v.model{1,1}.listOfSpecies{1,1}.species{1,j}.ATTRIBUTE.name;
0128         pathway.listOfSpecies(i).type=v.model{1,1}.listOfSpecies{1,1}.species{1,j}.annotation{1,1}...
0129             .speciesIdentity{1,1}.class{1,1}.CONTENT;
0130         
0131         %The Celldesigner chart can be linked to a model (e.g. for
0132         %visualization of fluxes) by making a note in Celldesigner for the
0133         %protein in interest (this can only be done for proteins at the
0134         %moment). The note (not protein note!) should only contain the
0135         %reaction id in the model which corresponds to the protein
0136         %in Celldesigner.
0137         if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN')
0138            if isfield(v.model{1,1}.listOfSpecies{1,1}.species{1,j},'notes')
0139                pathway.listOfSpecies(i).note=cellstr(strtrim(v.model{1,1}.listOfSpecies{1,1}.species{1,j}...
0140                    .notes{1,1}.html{1,1}.body{1,1}.CONTENT));
0141            end
0142         end
0143         break;
0144      end
0145   end
0146 end
0147 
0148 %Saves information on each reaction
0149 for i=1:length(v.model{1,1}.listOfReactions{1,1}.reaction)
0150     %This is because it is standard for a reaction to be defined as
0151     %reversible
0152     if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.ATTRIBUTE,'reversible')
0153         pathway.listOfReactions(i).reversible=v.model{1,1}.listOfReactions{1,1}...
0154             .reaction{1,i}.ATTRIBUTE.reversible;
0155     else
0156         pathway.listOfReactions(i).reversible='true';
0157     end
0158     
0159     %NOTE: As far as I know there can only be one base reactant/product per
0160     %reaction. This method is written with that assumption.
0161     
0162     %Finds the alias of the base reactant
0163     baseReactant=v.model{1,1}.listOfReactions{1,1}...
0164         .reaction{1,i}.annotation{1,1}.baseReactants{1,1}.baseReactant{1,1}...
0165         .ATTRIBUTE.alias;
0166     
0167     %Finds the alias of the base product
0168     baseProduct=v.model{1,1}.listOfReactions{1,1}...
0169         .reaction{1,i}.annotation{1,1}.baseProducts{1,1}.baseProduct{1,1}...
0170         .ATTRIBUTE.alias;
0171     
0172     %Saves the middle point
0173     [x1,y1]=getBindingPos(pathway,baseReactant,...
0174         v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0175         .baseReactants{1,1}.baseReactant{1,1}.linkAnchor{1,1}.ATTRIBUTE.position);
0176     [x2,y2]=getBindingPos(pathway,baseProduct,...
0177         v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0178         .baseProducts{1,1}.baseProduct{1,1}.linkAnchor{1,1}.ATTRIBUTE.position);
0179     pathway.listOfReactions(i).middlePoint(1)=x1+(x2-x1)/2;
0180     pathway.listOfReactions(i).middlePoint(2)=y1+(y2-y1)/2;
0181     
0182     %Saves information on each of the components
0183     counter=1; %Keeps track of where in componentList to add a component
0184     
0185     %Adds the base reactant
0186     pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0187         .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseReactants{1,1}...
0188         .baseReactant{1,1}.ATTRIBUTE.alias;
0189     pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0190         .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseReactants{1,1}...
0191         .baseReactant{1,1}.ATTRIBUTE.species;
0192     [x,y]=getBindingPos(pathway,baseReactant,v.model{1,1}.listOfReactions{1,1}...
0193         .reaction{1,i}.annotation{1,1}.baseReactants{1,1}.baseReactant{1,1}...
0194         .linkAnchor{1,1}.ATTRIBUTE.position);
0195     pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0196     pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0197     pathway.listOfReactions(i).componentList(counter).baseReactant='true';
0198     pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0199     
0200     %toArrow should be true if the reaction is reversible
0201     pathway.listOfReactions(i).componentList(counter).toArrow=...
0202         pathway.listOfReactions(i).reversible;
0203     pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0204     pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0205     counter=counter+1;
0206     
0207     %Adds the base product
0208     pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0209         .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseProducts{1,1}...
0210         .baseProduct{1,1}.ATTRIBUTE.alias;
0211     pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0212         .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.baseProducts{1,1}...
0213         .baseProduct{1,1}.ATTRIBUTE.species;
0214     [x,y]=getBindingPos(pathway,baseProduct,v.model{1,1}.listOfReactions{1,1}...
0215         .reaction{1,i}.annotation{1,1}.baseProducts{1,1}.baseProduct{1,1}...
0216         .linkAnchor{1,1}.ATTRIBUTE.position);
0217     pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0218     pathway.listOfReactions(i).componentList(counter).anchor(2)=y;    
0219     pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0220     pathway.listOfReactions(i).componentList(counter).baseProduct='true';
0221     pathway.listOfReactions(i).componentList(counter).toArrow='true';
0222     pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0223     pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0224     counter=counter+1;
0225         
0226     %Adds the non-base reactants
0227     %Not all reactions have any non-base reactants
0228     if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0229             ,'listOfReactantLinks')
0230         for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0231                 .listOfReactantLinks{1,1}.reactantLink)
0232             pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0233                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0234                 .listOfReactantLinks{1,1}.reactantLink{1,j}.ATTRIBUTE.alias;
0235             pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0236                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0237                 .listOfReactantLinks{1,1}.reactantLink{1,j}.ATTRIBUTE.reactant;
0238             [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0239                 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0240                 .listOfReactantLinks{1,1}.reactantLink{1,j}.linkAnchor{1,1}...
0241                 .ATTRIBUTE.position);
0242             pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0243             pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0244             pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0245             pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0246             pathway.listOfReactions(i).componentList(counter).toArrow='false';
0247             pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0248             pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0249             counter=counter+1;
0250         end
0251     end
0252     
0253     %Adds the non-base products
0254     %Not all reactions have any non-base products
0255     if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0256             ,'listOfProductLinks')
0257         for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0258                 .listOfProductLinks{1,1}.productLink)
0259             pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0260                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0261                 .listOfProductLinks{1,1}.productLink{1,j}.ATTRIBUTE.alias;
0262             pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0263                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0264                 .listOfProductLinks{1,1}.productLink{1,j}.ATTRIBUTE.product;
0265             [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0266                 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0267                 .listOfProductLinks{1,1}.productLink{1,j}.linkAnchor{1,1}...
0268                 .ATTRIBUTE.position);
0269             pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0270             pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0271             pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0272             pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0273             pathway.listOfReactions(i).componentList(counter).toArrow='true';
0274             pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0275             pathway.listOfReactions(i).componentList(counter).type='METABOLITE';
0276             counter=counter+1;
0277         end
0278     end
0279     
0280     %Adds the modifiers (enzymes)
0281     %Not all reactions have any modifiers
0282     if isfield(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0283             ,'listOfModification')
0284         for j=1:length(v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0285                 .listOfModification{1,1}.modification)
0286             pathway.listOfReactions(i).componentList(counter).alias=v.model{1,1}...
0287                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.listOfModification{1,1}...
0288                 .modification{1,j}.linkTarget{1,1}.ATTRIBUTE.alias;
0289             pathway.listOfReactions(i).componentList(counter).species=v.model{1,1}...
0290                 .listOfReactions{1,1}.reaction{1,i}.annotation{1,1}.listOfModification{1,1}...
0291                 .modification{1,j}.linkTarget{1,1}.ATTRIBUTE.species;
0292             [x,y]=getBindingPos(pathway,pathway.listOfReactions(i).componentList(counter).alias...
0293                 ,v.model{1,1}.listOfReactions{1,1}.reaction{1,i}.annotation{1,1}...
0294                 .listOfModification{1,1}.modification{1,j}.linkTarget{1,1}...
0295                 .linkAnchor{1,1}.ATTRIBUTE.position);
0296             pathway.listOfReactions(i).componentList(counter).anchor(1)=x;
0297             pathway.listOfReactions(i).componentList(counter).anchor(2)=y;
0298             pathway.listOfReactions(i).componentList(counter).baseReactant='false';
0299             pathway.listOfReactions(i).componentList(counter).baseProduct='false';
0300             pathway.listOfReactions(i).componentList(counter).toArrow='false';
0301             pathway.listOfReactions(i).componentList(counter).fromArrow='false';
0302             pathway.listOfReactions(i).componentList(counter).type='ENZYME';
0303             counter=counter+1;
0304         end
0305     end
0306 end
0307 
0308 function [x,y]=getBindingPos(pathway,speciesAlias,bindingSite)
0309 % getBindingPos
0310 %   Calculates the position of a given binding site for a specified species
0311 %
0312 %   pathway         the pathway structure which should be modified
0313 %   speciesAlias    the alias of the species
0314 %   bindingSite     The binding site in Celldesigner is a string of up to
0315 %                   three letters that defines which of the 16 bindings
0316 %                   sites on each species to use. They are written as
0317 %                   N (north), NNW (north north west) and so on
0318 %
0319 %   [x, y]          The position of the binding site for the species
0320 %
0321 %   Usage: [x,y]=getBindingPos(pathway,speciesAlias,bindingSite)
0322 %
0323 %   Rasmus Ågren, 2010-12-16
0324 %
0325 
0326 %Find the species
0327 for i=1:length(pathway.listOfSpecies)
0328    if strcmpi(pathway.listOfSpecies(i).alias,speciesAlias)
0329        xpos=pathway.listOfSpecies(i).x;
0330        ypos=pathway.listOfSpecies(i).y;
0331        h=pathway.listOfSpecies(i).h;
0332        w=pathway.listOfSpecies(i).w;
0333        
0334        %Species marked as "PROTEIN" should be drawn as rectangles. There is
0335        %one binding site in each corner and three in between on each side.
0336        if strcmpi(pathway.listOfSpecies(i).type,'PROTEIN')
0337            %The binding sites clockwise from the top position
0338            if strcmpi(bindingSite,'N')
0339               x=xpos+0.5*w;
0340               y=ypos;
0341               break;
0342            end
0343            if strcmpi(bindingSite,'NNE')
0344               x=xpos+0.75*w;
0345               y=ypos;
0346               break;
0347            end
0348            if strcmpi(bindingSite,'NE')
0349               x=xpos+w;
0350               y=ypos;
0351               break;
0352            end
0353            if strcmpi(bindingSite,'ENE')
0354               x=xpos+w;
0355               y=ypos+0.25*h;
0356               break;
0357            end
0358            if strcmpi(bindingSite,'E')
0359               x=xpos+w;
0360               y=ypos+0.5*h;
0361               break;
0362            end
0363            if strcmpi(bindingSite,'ESE')
0364               x=xpos+w;
0365               y=ypos+0.75*h;
0366               break;
0367            end
0368            if strcmpi(bindingSite,'SE')
0369               x=xpos+w;
0370               y=ypos+h;
0371               break;
0372            end
0373            if strcmpi(bindingSite,'SSE')
0374               x=xpos+0.75*w;
0375               y=ypos+h;
0376               break;
0377            end
0378            if strcmpi(bindingSite,'S')
0379               x=xpos+0.5*w;
0380               y=ypos+h;
0381               break;
0382            end
0383            if strcmpi(bindingSite,'SSW')
0384               x=xpos+0.25*w;
0385               y=ypos+h;
0386               break;
0387            end
0388            if strcmpi(bindingSite,'SW')
0389               x=xpos;
0390               y=ypos+h;
0391               break;
0392            end
0393            if strcmpi(bindingSite,'WSW')
0394               x=xpos;
0395               y=ypos+0.75*h;
0396               break;
0397            end
0398            if strcmpi(bindingSite,'W')
0399               x=xpos;
0400               y=ypos+0.5*h;
0401               break;
0402            end
0403            if strcmpi(bindingSite,'WNW')
0404               x=xpos;
0405               y=ypos+0.25*h;
0406               break;
0407            end
0408            if strcmpi(bindingSite,'NW')
0409               x=xpos;
0410               y=ypos;
0411               break;
0412            end
0413            if strcmpi(bindingSite,'NNW')
0414               x=xpos+0.25*w;
0415               y=ypos;
0416               break;
0417            end
0418        end
0419        
0420        %Species marked as "SIMPLE_MOLECULE" should be drawn as ellipses.
0421        %There is one binding site in each extreme point and three in
0422        %between on each side
0423        if strcmpi(pathway.listOfSpecies(i).type,'SIMPLE_MOLECULE')
0424            %Find the center of the ellipse
0425            centerX=xpos+0.5*w;
0426            centerY=ypos+0.5*h;
0427            
0428            %The binding sites clockwise from the top position
0429            if strcmpi(bindingSite,'N')
0430               angle=(4/8)*pi;
0431            end
0432            if strcmpi(bindingSite,'NNE')
0433               angle=(5/8)*pi;
0434            end
0435            if strcmpi(bindingSite,'NE')
0436               angle=(6/8)*pi;
0437            end
0438            if strcmpi(bindingSite,'ENE')
0439               angle=(7/8)*pi;
0440            end
0441            if strcmpi(bindingSite,'E')
0442               angle=(8/8)*pi;
0443            end
0444            if strcmpi(bindingSite,'ESE')
0445               angle=(9/8)*pi;
0446            end
0447            if strcmpi(bindingSite,'SE')
0448               angle=(10/8)*pi;
0449            end
0450            if strcmpi(bindingSite,'SSE')
0451               angle=(11/8)*pi;
0452            end
0453            if strcmpi(bindingSite,'S')
0454               angle=(12/8)*pi;
0455            end
0456            if strcmpi(bindingSite,'SSW')
0457               angle=(13/8)*pi;
0458            end
0459            if strcmpi(bindingSite,'SW')
0460               angle=(14/8)*pi;
0461            end
0462            if strcmpi(bindingSite,'WSW')
0463               angle=(15/8)*pi;
0464            end
0465            if strcmpi(bindingSite,'W')
0466               angle=(16/8)*pi;
0467            end
0468            if strcmpi(bindingSite,'WNW')
0469               angle=(1/8)*pi;
0470            end
0471            if strcmpi(bindingSite,'NW')
0472               angle=(2/8)*pi;
0473            end
0474            if strcmpi(bindingSite,'NNW')
0475               angle=(3/8)*pi;
0476            end
0477            x=centerX-(0.5*w)*cos(angle);
0478            y=centerY-(0.5*h)*sin(angle);
0479            break;
0480        end
0481    end
0482 end

Generated on Tue 23-Apr-2013 15:18:37 by m2html © 2005