EcoliSimulator  2.0.1a
E_coli Class Reference

Base Class for a bacterium: It implements the virtual function to evolve the dynamic of the bacterium. More...

#include <E_Coli.h>

Inheritance diagram for E_coli:
ParameterEstimation_E_coli CV_rExp_tExp EO_rExp_tExp Molecular_rExp_tExp CV_rIG_tExp ParameterEstimation_CV_rExp_tExp EO_rIG_tExp Molecular_rIG_tExp CV_rExpIG_tExp ParameterEstimation_CV_rIG_tExp EO_rExpIG_tExp Molecular_rExpIG_tExp

Public Member Functions

 E_coli ()
 
 E_coli (const E_coli &modello)
 
int initial_position_ec (int j, std::array< double, 2 > x0, double Raggio, int num_dist, int &cont_dist_5, int delta_dist_cont, double Delta_delta_dist)
 
int dist_iniz_ec (std::array< double, 2 > x0, double R, unsigned int num_dist)
 
std::array< double, 2 > X ()
 
double V ()
 
int N_dyn_var ()
 
double C ()
 
double C_iniziale ()
 
double Production_rate ()
 
void setProductionRate (double _prodRate)
 
void Tau_t (double tt_)
 
void Get_tipo_response_c (int T_r)
 
void Get_RC_0 (double Rc0)
 
void Get_RC_1 (double Rc1)
 
void Get_RC_q (int Rcq)
 
int F_tipo_response_c ()
 
double F_RC_0 ()
 
double F_RC_1 ()
 
double F_RC_q ()
 
void set_response (int ftipo_response_c, double fRC_0, double fRC_1, int fRC_q)
 
void agg_ligand (double t, Funz_C *f)
 
void aggiornamento (double dt, double t, Funz_C *f, int &sign_p, ofstream *file_tau, std::ofstream &file_theta)
 
void start_simulation (Funz_C *f)
 
void response_function ()
 
void save_E_coli (ofstream *file, double t)
 
void save_E_coli_initial (std::ofstream *file_, double t)
 
void save_run (double t, ofstream &file_salto, double dt)
 
void save_tumble (double t, ofstream &file_tumble, double dt)
 
void save_theta (double t, double theta, std::ofstream &file_run)
 
virtual void change_par (int change)
 
virtual void reset_par ()
 
virtual void stationary_dyn (double dt, std::vector< double > &m0, int changed_pos)
 
virtual int agg_dyn (double dt, double t)
 
virtual int saveIntDyn (std::string nameFile)
 
virtual void agg_dyint (double dt, double t)
 
virtual void produce (Funz_C *f_i, double dt)
 
virtual double reset_barrier ()
 
virtual double reset_barrier_t ()
 
virtual void save_dyn (ofstream &file, double t)
 
virtual void gnuplot_single (std::string *names_files_Ecoli_mod, std::string &names_indice_mod, std::string *names_files_tau_mod, std::string &names_file_dyn_mod, std::string *names_info_mod, double T_f, Funz_C *f, int save_, int con_gen_sim)
 
virtual void gnuplot_single_film (std::string *names_files_Ecoli_mod, std::string &names_indice_mod, std::string *names_files_tau_mod, std::string &names_file_dyn_mod, std::string *names_info_mod, double T_f, Funz_C *f, int cont_sim)
 
virtual void gnuplot_single_film_gif (std::string *names_files_Ecoli_mod, std::string &names_indice_mod, std::string *names_files_tau_mod, std::string &names_file_dyn_mod, std::string *names_info_mod, double T_f, Funz_C *f, int cont_sim)
 produce the .gif film More...
 
virtual void print_info (std::ofstream &file_save)
 
virtual void gnuplotFunzInternalDynalmic (std::string buffer, int save_, int con_gen_sim)
 
virtual void gnuplot_response (std::string names_info_mod, int save_, int con_gen_sim)
 
virtual void set_GoodnessFit (int Good, double D_n, double cumD_n)
 
virtual void s_F_lambda_r (std::vector< Q_tau_stat > vector_lambda, int n_vect)
 
void statF_lambda_r (s_lambda &vector_lambda)
 
virtual void debugFunction ()
 

Public Attributes

std::mt19937_64 * engine_theta
 pointer to a engine (if I want to use std::uniform_real_distribution<double>) More...
 
std::mt19937_64 * engine_barrier
 
std::mt19937_64 * engine_altro
 
int simulation
 
std::string Tipo_batterio
 
int codice_batterio
 
s_lambda s_lambda_r
 

Protected Member Functions

void setSeed_ec (unsigned int *seed_thread)
 
virtual int writeScriptgnuplotSingle (std::string tipo, std::string *names_files_Ecoli_mod, std::string *names_files_tau_mod, std::string *names_info_mod, std::string &names_file_dyn_mod, double T_f, int con_gen_sim, int save_)
 
virtual int writeScriptLunchgnuplotSingle (std::string tipo, int save_, int con_gen_sim)
 
double Exp_dist_ec ()
 
double rand_normal_ec (double stddev)
 
double gamma_par_double_ec ()
 
double unifRand_ec ()
 
double deltaW_ec (double dt)
 
double newtheta_ec (double theta)
 
void setEngine_ec (std::mt19937_64 *engine_thread_theta, std::mt19937_64 *engine_thread_bar, std::mt19937_64 *engine_thread_altro)
 

Protected Attributes

double production_rate
 
double v
 
std::array< double, 2 > x
 
double theta
 
double c
 
double D_theta
 
double lambda_r
 
double lambda_t
 
double tau_r
 
double tau_t
 
int n_dyn_var
 
double barriera_r
 
double barriera_t
 
int salto_
 
double t_t
 
double t_r
 
int sign_c
 
int up_down
 
double c_iniziale
 
int tipo_response_c
 
double RC_0
 
double RC_1
 
int RC_q
 
int tipoNewTheta
 
unsigned int * seed_ecoli
 pointer to a seed More...
 

Detailed Description

Base Class for a bacterium: It implements the virtual function to evolve the dynamic of the bacterium.

Constructor & Destructor Documentation

E_coli::E_coli ( )
E_coli::E_coli ( const E_coli modello)

Member Function Documentation

void E_coli::agg_dyint ( double  dt,
double  t 
)
virtual

update internal dynamic

Reimplemented in CV_rExp_tExp, Molecular_rExp_tExp, and EO_rExp_tExp.

int E_coli::agg_dyn ( double  dt,
double  t 
)
virtual

update dynamic to control run/tumble
It controll the hitting time $\tau_{n+1}$ of the inernal variable lambda_[...] Heuristically we have:

  • if the distribution is exponential we have
    • $\int_{\tau_{n}}^{\tau_{n+1}}\Lambda^*(s)ds\sim Exp(1)$
  • if the distribution is IG we have
    • $\tau_{n+1}=\inf\{s>\tau_n:\Lambda(s)ds\geq const\}$
  • if the distribution is Exp_IG we have
    • $\tau_{n+1}=\inf\{s>\tau_n:\Lambda(s)ds\geq Exp(1)\}$

Where in general we can write: $d\Lambda(s)=\lambda(s)dt+\sigma(s)dW(t)$.
note $\sigma(s)=0$ in the first case above.

Reimplemented in CV_rExp_tExp, Molecular_rExp_tExp, EO_rExp_tExp, CV_rIG_tExp, EO_rIG_tExp, and Molecular_rIG_tExp.

void E_coli::agg_ligand ( double  t,
Funz_C f 
)

update ligand concentration

void E_coli::aggiornamento ( double  dt,
double  t,
Funz_C f,
int &  sign_p,
ofstream *  file_tau,
std::ofstream &  file_theta 
)

update all the parameters of the bacterium during the simulation

double E_coli::C ( )

return current ligand concentration

double E_coli::C_iniziale ( )

return initial ligand concentration

void E_coli::change_par ( int  change)
virtual
void E_coli::debugFunction ( )
virtual

Reimplemented in CV_rExp_tExp, and CV_rIG_tExp.

double E_coli::deltaW_ec ( double  dt)
protected
int E_coli::dist_iniz_ec ( std::array< double, 2 >  x0,
double  R,
unsigned int  num_dist 
)
double E_coli::Exp_dist_ec ( )
protected
double E_coli::F_RC_0 ( )

return 1st coefficient

double E_coli::F_RC_1 ( )

return 2nd coefficient

double E_coli::F_RC_q ( )

return 3rd coefficient

int E_coli::F_tipo_response_c ( )

return current type of response

double E_coli::gamma_par_double_ec ( )
protected
void E_coli::Get_RC_0 ( double  Rc0)

set 1st coefficient

void E_coli::Get_RC_1 ( double  Rc1)

set 2nd coefficient

void E_coli::Get_RC_q ( int  Rcq)

set 3rd coefficient

void E_coli::Get_tipo_response_c ( int  T_r)

set type of response

Parameters
tt_type of response
void E_coli::gnuplot_response ( std::string  names_info_mod,
int  save_,
int  con_gen_sim 
)
virtual

plot response: empty function ... not yet implemented

Empty function

void E_coli::gnuplot_single ( std::string *  names_files_Ecoli_mod,
std::string &  names_indice_mod,
std::string *  names_files_tau_mod,
std::string &  names_file_dyn_mod,
std::string *  names_info_mod,
double  T_f,
Funz_C f,
int  save_,
int  con_gen_sim 
)
virtual

plot via gnuplot trajectory and data for single tracking

Reimplemented in CV_rExp_tExp, and EO_rExp_tExp.

void E_coli::gnuplot_single_film ( std::string *  names_files_Ecoli_mod,
std::string &  names_indice_mod,
std::string *  names_files_tau_mod,
std::string &  names_file_dyn_mod,
std::string *  names_info_mod,
double  T_f,
Funz_C f,
int  cont_sim 
)
virtual

save and produce film of single tracking

void E_coli::gnuplot_single_film_gif ( std::string *  names_files_Ecoli_mod,
std::string &  names_indice_mod,
std::string *  names_files_tau_mod,
std::string &  names_file_dyn_mod,
std::string *  names_info_mod,
double  T_f,
Funz_C f,
int  cont_sim 
)
virtual

produce the .gif film

save and produce film of single tracking in .gif

void E_coli::gnuplotFunzInternalDynalmic ( std::string  buffer,
int  save_,
int  con_gen_sim 
)
virtual

plot internal dynamic

int E_coli::initial_position_ec ( int  j,
std::array< double, 2 >  x0,
double  Raggio,
int  num_dist,
int &  cont_dist_5,
int  delta_dist_cont,
double  Delta_delta_dist 
)

This function set the initial position. What it does is: if the distribution is the n. 5, then update the new center, otherwise it calls dist_iniz(x,x0,Raggio,num_dist).

Parameters
x[]position of pacterium (to be set)
x0[]initial position, set in the menu
Rradius distribution
typeof distribution, see menu
Returns
if the initial position change return 1, otherwise 0. If the position didn't change the initial condition for this bacterium are the same as the previous one, so we don't have to perform initial-condition calculation.
int E_coli::N_dyn_var ( )

return number of internal variables in the current model

double E_coli::newtheta_ec ( double  theta)
protected
void E_coli::print_info ( std::ofstream &  file_save)
virtual
void E_coli::produce ( Funz_C f_i,
double  dt 
)
virtual

update concentration ligand after production (in interacting mode)

double E_coli::Production_rate ( )

retun rate of production of new ligand concentration by the bacterium

double E_coli::rand_normal_ec ( double  stddev)
protected
double E_coli::reset_barrier ( )
virtual

reset trashold for the run

Reimplemented in EO_rIG_tExp, CV_rIG_tExp, Molecular_rIG_tExp, CV_rExpIG_tExp, Molecular_rExpIG_tExp, and EO_rExpIG_tExp.

double E_coli::reset_barrier_t ( )
virtual

reset trashold for the tumble

void E_coli::reset_par ( )
virtual
void E_coli::response_function ( )

update the current concentration via the response function

void E_coli::s_F_lambda_r ( std::vector< Q_tau_stat vector_lambda,
int  n_vect 
)
virtual

initialize and save the empirical satisfaction index (function lambda)

void E_coli::save_dyn ( ofstream &  file,
double  t 
)
virtual

save internal dynamic in a file

void E_coli::save_E_coli ( ofstream *  file,
double  t 
)

save position, concentration and direction to file

void E_coli::save_E_coli_initial ( std::ofstream *  file_,
double  t 
)
void E_coli::save_run ( double  t,
ofstream &  file_salto,
double  dt 
)

save time and duration of a run

void E_coli::save_theta ( double  t,
double  theta,
std::ofstream &  file_run 
)

function used to save the angle at the moment of a tumble.

void E_coli::save_tumble ( double  t,
ofstream &  file_tumble,
double  dt 
)

save time and duration of a tumble

Parameters
dttime-step in the simulation
int E_coli::saveIntDyn ( std::string  nameFile)
virtual
void E_coli::set_GoodnessFit ( int  Good,
double  D_n,
double  cumD_n 
)
virtual

save outpot of goodness fit test

Reimplemented in ParameterEstimation_E_coli.

void E_coli::set_response ( int  ftipo_response_c,
double  fRC_0,
double  fRC_1,
int  fRC_q 
)

set response function

Parameters
typeand coefficient (from 1st to last)
void E_coli::setEngine_ec ( std::mt19937_64 *  engine_thread_theta,
std::mt19937_64 *  engine_thread_bar,
std::mt19937_64 *  engine_thread_altro 
)
protected
void E_coli::setProductionRate ( double  _prodRate)

set production rate (it is a static variable, once for all!)

void E_coli::setSeed_ec ( unsigned int *  seed_thread)
protected
void E_coli::start_simulation ( Funz_C f)

set initial data for the simulation

void E_coli::statF_lambda_r ( s_lambda vector_lambda)
void E_coli::stationary_dyn ( double  dt,
std::vector< double > &  m0,
int  changed_pos 
)
virtual

calculate stationary dynamics for the initial condition

Parameters
m0are the initial condition for the internal variables: if changed_pos says that the initial condition are not changed, for example if the initial distribution for the population is a delta dirac, then we just use the old values, and do not recalculate them

Reimplemented in CV_rExp_tExp, Molecular_rExp_tExp, and EO_rExp_tExp.

void E_coli::Tau_t ( double  tt_)

set time start of a tumble

Parameters
tt_time in sec.
double E_coli::unifRand_ec ( )
protected
double E_coli::V ( )
inline

return speed bacterium

int E_coli::writeScriptgnuplotSingle ( std::string  tipo,
std::string *  names_files_Ecoli_mod,
std::string *  names_files_tau_mod,
std::string *  names_info_mod,
std::string &  names_file_dyn_mod,
double  T_f,
int  con_gen_sim,
int  save_ 
)
protectedvirtual

write the script for the gnuplot of single bacterium

Reimplemented in CV_rExp_tExp, and EO_rExp_tExp.

int E_coli::writeScriptLunchgnuplotSingle ( std::string  tipo,
int  save_,
int  con_gen_sim 
)
protectedvirtual
array< double, 2 > E_coli::X ( )

return position bacterium

Member Data Documentation

double E_coli::barriera_r
protected

threshold for lambda_r (when lambda_r crosses it, tumble starts)

double E_coli::barriera_t
protected

threshold for lambda_t (when lambda_r crosses it, run starts)

double E_coli::c
protected

Ligand concentration

double E_coli::c_iniziale
protected

initial concentration of Ligand

int E_coli::codice_batterio
double E_coli::D_theta
protected

Diffusion coefficient direction

std::mt19937_64* E_coli::engine_altro
std::mt19937_64* E_coli::engine_barrier
std::mt19937_64* E_coli::engine_theta

pointer to a engine (if I want to use std::uniform_real_distribution<double>)

double E_coli::lambda_r
protected

probability rate to tumble

double E_coli::lambda_t
protected

probability rate to run

int E_coli::n_dyn_var
protected

number internal variables

double E_coli::production_rate
protected

Production rate bacterium

double E_coli::RC_0
protected

1st paramter in the response function

double E_coli::RC_1
protected

2nd paramter in the response function

int E_coli::RC_q
protected

3rd paramter in the response function: esponent in th Hill function

s_lambda E_coli::s_lambda_r

estimated parameter for the function lambda

int E_coli::salto_
protected

variable identifying in which state I'm in run_fase == 1, tumble_fase == 2, jump_instant == 0, tumble_fase == -1

unsigned int* E_coli::seed_ecoli
protected

pointer to a seed

The idea is the following: At the beginning of every simulation I seed the extra-thread

  • if I use a nomal 1-thread then nothing change from the 'basic implmentation', I just move the random generation function inside the class E_coli.
  • if I use multi-thread, for each thread I create a new seed_ecoli, which I pass to rand_r(&seed_ecoli) in this case I have independent sereis of Random Numebr for every thread.
int E_coli::sign_c
protected

sign of the "temporal gradient": c(now) - c(now-dt)

int E_coli::simulation

MODE of simulation:

  • simulation = 0 -> MODE simulation,
  • simulation = 1 -> MODE statistical_Simulation ...
double E_coli::t_r
protected

time began run

double E_coli::t_t
protected

time began tumble

double E_coli::tau_r
protected

mean of a run in the steady state

double E_coli::tau_t
protected

mean of a tumble in the steady state

double E_coli::theta
protected

Direction

std::string E_coli::Tipo_batterio

Name of the model used
the format in as follows: [Name Model]_r[Name Distribution run]_t[Name Distribution tumble]

int E_coli::tipo_response_c
protected

Type of reponse function between the available

int E_coli::tipoNewTheta
protected

This variable take track of the for of the distribution of the new theta

int E_coli::up_down
protected

variable that keep track if I'm going up or down the gradient

double E_coli::v
protected

Speed bacterium

std::array<double,2> E_coli::x
protected

Position


The documentation for this class was generated from the following files: