Tutorial on the basic interaction function

From BanghamLab
Jump to navigation Jump to search

Back to tutorial pages

Variables and utility functions

Variables that need to be seen in the GUI (morphogens, growth factors, signals, etc.) are always set up (declared) from the GUI using Morphogen Panel. We have evolved a naming convention

prefixes
id_ identity factor
s_ signalling factor
v_ visual monitor
f_ finite element monitor
suffixes _p, _l, _a, _i

Full details of types of morphogens and factors

Pre-defined variables
dt computational step size
realtime virtual time of the model
Pre-defined functions
Steps(m) current step number in Mesh m
pro(k,id) promote by k in regions designated by factor, id
inh(k,id) inhibit by k in regions designated by factor, id
local_setproperties( m ) initialise Mesh properties
leaf_*( m, *) A large library of functions for manipulating the Mesh data structure, m. Many are listed in the GUI help system, Menu:Help

The interaction function in more detail

This part is generated automatically from the GUI
The name matches the project name, GFtbox revision number refers to our source code control, lines starting with % are comments

   function m = gpt_why_matlab_2011_05_05( m )
   %m = gpt_why_matlab_2011_05_05( m )
   %   Morphogen interaction function.
   %   Written at 2011-05-28 08:08:11.
   %   GFtbox revision 3544, 2011-05-25 13:37:23.907904.
   % 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;
   %%% USER CODE: INITIALISATION

This part could contain user code
but in this case there is nothing we need to do before the system extracts information from the Mesh data structure

User code

This part is generated automatically from the GUI
Variables are extracted from Mesh and the mesh itself is summarised in a set of comments

   %%% END OF USER CODE: INITIALISATION
   %%% 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_a_i,id_a_p,id_a_a,id_a_l] = getMgenLevels( m, 'ID_A' );
       [id_b_i,id_b_p,id_b_a,id_b_l] = getMgenLevels( m, 'ID_B' );
   % Mesh type: circle
   %          centre: 0
   %       circumpts: 48
   %       coneangle: 0
   %         dealign: 0
   %          height: 0
   %        innerpts: 0
   %      randomness: 0.1
   %           rings: 6
   %         version: 1
   %          xwidth: 0.2
   %          ywidth: 0.2
   %            Morphogen   Diffusion   Decay   Dilution   Mutant
   %            -------------------------------------------------
   %                KAPAR        ----    ----       ----     ----
   %                KAPER        ----    ----       ----     ----
   %                KBPAR        ----    ----       ----     ----
   %                KBPER        ----    ----       ----     ----
   %                 KNOR        ----    ----       ----     ----
   %            POLARISER        ----    ----       ----     ----
   %            STRAINRET        ----    ----       ----     ----
   %               ARREST        ----    ----       ----     ----
   %                 ID_A        ----    ----       ----     ----
   %                 ID_B        ----    ----       ----     ----
   %%% USER CODE: MORPHOGEN INTERACTIONS

This part contains user code that articulates the model

       if (Steps(m)==0) && m.globalDynamicProps.doinit  % Initialisation code.
           id_a_p(m.nodes(:,1)<-0.03)=1; % setup region for A
           id_b_p(m.nodes(:,2)<-0.01)=1; % setup region for B
       else
           % @@KRN Growth Regulatory Network
           kapar_p(:) = id_a_l .* inh(1,id_b_l); % growth rate
           kaper_p(:) = kapar_p; % isotropic growth
           kbpar_p(:) = kapar_p; % same on both sides of the sheet
           kbper_p(:) = kapar_p; % same
           knor_p(:)  = 0;       % thickness not growing
       end

This part is generated automatically from the GUI
Variables are put back into the data structure (Mesh).
Note: only variables with the _p suffix (promotors) that are stored (levels _l can be computed on the fly and activities are generally set in the GUI - in the interaction function they would have to be changed directly in the data structure.

   %%% 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_a_i) = id_a_p;
       m.morphogens(:,id_b_i) = id_b_p;
   %%% USER CODE: FINALISATION

This part could contain user code
that manipulates the data structure

User code

This part is generated automatically from the GUI

   %%% END OF USER CODE: FINALISATION
   end
   %%% USER CODE: SUBFUNCTIONS

This part could contain user code
add any local functions that might be need
The following function is always created. It is automatically filled with comments (here deleted) when the project is first created. It will be discussed later

   function m = local_setproperties( m )
   end