Tutorial on two romatic hearts: Difference between revisions

From BanghamLab
Jump to navigation Jump to search
(Created page with 'Back to GFtbox Tutorial pages<br><br> We illustrate the practical advantage of having submodels within a project and we illustrate an important conseque…')
 
No edit summary
Line 14: Line 14:
|- valign="top"
|- valign="top"
|}
|}
<span style="color: CornflowerBlue">Section 1</span>
function m = gpt_twowayheart_20110531( m )
<span style="color: Green">%m = gpt_twowayheart_20110531( m )</span>
<span style="color: Green">%  Morphogen interaction function.</span>
<span style="color: Green">%  Written at 2011-05-31 19:51:32.</span>
<span style="color: Green">%  GFtbox revision 3548, 2011-05-31 14:37:10.747930.</span>
<span style="color: Green">% The user may edit any part of this function between delimiters</span>
<span style="color: Green">% of the form "USER CODE..." and "END OF USER CODE...".  The</span>
<span style="color: Green">% delimiters themselves must not be moved, edited, deleted, or added.</span>
    if isempty(m), return; end
    fprintf( 1, '<span style="color: Green">%s found in %s\n', mfilename(), which(mfilename()) );</span>
    try
        m = local_setproperties( m );
    catch
    end
    realtime = m.globalDynamicProps.currenttime;
<span style="color: CornflowerBlue">Section 2</span>
<span style="color: Green">%%% USER CODE: INITIALISATION</span>
<span style="color: Green">% In this section you may modify the mesh in any way whatsoever.</span>
    if (Steps(m)==0) && m.globalDynamicProps.doinit <span style="color: Green">% First iteration</span>
        <span style="color: Green">% Set up names for variant models.  Useful for running multiple models on a cluster.</span>
        m.userdata.ranges.modelname.range = { 'PolariserBased', 'DifferentialGrowthBased' };  <span style="color: Green">% CLUSTER</span>
        <span style="color: Crimson"> m.userdata.ranges.modelname.index = 1;  </span>                    <span style="color: Green">% CLUSTER</span>
    end
    modelname = m.userdata.ranges.modelname.range{m.userdata.ranges.modelname.index};  <span style="color: Green">% CLUSTER</span>
    disp(sprintf('\nRunning <span style="color: Green">%s model %s\n',mfilename, modelname));</span>
   
    <span style="color: Green">% Set priorities for simultaneous plotting of multiple morphogens, if desired.</span>
    m = leaf_mgen_plotpriority( m, {'ID_PLUSORG', 'ID_MINUSORG'}, [1,2], [0.4,0.4] );
    <span style="color: Green">% Set colour of polariser gradient arrows.</span>
    m = leaf_plotoptions(m,'highgradcolor',[0,0,0],'lowgradcolor',[1,0,0]);
    m = leaf_plotoptions(m,'decorscale',1.5);
    <span style="color: Green">% setup a multiplot of the following morphogens</span>
    m = leaf_plotoptions( m, 'morphogen', {'V_KAREAL','ID_PLUSORG','ID_MINUSORG'});
<span style="color: Green">%%% END OF USER CODE: INITIALISATION</span>
<span style="color: CornflowerBlue">Section 3</span>
<span style="color: Green">%%% SECTION 1: ACCESSING MORPHOGENS AND TIME.</span>
<span style="color: Green">%%% AUTOMATICALLY GENERATED CODE: DO NOT EDIT.</span>
    if isempty(m), return; end
    setGlobals();
    global gNEW_KA_PAR gNEW_KA_PER gNEW_KB_PAR gNEW_KB_PER
    global gNEW_K_NOR gNEW_POLARISER gNEW_STRAINRET gNEW_ARREST
    dt = m.globalProps.timestep;
    polariser_i = gNEW_POLARISER;
    P = m.morphogens(:,polariser_i);
    [kapar_i,kapar_p,kapar_a,kapar_l] = getMgenLevels( m, 'KAPAR' );
    [kaper_i,kaper_p,kaper_a,kaper_l] = getMgenLevels( m, 'KAPER' );
    [kbpar_i,kbpar_p,kbpar_a,kbpar_l] = getMgenLevels( m, 'KBPAR' );
    [kbper_i,kbper_p,kbper_a,kbper_l] = getMgenLevels( m, 'KBPER' );
    [knor_i,knor_p,knor_a,knor_l] = getMgenLevels( m, 'KNOR' );
    [strainret_i,strainret_p,strainret_a,strainret_l] = getMgenLevels( m, 'STRAINRET' );
    [arrest_i,arrest_p,arrest_a,arrest_l] = getMgenLevels( m, 'ARREST' );
    [id_plusorg_i,id_plusorg_p,id_plusorg_a,id_plusorg_l] = getMgenLevels( m, 'ID_PLUSORG' );
    [id_minusorg_i,id_minusorg_p,id_minusorg_a,id_minusorg_l] = getMgenLevels( m, 'ID_MINUSORG' );
    [v_kareal_i,v_kareal_p,v_kareal_a,v_kareal_l] = getMgenLevels( m, 'V_KAREAL' );
    [id_tip_i,id_tip_p,id_tip_a,id_tip_l] = getMgenLevels( m, 'ID_TIP' );
    [id_top_i,id_top_p,id_top_a,id_top_l] = getMgenLevels( m, 'ID_TOP' );
    [s_growth_i,s_growth_p,s_growth_a,s_growth_l] = getMgenLevels( m, 'S_GROWTH' );
    [id_mid_i,id_mid_p,id_mid_a,id_mid_l] = getMgenLevels( m, 'ID_MID' );
<span style="color: Green">% Mesh type: circle</span>
<span style="color: Green">%          centre: 0</span>
<span style="color: Green">%      circumpts: 24</span>
<span style="color: Green">%      coneangle: 0</span>
<span style="color: Green">%        dealign: 0</span>
<span style="color: Green">%          height: 0</span>
<span style="color: Green">%        innerpts: 0</span>
<span style="color: Green">%      randomness: 0.1</span>
<span style="color: Green">%          rings: 4</span>
<span style="color: Green">%        version: 1</span>
<span style="color: Green">%          xwidth: 2</span>
<span style="color: Green">%          ywidth: 2</span>
<span style="color: Green">%            Morphogen  Diffusion  Decay  Dilution  Mutant</span>
<span style="color: Green">%            -------------------------------------------------</span>
<span style="color: Green">%                KAPAR        ----    ----      ----    ----</span>
<span style="color: Green">%                KAPER        ----    ----      ----    ----</span>
<span style="color: Green">%                KBPAR        ----    ----      ----    ----</span>
<span style="color: Green">%                KBPER        ----    ----      ----    ----</span>
<span style="color: Green">%                KNOR        ----    ----      ----    ----</span>
<span style="color: Green">%            POLARISER        0.1    ----      ----    ----</span>
<span style="color: Green">%            STRAINRET        ----    ----      ----    ----</span>
<span style="color: Green">%              ARREST        ----    ----      ----    ----</span>
<span style="color: Green">%          ID_PLUSORG        ----    ----      ----    ----</span>
<span style="color: Green">%          ID_MINUSORG        ----    ----      ----    ----</span>
<span style="color: Green">%            V_KAREAL        ----    ----      ----    ----</span>
<span style="color: Green">%              ID_TIP        ----    ----      ----    ----</span>
<span style="color: Green">%              ID_TOP        ----    ----      ----    ----</span>
<span style="color: Green">%            S_GROWTH        0.01    ----      ----    ----</span>
<span style="color: Green">%              ID_MID        ----    ----      ----    ----</span>
<span style="color: Green">%%% USER CODE: MORPHOGEN INTERACTIONS</span>
<span style="color: Green">% In this section you may modify the mesh in any way that does not</span>
<span style="color: CornflowerBlue">Section 4</span>
<span style="color: Green">% alter the set of nodes.</span>
<span style="color: Green">% Use the same pattern for both submodels</span>
      RangeTip=(m.nodes(:,1)<-0.8)&...
          (abs(m.nodes(:,2))<0.2);
      RangeMid=(m.nodes(:,1)<=0.5)&...
          (m.nodes(:,1)>-0.5)&...
          (abs(m.nodes(:,2))<0.3);
      RangeTops=(m.nodes(:,1)<=max(m.nodes(:,1))&...
          (m.nodes(:,1)>0.5)&...
          (abs(m.nodes(:,2))>0.3));
    if (Steps(m)==0) && m.globalDynamicProps.doinit  <span style="color: Green">% Initialisation code.</span>
        switch modelname
            <span style="color: Crimson"> case 'PolariserBased'  </span><span style="color: Green">% </span>
                <span style="color: Green">% One way to set up a morphogen gradient is by ...</span>
                <span style="color: Green">% Setting up a gradient by clamping the ends (execute only once)</span>
                P(RangeTip)=0;
                P(RangeMid)=0.5;
                P(RangeTops)=1;
                id_plusorg_p=P;
                id_minusorg_p(RangeTip)=1;
                m.morphogenclamp( RangeTops|RangeTip|RangeMid, polariser_i ) = 1;
                m = leaf_mgen_conductivity( m, 'POLARISER', 0.1 );  <span style="color: Green">%specifies the diffusion rate of polariser</span>
                m = leaf_mgen_absorption( m, 'POLARISER', 0.0 );    <span style="color: Green">% specifies degradation rate of polariser</span>
            <span style="color: Crimson"> case 'DifferentialGrowthBased'</span>  <span style="color: Green">% </span>
                P(:)=0;
                <span style="color: Green">% One way to set up a morphogen gradient is by ...</span>
                <span style="color: Green">% Setting up a gradient by clamping the ends (execute only once)</span>
                s_growth_p(RangeTip)=1;
                s_growth_p(RangeMid)=0.05;
                s_growth_p(RangeTops)=0.8;
                m.morphogenclamp( RangeTops|RangeTip|RangeMid, s_growth_i ) = 1;
                m = leaf_mgen_conductivity( m, 's_growth', 0.001 );  <span style="color: Green">%specifies the diffusion rate of polariser</span>
                m = leaf_mgen_absorption( m, 's_growth', 0.0 );    <span style="color: Green">% specifies degradation rate of polariser</span>
        end
    end
    BasicGrowth=0.01;
    switch modelname
        <span style="color: Crimson"> case 'PolariserBased' </span> <span style="color: Green">%</span>
            <span style="color: Green">% Every equation to be formatted should end with an at-at Eqn N comment.</span>
            kapar_p(:) = BasicGrowth;  <span style="color: Green">% when isotropic this will be 0.005</span>
            kaper_p(:) = 0.0;  <span style="color: Green">% when isotropic this will be 0.005</span>
            kbpar_p(:) = BasicGrowth;  <span style="color: Green">% when isotropic this will be 0.005</span>
            kbper_p(:) = 0.0;  <span style="color: Green">% when isotropic this will be 0.005</span>
            knor_p(:)  = 0;  <span style="color: Green">% thickness</span>
        <span style="color: Crimson"> case 'DifferentialGrowthBased'</span>  <span style="color: Green">%  </span>
            <span style="color: Green">% Every equation to be formatted should end with an at-at Eqn N comment.</span>
            kapar_p(:) = BasicGrowth*s_growth_p; <span style="color: Green">%0.01;  % when isotropic this will be 0.005</span>
            kaper_p(:) = BasicGrowth*s_growth_p; <span style="color: Green">%0.0;  % when isotropic this will be 0.005</span>
            kbpar_p(:) = BasicGrowth*s_growth_p; <span style="color: Green">%0.01;  % when isotropic this will be 0.005</span>
            kbper_p(:) = BasicGrowth*s_growth_p; <span style="color: Green">%0.0;  % when isotropic this will be 0.005</span>
            knor_p(:)  = 0;  <span style="color: Green">% thickness</span>
    end
    v_kareal_p=kapar_p+kaper_p; <span style="color: Green">% total specified areal growth</span>
<span style="color: CornflowerBlue">Section 5</span>
<span style="color: Green">%%% END OF USER CODE: MORPHOGEN INTERACTIONS</span>
<span style="color: Green">%%% SECTION 3: INSTALLING MODIFIED VALUES BACK INTO MESH STRUCTURE</span>
<span style="color: Green">%%% AUTOMATICALLY GENERATED CODE: DO NOT EDIT.</span>
    m.morphogens(:,polariser_i) = P;
    m.morphogens(:,kapar_i) = kapar_p;
    m.morphogens(:,kaper_i) = kaper_p;
    m.morphogens(:,kbpar_i) = kbpar_p;
    m.morphogens(:,kbper_i) = kbper_p;
    m.morphogens(:,knor_i) = knor_p;
    m.morphogens(:,strainret_i) = strainret_p;
    m.morphogens(:,arrest_i) = arrest_p;
    m.morphogens(:,id_plusorg_i) = id_plusorg_p;
    m.morphogens(:,id_minusorg_i) = id_minusorg_p;
    m.morphogens(:,v_kareal_i) = v_kareal_p;
    m.morphogens(:,id_tip_i) = id_tip_p;
    m.morphogens(:,id_top_i) = id_top_p;
    m.morphogens(:,s_growth_i) = s_growth_p;
    m.morphogens(:,id_mid_i) = id_mid_p;
<span style="color: Green">%%% USER CODE: FINALISATION</span>
<span style="color: Green">%%% END OF USER CODE: FINALISATION</span>
end
<span style="color: Green">%%% USER CODE: SUBFUNCTIONS</span>
<span style="color: CornflowerBlue">Section 6</span>
function m = local_setproperties( m )
end

Revision as of 08:24, 1 June 2011

Back to GFtbox Tutorial pages

We illustrate the practical advantage of having submodels within a project and we illustrate an important consequence of understanding biological growth within the GPT-framework.

The aim is to grow a disc into a romantic heart

Interaction function in detail (A newly created, empty, interaction function is shown here.)

Some details

Pattern of isotropic specified growth (no polariser)
Pattern of isotropic specified growth after growing to 3 times the original area.
Some details

Pattern of specified polariser levels (green-cyan). Polariser can diffuse and the gradient is arrowed. Uniform specified growth (red).
Patterns and shape after growing to 3 times the original area.
Section 1
function m = gpt_twowayheart_20110531( m )
%m = gpt_twowayheart_20110531( m )
%   Morphogen interaction function.
%   Written at 2011-05-31 19:51:32.
%   GFtbox revision 3548, 2011-05-31 14:37:10.747930.

% The user may edit any part of this function between delimiters
% of the form "USER CODE..." and "END OF USER CODE...".  The
% delimiters themselves must not be moved, edited, deleted, or added.

    if isempty(m), return; end

    fprintf( 1, '%s found in %s\n', mfilename(), which(mfilename()) );

    try
        m = local_setproperties( m );
    catch
    end

    realtime = m.globalDynamicProps.currenttime;

Section 2
%%% USER CODE: INITIALISATION

% In this section you may modify the mesh in any way whatsoever.
    if (Steps(m)==0) && m.globalDynamicProps.doinit % First iteration
        % Set up names for variant models.  Useful for running multiple models on a cluster.
        m.userdata.ranges.modelname.range = { 'PolariserBased', 'DifferentialGrowthBased' };  % CLUSTER
         m.userdata.ranges.modelname.index = 1;                       % CLUSTER
    end
    modelname = m.userdata.ranges.modelname.range{m.userdata.ranges.modelname.index};  % CLUSTER
    disp(sprintf('\nRunning %s model %s\n',mfilename, modelname));
    	
    % Set priorities for simultaneous plotting of multiple morphogens, if desired.
    m = leaf_mgen_plotpriority( m, {'ID_PLUSORG', 'ID_MINUSORG'}, [1,2], [0.4,0.4] );

    % Set colour of polariser gradient arrows.
    m = leaf_plotoptions(m,'highgradcolor',[0,0,0],'lowgradcolor',[1,0,0]);
    m = leaf_plotoptions(m,'decorscale',1.5);

    % setup a multiplot of the following morphogens
    m = leaf_plotoptions( m, 'morphogen', {'V_KAREAL','ID_PLUSORG','ID_MINUSORG'});
%%% END OF USER CODE: INITIALISATION

Section 3
%%% SECTION 1: ACCESSING MORPHOGENS AND TIME.
%%% AUTOMATICALLY GENERATED CODE: DO NOT EDIT.

    if isempty(m), return; end

    setGlobals();
    global gNEW_KA_PAR gNEW_KA_PER gNEW_KB_PAR gNEW_KB_PER
    global gNEW_K_NOR gNEW_POLARISER gNEW_STRAINRET gNEW_ARREST
    dt = m.globalProps.timestep;
    polariser_i = gNEW_POLARISER;
    P = m.morphogens(:,polariser_i);
    [kapar_i,kapar_p,kapar_a,kapar_l] = getMgenLevels( m, 'KAPAR' );
    [kaper_i,kaper_p,kaper_a,kaper_l] = getMgenLevels( m, 'KAPER' );
    [kbpar_i,kbpar_p,kbpar_a,kbpar_l] = getMgenLevels( m, 'KBPAR' );
    [kbper_i,kbper_p,kbper_a,kbper_l] = getMgenLevels( m, 'KBPER' );
    [knor_i,knor_p,knor_a,knor_l] = getMgenLevels( m, 'KNOR' );
    [strainret_i,strainret_p,strainret_a,strainret_l] = getMgenLevels( m, 'STRAINRET' );
    [arrest_i,arrest_p,arrest_a,arrest_l] = getMgenLevels( m, 'ARREST' );
    [id_plusorg_i,id_plusorg_p,id_plusorg_a,id_plusorg_l] = getMgenLevels( m, 'ID_PLUSORG' );
    [id_minusorg_i,id_minusorg_p,id_minusorg_a,id_minusorg_l] = getMgenLevels( m, 'ID_MINUSORG' );
    [v_kareal_i,v_kareal_p,v_kareal_a,v_kareal_l] = getMgenLevels( m, 'V_KAREAL' );
    [id_tip_i,id_tip_p,id_tip_a,id_tip_l] = getMgenLevels( m, 'ID_TIP' );
    [id_top_i,id_top_p,id_top_a,id_top_l] = getMgenLevels( m, 'ID_TOP' );
    [s_growth_i,s_growth_p,s_growth_a,s_growth_l] = getMgenLevels( m, 'S_GROWTH' );
    [id_mid_i,id_mid_p,id_mid_a,id_mid_l] = getMgenLevels( m, 'ID_MID' );

% Mesh type: circle
%          centre: 0
%       circumpts: 24
%       coneangle: 0
%         dealign: 0
%          height: 0
%        innerpts: 0
%      randomness: 0.1
%           rings: 4
%         version: 1
%          xwidth: 2
%          ywidth: 2

%            Morphogen   Diffusion   Decay   Dilution   Mutant
%            -------------------------------------------------
%                KAPAR        ----    ----       ----     ----
%                KAPER        ----    ----       ----     ----
%                KBPAR        ----    ----       ----     ----
%                KBPER        ----    ----       ----     ----
%                 KNOR        ----    ----       ----     ----
%            POLARISER         0.1    ----       ----     ----
%            STRAINRET        ----    ----       ----     ----
%               ARREST        ----    ----       ----     ----
%           ID_PLUSORG        ----    ----       ----     ----
%          ID_MINUSORG        ----    ----       ----     ----
%             V_KAREAL        ----    ----       ----     ----
%               ID_TIP        ----    ----       ----     ----
%               ID_TOP        ----    ----       ----     ----
%             S_GROWTH        0.01    ----       ----     ----
%               ID_MID        ----    ----       ----     ----


%%% USER CODE: MORPHOGEN INTERACTIONS

% In this section you may modify the mesh in any way that does not
Section 4
% alter the set of nodes.

% Use the same pattern for both submodels
     RangeTip=(m.nodes(:,1)<-0.8)&...
         (abs(m.nodes(:,2))<0.2);
     RangeMid=(m.nodes(:,1)<=0.5)&...
         (m.nodes(:,1)>-0.5)&...
         (abs(m.nodes(:,2))<0.3);
     RangeTops=(m.nodes(:,1)<=max(m.nodes(:,1))&...
         (m.nodes(:,1)>0.5)&...
         (abs(m.nodes(:,2))>0.3));
    if (Steps(m)==0) && m.globalDynamicProps.doinit  % Initialisation code.
        switch modelname
             case 'PolariserBased'  % 
                % One way to set up a morphogen gradient is by ...
                % Setting up a gradient by clamping the ends (execute only once)
                P(RangeTip)=0;
                P(RangeMid)=0.5;
                P(RangeTops)=1;
                id_plusorg_p=P;
                id_minusorg_p(RangeTip)=1;
                m.morphogenclamp( RangeTops|RangeTip|RangeMid, polariser_i ) = 1;
                m = leaf_mgen_conductivity( m, 'POLARISER', 0.1 );  %specifies the diffusion rate of polariser
                m = leaf_mgen_absorption( m, 'POLARISER', 0.0 );     % specifies degradation rate of polariser
             case 'DifferentialGrowthBased'  % 
                P(:)=0;
                % One way to set up a morphogen gradient is by ...
                % Setting up a gradient by clamping the ends (execute only once)
                s_growth_p(RangeTip)=1;
                s_growth_p(RangeMid)=0.05;
                s_growth_p(RangeTops)=0.8;
                m.morphogenclamp( RangeTops|RangeTip|RangeMid, s_growth_i ) = 1;
                m = leaf_mgen_conductivity( m, 's_growth', 0.001 );  %specifies the diffusion rate of polariser
                m = leaf_mgen_absorption( m, 's_growth', 0.0 );     % specifies degradation rate of polariser
        end
    end
    BasicGrowth=0.01;
    switch modelname
        case 'PolariserBased'  %
            % Every equation to be formatted should end with an at-at Eqn N comment.
            kapar_p(:) = BasicGrowth;  % when isotropic this will be 0.005
            kaper_p(:) = 0.0;   % when isotropic this will be 0.005
            kbpar_p(:) = BasicGrowth;  % when isotropic this will be 0.005
            kbper_p(:) = 0.0;   % when isotropic this will be 0.005
            knor_p(:)  = 0;  % thickness
         case 'DifferentialGrowthBased'  %  
            % Every equation to be formatted should end with an at-at Eqn N comment.
            kapar_p(:) = BasicGrowth*s_growth_p; %0.01;  % when isotropic this will be 0.005
            kaper_p(:) = BasicGrowth*s_growth_p; %0.0;   % when isotropic this will be 0.005
            kbpar_p(:) = BasicGrowth*s_growth_p; %0.01;  % when isotropic this will be 0.005
            kbper_p(:) = BasicGrowth*s_growth_p; %0.0;   % when isotropic this will be 0.005
            knor_p(:)  = 0;  % thickness
    end
    v_kareal_p=kapar_p+kaper_p; % total specified areal growth
Section 5
%%% END OF USER CODE: MORPHOGEN INTERACTIONS

%%% SECTION 3: INSTALLING MODIFIED VALUES BACK INTO MESH STRUCTURE
%%% AUTOMATICALLY GENERATED CODE: DO NOT EDIT.
    m.morphogens(:,polariser_i) = P;
    m.morphogens(:,kapar_i) = kapar_p;
    m.morphogens(:,kaper_i) = kaper_p;
    m.morphogens(:,kbpar_i) = kbpar_p;
    m.morphogens(:,kbper_i) = kbper_p;
    m.morphogens(:,knor_i) = knor_p;
    m.morphogens(:,strainret_i) = strainret_p;
    m.morphogens(:,arrest_i) = arrest_p;
    m.morphogens(:,id_plusorg_i) = id_plusorg_p;
    m.morphogens(:,id_minusorg_i) = id_minusorg_p;
    m.morphogens(:,v_kareal_i) = v_kareal_p;
    m.morphogens(:,id_tip_i) = id_tip_p;
    m.morphogens(:,id_top_i) = id_top_p;
    m.morphogens(:,s_growth_i) = s_growth_p;
    m.morphogens(:,id_mid_i) = id_mid_p;

%%% USER CODE: FINALISATION

%%% END OF USER CODE: FINALISATION

end


%%% USER CODE: SUBFUNCTIONS

Section 6
function m = local_setproperties( m )
end