MAIN_Axon_Model_Pepo_1.m 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. clear all
  2. %% Main Script to Generate Axons
  3. % Copyright (C) INRIA
  4. % This file is released under the CeCILL-B license. See LICENSE.txt.
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. %This Script allows to automatically perfom simulations changing different parameters.
  7. %The main file 'FileName' will be saved for each simulation.
  8. %FileName contains the cell-type variable Axons will all the information regarding the simulations.
  9. %Mutants can be generated within the population that are: slower (changing mut_slow), that have different parmeter values (Numel(Alpha) and Numel(Beta)=2) and that present different probabilities of mechanical branching (IMP_ran(2)). Other possibilities may be included in the code.
  10. %Axon cell structure:
  11. %-each neurite (main axon or branch) is described by a structure which represents anelement of the cell-type variable Axons.
  12. %-each neurite is structured as follows:
  13. % mut: 0 %0 means WT, 1 means mutant
  14. % level: 0 %0 means main axon, 1 means first order branch and 2 second order branch.
  15. % bp: 0 %if the neurite is a branch, is the branching point. If not is 0.
  16. % ND: [17x3 double] %All the branching points
  17. % ND_dyn: [13x3 double] %Type II (short and dynamic) Branching points
  18. % DB: {1x19 cell} %cell-type variable. Each element has the information of all the Type II branches that where created. The boolean 'stable' indicates if the branch has been stabilized or not. The variable 'origin' indicates ifit was stabilized by the contact with another branch tip (origin='BT') or branching point (origin='BP')
  19. % branch_index: [19x1 double] %Element of the Axon cell-type variable where each branch is saved
  20. % time: 63 %Time when theneurite reached the end
  21. % root_index: -1 % -1 if main axon, if branch is the element of the Axon cell-type variable where each branch is saved
  22. % Parameters: [7.4450 1.6650] % Parameters(1)=Alpha and Parameters(2)=Beta.
  23. % axon: [132x3 double] %3D neurite path
  24. % th: [132x2 double] %Theta values: th(:,1) for the XY plane and th(:,2) for the Z direction
  25. % SpaceTime: [63x3 double] %size(SpaceTime,1) depicts the time points while the neurite grew. For each time point, the 3D vector depicts the spatiallocation of the axon tip. This allows to reconstruct the path in time.
  26. % counter: 84 %final counter value of the neurite
  27. %Code generated by Agustina Razetti (Université Côte d’Azur, Inria, CNRS, I3S, France). Contact: arazetti@unice.fr
  28. %For any publication using this code, cite: Modelling axon growth fom in vivo data reveals the importance of (..)
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. NN=1; %Number of simulations -> many simulations can be performed. Identical or varying one or more parameters each time.
  31. tic
  32. for i=1:NN
  33. % close all
  34. Num_ax = 1;%Number of axons.
  35. % ------------- Parámetros por defecto ---------------
  36. mut_slow=[];%if empty: nothing changes. if not: mut_slow is the equivalent to nmax_nr for mutants (instead of speed [nmax nr]=[6 2], axons may be slower, for example [3 1]
  37. Diameter=0.4;% axon diameter. (0.23 for gamma)
  38. Param_Error=[];%Param_Error=[]; means fixed values of Alpha and Beta. If Param_Error=[a b,c d], the parameters of each neuron are thrown from a Bivariate Gaussian of mean(Alpha Beta) and covariance matrix Param_Error.
  39. %Param_Error(:,:,2)=[]; %If wild types and mutants have different values, Param_Error(:,:,1) is the covariance matrix for wild type neurons and Param_Error(:,:,2) for mutants
  40. IMP_ran=[1 1]; %Probability of branching upon interaction (from 0-1). IMP_ran(1) for WT (typically equal to 1) and IMP_ran(2) for mutants (for example, equal to 0 for imp)
  41. % if Pb(1)>0 and IMP_ran(1)>0 both types of branches will appear: random and upon interaction
  42. % Lambda_b (Poisson number for branch distance) is set in Line 8 of code file 'Curve_Master_Branches_no_video_17'
  43. % Initial branch angle distribution can be set in Fio in line 274 of code file 'Curve_Master_Branches_no_video_17'
  44. num_mutants=0;%Number of mutants
  45. % FileName='try_wt';
  46. nexp=i; %experiment_counter (automatic)
  47. max_counter=140;%Counter number. Max. number of times a neurite may encounter a mechanical constraint.
  48. % *********** PYRAMIDAL NEURONS (paper) *****************
  49. % % ------------- PARÁMETROS CENTRALES MAIN AXON ---------------
  50. %
  51. % Alpha = 10;%if numel(Alpha)=1 : every axon has the same value. if numel(Alpha)=2 : wild types will have Alpha(1) and mutants Alpha(2).
  52. % Beta = 30;%if numel(Beta)=1 : every axon has the same value. if numel(Beta)=2 : wild types will have Beta(1) and mutants Beta(2).
  53. % Pb = [0.3 0];%Pb(1): Probability of random branching (from 0-1).
  54. % %Pb(2): by default equal to zero. If 1, the axon will not only try to branch with probabilty Pb(1) but will also do not advance during the corrspondent timepoint. It simulates random pausing.
  55. % ------------- PARÁMETROS CENTRALES BRANCHES ---------------
  56. Alpha = 50;%if numel(Alpha)=1 : every axon has the same value. if numel(Alpha)=2 : wild types will have Alpha(1) and mutants Alpha(2).
  57. Beta = 0.1;%if numel(Beta)=1 : every axon has the same value. if numel(Beta)=2 : wild types will have Beta(1) and mutants Beta(2).
  58. Pb = [0.2 0];%Pb(1): Probability of random branching (from 0-1).
  59. %Pb(2): by default equal to zero. If 1, the axon will not only try to branch with probabilty Pb(1) but will also do not advance during the corrspondent timepoint. It simulates random pausing.
  60. % ATENCIÓN! si queremos modelizar las pyramidal neurons del paper necesitamos que Pb dependa de la x.
  61. % Esto se controla con el parámetro 'Cond_x_Prob_Branching', en el script "Curve_master_branches_no_video_17.m":
  62. % ------------- Restricciones físicas: espacio disponible, distancia máxima, paso y nivel de ramificación ---------------
  63. Xi = 1;% Growth cavity. If Xi=1: a Tube is considered (Diameter set in line 14 of code file 'Curve_Simulation_branches_no_video_17'. If Xi=0: The Gamma axons medial lobe.
  64. Xmax = 80; %Max. Travelled distance
  65. Drho = 1/3; %StepSize
  66. b_l = 2; %Max. branch order/level
  67. nmax_nr=[10 1];%nmax_nr(1): max. number of steps per time point (nmax). nmax_nr(2)=number of steps the neurite retracts upon mechanical interaction (nr)
  68. lambda_b = 3; % lambda_b es el parámetro 'MeanLambda' en "Curve_master_branches_no_video_17.m", línea 12.
  69. % ------------- Nombre del archivo ---------------
  70. FileName='Prueba_Pepo_1';
  71. % ------------- Definición del entorno ---------------
  72. % GRADIENTfile='GradientMap_Pepo_Pyramidal';% External attractive field to simulate the pyramidal neurons in the paper.
  73. GRADIENTfile='GradMap_zero_for_TUBE_long';%Gradient Field (constant and equal zero.
  74. % GRADIENTfile='GradientMap_03_06'; %To simulate Gamma axons use : 'GradientMap_03_06.mat';
  75. % ******************************************************************
  76. % ------------- SIMULACIÓN ---------------
  77. SIMULATIONS_17_PEPO(Num_ax,Diameter,nmax_nr,FileName,nexp,IMP_ran,num_mutants,max_counter,mut_slow,[Alpha Beta],GRADIENTfile,Xi,Param_Error,Pb,b_l,Drho,Xmax, lambda_b);
  78. end
  79. toc
  80. % %% Plotting
  81. clc
  82. load(['exp_ 1 _ ', FileName, '.mat']);
  83. figure
  84. hold on
  85. for k = 1:length(Axons)
  86. axon = Axons{1, k};
  87. if length(axon.axon) >= 10
  88. plot3(axon.axon(:, 1), axon.axon(:, 2), axon.axon(:, 3), 'linewidth', 1.5);
  89. end
  90. end
  91. xlabel('x');
  92. ylabel('y');
  93. zlabel('z');
  94. title({['alpha = ', num2str(Alpha), '. beta = ', num2str(Beta), '. Pb = ', num2str(Pb(1)), '. lambda b = ', num2str(lambda_b)], ['Xmax = ', num2str(Xmax), '. Drho = ', num2str(Drho), '. bl = ', num2str(b_l), '. nmax = ', num2str(nmax_nr(1))]}, 'fontsize', 15);
  95. axis equal