Paris/Sources

From 2007.igem.org

(Difference between revisions)
Line 2: Line 2:
=Cell auto=
=Cell auto=
 +
!include "gbviewOutput.mgs" ;;
 +
 +
N := 30;;
 +
 +
gbf grille = <nord, est ; 30 * nord, 30 * est>
 +
and record Bact = { DAP:float, DAPe:float }
 +
and record BactG = Bact + { bactG }
 +
and record BactS = Bact + { bactS} ;;
 +
 +
fun iota_v(v,n) = map((\x.v), iota(n,seq:())) ;;
 +
fun new_grid(v) = iota_v(iota_v(v,N), N) following |nord>, |est> ;;
 +
 +
fun majBactG[DAPexport = 0.2, DAPimport = 0.2, DAPconso= 1, SupDiff = 2.4, InfDiff = 2.02 ](x) =
 +
if ( ( x.DAP > InfDiff ) & ( x.DAP < SupDiff ) & (random(1) < 0.8) ) then
 +
{DAP = x.DAP , DAPe = x.DAPe, bactS} else
 +
let dap = if x.DAP - DAPconso  > 0 then  x.DAP - DAPconso  else  0 fi
 +
and dape= x.DAPe
 +
in if dap > dape then
 +
                    x + {DAP = dap - DAPexport * dap, DAPe = dape + DAPexport * dap }
 +
  else x + {DAP = dap + DAPimport * dape, DAPe = dape - DAPimport * dape }
 +
                  fi
 +
        fi
 +
;;
 +
 +
fun majBactS[DAPexport = 0.2, DAPimport = 0.2, DAPprod=10](x) = 
 +
let dap =  x.DAP + DAPprod
 +
and dape= x.DAPe
 +
in if dap > dape then
 +
                    x + {DAP = dap - DAPexport * dap, DAPe = dape + DAPexport * dap }
 +
  else x + {DAP = dap + DAPimport * dape, DAPe = dape - DAPimport * dape }
 +
                  fi
 +
 +
;;
 +
 +
 +
trans evol[Delta_t=0.1,DAPeDiff=1, DAPeDegrad = 0.2] = {
 +
 +
 +
 +
  (* production of DAP *)
 +
  x:BactS => (
 +
let d = neighborsfold(
 +
      (\y.\acc.( DAPeDiff*Delta_t*(y.DAPe-x.DAPe) + acc)),
 +
      x.DAPe,
 +
      x)
 +
    in majBactS( x + {DAPe = if ( d - DAPeDegrad * x.DAPe) > 0 then d - DAPeDegrad * x.DAPe else 0 fi } )
 +
      );
 +
 +
  (* Diffirentiation and Consumption *)
 +
x:BactG => (
 +
let d = neighborsfold(
 +
      (\y.\acc.( DAPeDiff*Delta_t*(y.DAPe-x.DAPe) + acc)),
 +
      x.DAPe,
 +
      x)
 +
    in majBactG(x + {DAPe = if ( d - DAPeDegrad * x.DAPe) > 0 then  d - DAPeDegrad * x.DAPe else 0 fi } )
 +
   
 +
 +
  )
 +
 +
} ;;
 +
 +
 +
 +
 +
 +
g := new_grid({DAP=6.0, DAPe=3.0, bactG}) ; 0 ;;
 +
g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;;
 +
g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;;
 +
g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;;
 +
g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;;
 +
evol[iter=1000,interlude=GBVexport((\v.("DAPe = " + (12 * v.DAPe ) + if BactS(v) then ", bactS= 255" else  ", bactG = 255"  fi )))](g) ;;

Revision as of 13:38, 24 October 2007


Cell auto

!include "gbviewOutput.mgs" ;;

N := 30;;

gbf grille = <nord, est ; 30 * nord, 30 * est> and record Bact = { DAP:float, DAPe:float } and record BactG = Bact + { bactG } and record BactS = Bact + { bactS} ;;

fun iota_v(v,n) = map((\x.v), iota(n,seq:())) ;; fun new_grid(v) = iota_v(iota_v(v,N), N) following |nord>, |est> ;;

fun majBactG[DAPexport = 0.2, DAPimport = 0.2, DAPconso= 1, SupDiff = 2.4, InfDiff = 2.02 ](x) =

	if ( ( x.DAP > InfDiff ) & ( x.DAP < SupDiff ) & (random(1) < 0.8) ) then

{DAP = x.DAP , DAPe = x.DAPe, bactS} else let dap = if x.DAP - DAPconso > 0 then x.DAP - DAPconso else 0 fi and dape= x.DAPe in if dap > dape then

                   x + {DAP = dap - DAPexport * dap, DAPe = dape + DAPexport * dap }

else x + {DAP = dap + DAPimport * dape, DAPe = dape - DAPimport * dape }

                 fi
       fi 

fun majBactS[DAPexport = 0.2, DAPimport = 0.2, DAPprod=10](x) = let dap = x.DAP + DAPprod and dape= x.DAPe in if dap > dape then

                   x + {DAP = dap - DAPexport * dap, DAPe = dape + DAPexport * dap }

else x + {DAP = dap + DAPimport * dape, DAPe = dape - DAPimport * dape }

                 fi


trans evol[Delta_t=0.1,DAPeDiff=1, DAPeDegrad = 0.2] = {


 (* production of DAP *)
 x:BactS => ( 

let d = neighborsfold(

     (\y.\acc.( DAPeDiff*Delta_t*(y.DAPe-x.DAPe) + acc)),
     x.DAPe,
     x)
   in majBactS( x + {DAPe = if ( d - DAPeDegrad * x.DAPe) > 0 then d - DAPeDegrad * x.DAPe else 0 fi } )
     );
 (* Diffirentiation and Consumption *)
x:BactG => ( 

let d = neighborsfold(

     (\y.\acc.( DAPeDiff*Delta_t*(y.DAPe-x.DAPe) + acc)),
     x.DAPe,
     x)
   in majBactG(x + {DAPe = if ( d - DAPeDegrad * x.DAPe) > 0 then  d - DAPeDegrad * x.DAPe else 0 fi } )
   
 )

} ;;



g := new_grid({DAP=6.0, DAPe=3.0, bactG}) ; 0 ;; g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;; g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;; g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;; g := set_gbfpos(g, (random(30)*|nord> + random(30)*|est>), {DAP = 6.0, DAPe=3.0, bactS}) ;; evol[iter=1000,interlude=GBVexport((\v.("DAPe = " + (12 * v.DAPe ) + if BactS(v) then ", bactS= 255" else ", bactG = 255" fi )))](g) ;;