Difference between revisions of "Team:Paris Bettencourt/Software"
Line 7: | Line 7: | ||
<h3>Introduction</h3> | <h3>Introduction</h3> | ||
+ | As explained in the <a href="https://2015.igem.org/Team:Paris_Bettencourt/Modeling">modeling page</a>, this program modelize the cells population evolution with mother cell differentiation and cell division. | ||
+ | <br /> | ||
+ | We focus here on the stochastic program. | ||
+ | <br /> | ||
<h3>Files</h3> | <h3>Files</h3> | ||
− | + | The MATLAB code is available in <a href="https://github.com/iGEMParisBettencourt2015" title="Source code in GitHub" >GitHub</a> under the GNU General Public License version 3.0. | |
− | + | <br /> | |
+ | Here is a quick explanation of the differents files <i>ie</i> the differents functions. | ||
+ | <h4>Stochastic algorithm</h4> | ||
+ | <ul> | ||
+ | <li>\(timeEvolutionStochastic\) : the main function to calcul the time evolution.</li> | ||
+ | <li>\(checkInput\) : check the input and show an error message if the input is not good.</li> | ||
+ | <li>\(elmPixel\) : find the coordinates of a pixel around an other pixel.</li> | ||
+ | <li>\(errorProgramm\) : display an error and stop the programm.</li> | ||
+ | <li>\(freePosition\) : create a list of free pixels around one pixel.</li> | ||
+ | <li>\(getComputerName\) : get the computer name.</li> | ||
+ | <li>\(getSizeMat\) : find the matrice size.</li> | ||
+ | <li>\(imageToMatrix\) : convert an image into a matrix.</li> | ||
+ | <li>\(initCells\) : initialization of the cells.</li> | ||
+ | <li>\(initialization\) : initialization of the programm.</li> | ||
+ | <li>\(initTimeEvent\) : calcul the different time.</li> | ||
+ | <li>\(initVariables\) : variables initialization.</li> | ||
+ | <li>\(isBinary\) : check if a number is 0 or 1.</li> | ||
+ | <li>\(isPositiveInteger\) : check if a number is a positive integer (1) or not (0).</li> | ||
+ | <li>\(makeCells\) : make the cells.</li> | ||
+ | <li>\(randEvent\) : generate the next random event.</li> | ||
+ | <li>\(randPosition\) : find a free position for a cell.</li> | ||
+ | <li>\(saveInitialParameters\) : save the initial parameters in a text file.</li> | ||
+ | <li>\(saveResult\) : save and plot the results.</li> | ||
+ | <li>\(showAndSaveEventTimeDistribution\) : show and save the event time probability distribution.</li> | ||
+ | <li>\(showPopulation\) : show the cells matrix.</li> | ||
+ | <li>\(writeParameters\) : write a text file with the parameters.</li> | ||
+ | <li>\(launchStochasticProgramm\) : launch the stochastic time evoluation simulation.</li> | ||
+ | <li>\(k1OptimizationStochastic\) : calcul the number of differenciated cells and vitamin with differents k1 in a stochastic way.</li> | ||
+ | <li>\(k1OptimizationStochasticAndDeterministic\) : superimpose the deterministic and stochastic models.</li> | ||
+ | </ul> | ||
+ | <h4>Deterministic algorithm</h4> | ||
+ | <ul> | ||
+ | <li>\(timeEvolutionDeterministic\) : show the time evolution by numerical calculus and equations.</li> | ||
+ | <li>\(k1OptimizationDeterministic\) : calcul the number of differenciated cells with differents k1 in a deterministic way.</li> | ||
+ | </ul> | ||
<h3>Input</h3> | <h3>Input</h3> | ||
+ | In order to launch a simulation, you must define five variables. | ||
+ | <ul> | ||
+ | <li>cells.</li> | ||
+ | <li>rate constants.</li> | ||
+ | <li>fermentation period.</li> | ||
+ | <li>action.</li> | ||
+ | <li>folder name.</li> | ||
+ | </ul> | ||
<h4>Cells input</h4> | <h4>Cells input</h4> | ||
+ | You can choose if you prefer to generate a random or a predetermined position for the initial cells. | ||
+ | <br /> | ||
+ | You have two cells types : mother cells and differenciated cells. | ||
<h5>Random initial position</h5> | <h5>Random initial position</h5> | ||
− | <h5> | + | The input array must contain four integer values in this order. |
+ | <ul> | ||
+ | <li>\(MC_0\) : initial number of mother cells in the medium.</li> | ||
+ | <li>\(DC_0\) : initial number of differentiated cells in the medium.</li> | ||
+ | <li>\(sizeMatCell\) : cells box size (in pixels).</li> | ||
+ | <li>\(sizeMat\) : real box size (in pixels).</li> | ||
+ | </ul> | ||
+ | <br /> | ||
+ | Warning : \(sizeMatCell\) must be larger than \(sizeMat\). | ||
+ | <br /> | ||
+ | <br /> | ||
+ | |||
+ | In the programm, the input variable has the following pattern. | ||
+ | <br /> | ||
+ | \(input = [MC_0, DC_0, sizeMatCell, sizeMat]\) | ||
+ | <br /> | ||
+ | <br /> | ||
+ | Here is an example. | ||
+ | <br /> | ||
+ | <ul> | ||
+ | <li>\(MC_0 = 5 \phantom{t} (cells)\)</li> | ||
+ | <li>\(DC_0 = 0 \phantom{t} (cells)\)</li> | ||
+ | <li>\(sizeMatCell = 100 \phantom{t} (pixels)\)</li> | ||
+ | <li>\(sizeMat = 250 \phantom{t} (pixels)\)</li> | ||
+ | </ul> | ||
+ | |||
+ | <h5>Predetermined initial position</h5> | ||
+ | In order to make an easy predetermined initial position input, we wrote a code which understand images. | ||
+ | <br /> | ||
+ | The input must contain the image path. | ||
+ | <br /> | ||
+ | It is very easy to design a custom image <i>ie</i> a custom spatial cell distribution. You must follow these four rules (we work only with the image red component) | ||
+ | <ul> | ||
+ | <li>the image must be square and in jpeg format.</li> | ||
+ | <li>255 means no cell.</li> | ||
+ | <li>128 means one differenciated cell.</li> | ||
+ | <li>0 means one mother cell.</li> | ||
+ | </ul> | ||
+ | 0, 128 and 255 are red components of any colours that you want because the MATLAB code take into account only the image red component. | ||
+ | <br /> | ||
+ | If you want, you can use the following hexadecimal colours codes. | ||
+ | <ul> | ||
+ | <li>#FFFFFF (white) means no cell.</li> | ||
+ | <li>#800000 (red) means one differenciated cell.</li> | ||
+ | <li>#000000 (black) means one mother cell.</li> | ||
+ | </ul> | ||
+ | <br /> | ||
+ | Here is an example only with mother cells. | ||
+ | <br /> | ||
+ | <img src="https://static.igem.org/mediawiki/2015/9/9a/IgemImg.png" style="width:20%;height:20%;" alt="Example of predetermined cells initial position with mother cells" title="Example of predetermined cells initial position with mother cells" > | ||
+ | <br /> | ||
+ | Here is an other example with mother cells (black) and differenciated cells (red). | ||
+ | <br /> | ||
+ | <img src="https://static.igem.org/mediawiki/2015/a/a4/IgemParisBettencourtImg.png" style="width:20%;height:20%;" alt="Example of predetermined cells initial position with mother cells (black) and differenciated cells (red)" title="Example of predetermined cells initial position with mother cells (black) and differenciated cells (red)" > | ||
+ | <br /> | ||
+ | |||
+ | <h4>Rate constants</h4> | ||
+ | You have to define seven variables. | ||
+ | <ul> | ||
+ | <li>\(\mu_{1}\) : mother cell differentiation time mean.</li> | ||
+ | <li>\(\sigma_{1}\) : mother cell differentiation time standard deviation.</li> | ||
+ | <li>\(\mu_{2}\) : mother cell doubling time mean.</li> | ||
+ | <li>\(\sigma_{2}\) : mother cell doubling time standard deviation.</li> | ||
+ | <li>\(\mu_{3}\) : differentiated cell doubling time mean.</li> | ||
+ | <li>\(\sigma_{3}\) : differentiated cell doubling time standard deviation.</li> | ||
+ | <li>\(k_{4}\) : rate constant of the differentiated cell vitamin production.</li> | ||
+ | </ul> | ||
+ | <br /> | ||
+ | In the programm, the rate constants variable has the following pattern. | ||
+ | <br /> | ||
+ | \(constantRate = [\mu_{1}, \sigma_{1}, \mu_{2}, \sigma_{2}, \mu_{3}, \sigma_{3}, k_{4}]\) | ||
+ | <br /> | ||
+ | <br /> | ||
+ | Here is an example. | ||
+ | <br /> | ||
+ | <ul> | ||
+ | <li>\(\mu_{1} = 1 \phantom{t} (hours)\)</li> | ||
+ | <li>\(\sigma_{1} = 0.1 \phantom{t} (hours)\)</li> | ||
+ | <li>\(\mu_{2} = 1.0502 \phantom{t} (hours)\)</li> | ||
+ | <li>\(\sigma_{2} = 0.1 \phantom{t} (hours)\)</li> | ||
+ | <li>\(\mu_{3} = 2.1004 \phantom{t} (hours)\)</li> | ||
+ | <li>\(\sigma_{3} = 0.1 \phantom{t} (hours)\)</li> | ||
+ | <li>\(k_{4} = 1 \phantom{t} (hours^{-1})\)</li> | ||
+ | </ul> | ||
− | |||
<h4>Fermentation period</h4> | <h4>Fermentation period</h4> | ||
+ | The fermentation period \(t\) is a simple scalar variable. | ||
+ | <br /> | ||
+ | You can use \(t = 5 \phantom{t} (hours)\) for example. | ||
<h4>Action</h4> | <h4>Action</h4> | ||
+ | In order to choose what you want to do, you must define three booleans. | ||
+ | <ul> | ||
+ | <li>\(createFolder\) : create a folder in the disk to save informations.</li> | ||
+ | <li>\(showAnimation\) : show the poulation animation. Warning : require a lot of computing power.</li> | ||
+ | <li>\(plotGraph\) : plot the results in graphs.</li> | ||
+ | </ul> | ||
+ | |||
+ | <br /> | ||
+ | In the programm, the action variable has the following pattern. | ||
+ | <br /> | ||
+ | \(action = [createFolder, showAnimation, plotGraph\)] | ||
+ | <br /> | ||
+ | <br /> | ||
+ | In the following example we want to create a folder and plot the graphs. | ||
+ | <br /> | ||
+ | <ul> | ||
+ | <li>\(createFolder = 1\)</li> | ||
+ | <li>\(showAnimation = 0\)</li> | ||
+ | <li>\(plotGraph = 1\)</li> | ||
+ | </ul> | ||
+ | <br /> | ||
+ | In the following example we want to show the cell animation. | ||
+ | <br /> | ||
+ | <ul> | ||
+ | <li>\(createFolder = 0\)</li> | ||
+ | <li>\(showAnimation = 1\)</li> | ||
+ | <li>\(plotGraph = 0\)</li> | ||
+ | </ul> | ||
+ | <br /> | ||
+ | In the following example we want to show the cell animation and save the images in a folder. | ||
+ | <br /> | ||
+ | With the images you can create gif animations. | ||
+ | <br /> | ||
+ | <ul> | ||
+ | <li>\(createFolder = 1\)</li> | ||
+ | <li>\(showAnimation = 1\)</li> | ||
+ | <li>\(plotGraph = 0\)</li> | ||
+ | </ul> | ||
+ | |||
<h4>Folder name</h4> | <h4>Folder name</h4> | ||
+ | The \(folderName\) variable is a string containing the folder where results folder are store in the disk. | ||
+ | <br /> | ||
+ | You can use \(folderName =\) '\(Results\)' for example. | ||
<h3>Output</h3> | <h3>Output</h3> | ||
+ | Four types of output are generated. | ||
+ | <ul> | ||
+ | <li>raw data : all the useful informations.</li> | ||
+ | <li>folder creation : if chosen in the \(action\) variable, a folder is created.</li> | ||
+ | <li>graphs : if chosen in the \(action\) variable, graphs are generated.</li> | ||
+ | <li>animation : if chosen in the \(action\) variable, cell animation is generated.</li> | ||
+ | </ul> | ||
+ | |||
<h4>Raw data</h4> | <h4>Raw data</h4> | ||
<ul> | <ul> | ||
− | <li>mainTic</li> | + | <li>\(mainTic\) : start of the programm.</li> |
− | <li> | + | <li>\(MC_0\) : initial number of mother cells in the medium.</li> |
− | <li> | + | <li>\(DC_0\) : initial number of differentiated cells in the medium.</li> |
− | <li>pasDistributionTimeEvent</li> | + | <li>\(pasDistributionTimeEvent\) : resolution for the graph time event distribution plot (see the \(initVariables\) function).</li> |
− | <li>frameRate</li> | + | <li>\(frameRate\) : animation framerate (see the \(initVariables\) function).</li> |
− | <li>timeShowPopulation</li> | + | <li>\(timeShowPopulation\) : simulation time between two animations (see the \(initVariables\) function).</li> |
− | <li>simulationTime</li> | + | <li>\(simulationTime\) : fermentation period \(t\).</li> |
− | <li>resultFolderName</li> | + | <li>\(resultFolderName\) : folder where the results folder are created.</li> |
− | <li> | + | <li>\(\mu_{1}\) : mother cell differentiation time mean.</li> |
− | <li> | + | <li>\(\sigma_{1}\) : mother cell differentiation time standard deviation.</li> |
− | <li> | + | <li>\(\mu_{2}\) : mother cell doubling time mean.</li> |
− | <li> | + | <li>\(\sigma_{2}\) : mother cell doubling time standard deviation.</li> |
− | <li> | + | <li>\(\mu_{3}\) : differentiated cell doubling time mean.</li> |
− | <li> | + | <li>\(\sigma_{3}\) : differentiated cell doubling time standard deviation.</li> |
− | <li> | + | <li>\(k_{4}\) : rate constant of the differentiated cell vitamin production.</li> |
− | <li>cVitamin</li> | + | <li>\(cVitamin\) : vitamin counter.</li> |
− | <li>time</li> | + | <li>\(time\) : main timer containing the simulation time.</li> |
− | <li>createFolder</li> | + | <li>\(createFolder\) : action boolean.</li> |
− | <li>showPopulationBool</li> | + | <li>\(showPopulationBool\) : action boolean.</li> |
− | <li>plotGraph</li> | + | <li>\(plotGraph\) : action boolean.</li> |
− | <li>input</li> | + | <li>\(input\) : input array.</li> |
− | <li>cTime1</li> | + | <li>\(cTime1\) : time distribution counter 1 (see the \(randEvent\) function).</li> |
− | <li>cTime2</li> | + | <li>\(cTime2\) : time distribution counter 2 (see the \(randEvent\) function).</li> |
− | <li>cTime3</li> | + | <li>\(cTime3\) : time distribution counter 3 (see the \(randEvent\) function).</li> |
− | <li>counterEvent</li> | + | <li>\(counterEvent\) : event counter.</li> |
− | <li>timerShow</li> | + | <li>\(timerShow\) : time animation counter.</li> |
− | <li>sizeMat</li> | + | <li>\(sizeMat\) : real box size (in pixels).</li> <li>\(nextEvent\) : .</li> |
− | + | <li>\(time1Array\) : time distribution array 1 (see the \(initTimeEvent\) function).</li> | |
− | <li> | + | <li>\(time2Array\) : time distribution array 2 (see the \(initTimeEvent\) function).</li> |
− | <li> | + | <li>\(time3Array\) : time distribution array 3 (see the \(initTimeEvent\) function).</li> |
− | <li> | + | <li>\(cell\) : structure containing all the cells informations.</li> |
− | <li> | + | <li>\(sizeMatCell\) : cells box size (in pixels).</li> |
− | <li> | + | <li>\(timeNextEvent\) : time before the next event.</li> |
− | <li>timeNextEvent</li> | + | <li>\(saveTime\) : array containing the simulation time evolution.</li> |
− | <li>saveTime</li> | + | <li>\(saveNbrMC\) : array containing the mother cells time evolution.</li> |
− | <li>saveNbrMC</li> | + | <li>\(saveNbrDC\) : array containing the differentiated cells time evolution.</li> |
− | <li>saveNbrDC</li> | + | <li>\(saveNbrVitamin\) : array containing the vitamin time evolution.</li> |
− | <li>saveNbrVitamin</li> | + | <li>\(folderName\) : folder where the results are stored. The pattern is the following : \(resultFolderName/DD-MM-YY\_hh\_mm\_ss\_mss\).</li> |
− | <li>folderName</li> | + | <li>\(imgType\) : image type (see the \(initilization\) function).</li> |
− | <li>imgType</li> | + | <li>\(parametersFileName\) : parameters file name where the parameters are saved (see the \(initilization\) function).</li> |
− | <li>maxMC</li> | + | <li>\(parametersDoc\) : file object where the parameters are saved.</li> |
− | <li>maxDC</li> | + | <li>\(maxMC\) : maximum number of mother cells.</li> |
− | <li>maxVitamin</li> | + | <li>\(maxDC\) : maximum number of differentiated cells.</li> |
− | <li>timeSpent</li> | + | <li>\(maxVitamin\) : maximum number of vitamins.</li> |
+ | <li>\(timeSpent\) : computation time (in seconds).</li> | ||
+ | |||
+ | |||
</ul> | </ul> | ||
<h4>Folder creation</h4> | <h4>Folder creation</h4> |
Revision as of 19:18, 12 September 2015