Team:Bordeaux/SourceCodeModelling

From 2012.igem.org

(Difference between revisions)
 
(19 intermediate revisions not shown)
Line 64: Line 64:
<h4>Init_PEB.py file</h4>
<h4>Init_PEB.py file</h4>
<hr>
<hr>
 +
</br>
 +
<li><a href="http://cdjemiel.free.fr/igem2012/code/init_PEB.py" title="Mst" target="_blank">Download file PEP.py</a></li>
</br>
</br>
Line 99: Line 101:
seuil_mutation_QBox=0.05
seuil_mutation_QBox=0.05
seuil_mutation_LasI=0.05
seuil_mutation_LasI=0.05
 +
seuil_mutation_GFP=0.05
#change state
#change state
Line 114: Line 117:
rayon_action=0.075
rayon_action=0.075
-
                                                </pre>
+
 
 +
</pre>
</p>
</p>
<p>
<p>
-
<h4>PEP.py file</h4>
+
<h4>PEB.py file (Main program)</h4>
<hr>
<hr>
</br>
</br>
 +
<li><a href="http://cdjemiel.free.fr/igem2012/code/PEB.py" title="Mst" target="_blank">Download file PEB.py</a></li>
 +
</p>
-
                                                <pre class="prettyprint lang-py">
+
<p>
-
#!/usr/bin/python
+
<h4>Create a gif </h4>
-
# -*- coding: iso-8859-1 -*-
+
<hr>
-
 
+
</br>
-
 
+
<li><a href="http://cdjemiel.free.fr/igem2012/code/create_gif.py" title="Mst" target="_blank">Download file create_gif.py</a></li>
-
import random
+
<li><a href="http://cdjemiel.free.fr/igem2012/code/images2gif.py" title="Mst" target="_blank">Download file images2gif.py</a></li>
-
from pylab import *
+
</br>
-
from numpy import *
+
Reference : <a href="http://www.somethinkodd.com/oddthinking/2005/12/06/python-imaging-library-pil-and-animated-gifs/" target="_blank">Python Imaging Library (PIL) and Animated GIFs</a>
-
from init_PEB import *
+
-
import os
+
-
 
+
-
 
+
-
list_bacteria = []
+
-
lxw=[]
+
-
lyw=[]
+
-
lxb=[]
+
-
lyb=[]
+
-
lxr=[]
+
-
lyr=[]
+
-
lxg=[]
+
-
lyg=[]
+
-
lxn=[]
+
-
lyn=[]
+
-
 
+
-
 
+
-
def features_bacteria ():
+
-
r"""
+
-
Function attribute all features at the bacteria
+
-
"""
+
-
#Coordinates
+
-
x=random.uniform(0,10) # position x of the bacteria on the petri dish
+
-
List[0]=x
+
-
y=random.uniform(0,10) # position x of the bacteria on the petri dish
+
-
List[1]=y
+
-
+
-
#States
+
-
state1=None
+
-
List[2]=state1
+
-
state2=None
+
-
List[3]=state2
+
-
state3=None
+
-
List[4]=state3
+
-
+
-
#Operon 1
+
-
LasR_box=None
+
-
List[5]=LasR_box
+
-
LuxS=None
+
-
List[6]=LuxS
+
-
Beta_gal=None
+
-
List[7]=Beta_gal
+
-
+
-
#Operon 2
+
-
Lux_box=None
+
-
List[8]=Lux_box
+
-
LuxI=None
+
-
List[9]=LuxI
+
-
m_cherry=None
+
-
List[10]=m_cherry
+
-
+
-
#Operon 3
+
-
Q_box=None
+
-
List[11]=Q_box
+
-
LasI=None
+
-
List[12]=LasI
+
-
GFP=None
+
-
List[13]=GFP
+
-
+
-
#Operon constitutive
+
-
recepteur1=None
+
-
List[14]=recepteur1
+
-
recepteur2=None
+
-
List[15]=recepteur2
+
-
recepteur3=None
+
-
List[16]=recepteur3
+
-
 
+
-
return List
+
-
 
+
-
 
+
-
+
-
def feature_constitutive():
+
-
 
+
-
for j in range (0,len(list_bacteria)):
+
-
proba_active_14=random.uniform(0,1)
+
-
proba_active_15=random.uniform(0,1)
+
-
proba_active_16=random.uniform(0,1)
+
-
+
-
if proba_active_14<=seuil_acivation_recepteur1:
+
-
list_bacteria[j][14]=1
+
-
else:
+
-
list_bacteria[j][14]=0
+
-
+
-
if proba_active_15<=seuil_acivation_recepteur2:
+
-
list_bacteria[j][15]=1
+
-
else:
+
-
list_bacteria[j][15]=0
+
-
+
-
if proba_active_16<=seuil_acivation_recepteur3:
+
-
list_bacteria[j][16]=1
+
-
else:
+
-
list_bacteria[j][16]=0
+
-
 
+
-
def mutation():
+
-
 
+
-
for j in range (0,len(list_bacteria)):
+
-
proba_mutation=random.uniform(0.1)
+
-
if proba_mutation<=0.05:
+
-
proba_mutation_LasR=random.uniform(0.1)
+
-
proba_mutation_LuxS=random.uniform(0.1)
+
-
proba_mutation_BetaGal=random.uniform(0.1)
+
-
proba_mutation_LuxBox=random.uniform(0.1)
+
-
proba_mutation_LuxI=random.uniform(0.1)
+
-
proba_mutation_MCherry=random.uniform(0.1)
+
-
proba_mutation_QBox=random.uniform(0.1)
+
-
proba_mutation_LasI=random.uniform(0.1)
+
-
proba_mutation_GFP=random.uniform(0.1)
+
-
if proba_mutation_LasR<=seuil_mutation_LasR:
+
-
list_bacteria[j][5]=0
+
-
if proba_mutation_LuxS<=seuil_mutation_LuxS:
+
-
list_bacteria[j][6]=0
+
-
if proba_mutation_BetaGal<=seuil_mutation_BetaGal:
+
-
list_bacteria[j][7]=0
+
-
if proba_mutation_LuxBox<=seuil_mutation_LuxBox:
+
-
list_bacteria[j][8]=0
+
-
if proba_mutation_LuxI<=seuil_mutation_LuxI:
+
-
list_bacteria[j][9]=0
+
-
if proba_mutation_MCherry<=seuil_mutation_MCherry:
+
-
list_bacteria[j][10]=0
+
-
if proba_mutation_QBox<=seuil_mutation_QBox:
+
-
list_bacteria[j][11]=0
+
-
if proba_mutation_LasI<=seuil_mutation_LasI:
+
-
list_bacteria[j][12]=0
+
-
if proba_mutation_GFP<=seuil_mutation_GFP:
+
-
list_bacteria[j][13]=0
+
-
+
-
 
+
-
def active_state():
+
-
r"""
+
-
Function permit to active the state of the bacteria according the activation of these genes
+
-
"""
+
-
for j in range (0,len(list_bacteria)):
+
-
#State 1
+
-
if list_bacteria[j][5]==1 and list_bacteria[j][6]==1 and list_bacteria[j][7]==1:
+
-
list_bacteria[j][2]=1
+
-
list_bacteria[j][3]=0
+
-
list_bacteria[j][4]=0
+
-
+
-
#State 2
+
-
if list_bacteria[j][8]==1 and list_bacteria[j][9]==1 and list_bacteria[j][10]==1:
+
-
list_bacteria[j][2]=0
+
-
list_bacteria[j][3]=1
+
-
list_bacteria[j][4]=0
+
-
+
-
#State 3
+
-
if list_bacteria[j][11]==1 and list_bacteria[j][12]==1 and list_bacteria[j][13]==1:
+
-
list_bacteria[j][2]=0
+
-
list_bacteria[j][3]=0
+
-
list_bacteria[j][4]=1
+
-
 
+
-
def change_state():
+
-
r"""
+
-
Function permit to the bacteria changing state
+
-
"""
+
-
for j in range (0,len(list_bacteria)):
+
-
# State 1 --> State 2
+
-
if  list_bacteria[j][2]==1 and list_bacteria[j][5]==1 and list_bacteria[j][6]==1 and list_bacteria[j][14]==1:
+
-
proba=random.uniform(0,1)
+
-
if proba<=seuil_etat1_2:
+
-
list_bacteria[j][8] =1
+
-
list_bacteria[j][9] =1
+
-
list_bacteria[j][10] =1
+
-
+
-
def noise(noise_pourcent):
+
-
r"""
+
-
Create a noise before the first stimulation light. Take one argument : noise_pourcent = the noise that we want
+
-
"""
+
-
for j in range (0,len(list_bacteria)):
+
-
proba=random.uniform(0,1)
+
-
if proba<=noise_pourcent:
+
-
proba2=random.uniform(0,1)
+
-
if 0<=proba2<seuil_bruit1:
+
-
list_bacteria[j][5]=1
+
-
list_bacteria[j][6]=1
+
-
list_bacteria[j][7]=1
+
-
if seuil_bruit1<=proba2<seuil_bruit2:
+
-
list_bacteria[j][8]=1
+
-
list_bacteria[j][9]=1
+
-
list_bacteria[j][10]=1
+
-
if seuil_bruit2<=proba2<1:
+
-
list_bacteria[j][11]=1
+
-
list_bacteria[j][12]=1
+
-
list_bacteria[j][13]=1
+
-
 
+
-
 
+
-
 
+
-
                                                </pre>
+
</p>
</p>
</div>
</div>

Latest revision as of 09:29, 26 September 2012

Modelling - iGEM Bordeaux 2012

iGEM - Bordeaux - Source Code

Init_PEB.py file



  • Download file PEP.py

  • r"""
    File contains var
    """
    
    __projet__ = 'iGEM '
    __author__ = 'Djemiel Christophe, Freche Arnaud'
    __copyright__ = 'Copyright (c) 2012 BordeauxTeam'
    __license__ = ''
    __vcs_id__ = '$Id$'
    __version__ = '1.0'
    
    #var 
    directory_pictures="pictures_simulation/"
    
    #initial parameters 
    nb_bacteria=8000
    
    #features constitutive
    seuil_acivation_recepteur1=0.75
    seuil_acivation_recepteur2=0.75
    seuil_acivation_recepteur3=0.75
    
    #mutation
    seuil_mutation_operon=0.05
    seuil_mutation_LasR=0.05
    seuil_mutation_LuxS=0.05
    seuil_mutation_BetaGal=0.05
    seuil_mutation_LuxBox=0.05
    seuil_mutation_LuxI=0.05
    seuil_mutation_MCherry=0.05
    seuil_mutation_QBox=0.05
    seuil_mutation_LasI=0.05
    seuil_mutation_GFP=0.05
    
    #change state
    seuil_etat1_2=0.05
    
    #noise
    noise_pourcent=0.0001
    seuil_bruit1=0.33
    seuil_bruit2=0.66
    
    #stimulus light
    seuil_transfo_lumiere=0.7
    diameter_light=1
    
    rayon_action=0.075
    
    
     

    PEB.py file (Main program)



  • Download file PEB.py
  • Create a gif



  • Download file create_gif.py
  • Download file images2gif.py

  • Reference : Python Imaging Library (PIL) and Animated GIFs