Exemple #1
0
void species::resetToInitConc(acs_double tmpVolumeBeforeDivision, acs_double tmpVolume, bool tmpRndConcentration, acs_double tmpTheta, acs_int tmpStochDivision, MTRand& tmp_rndDoubleGen){

	if(tmpTheta == 0) // IF division is not considered
	{
		concentration=firstConcentration;
		concToNum(tmpVolume, tmp_rndDoubleGen);
		if(tmpRndConcentration){amount = random_poisson(acs_double(amount),tmp_rndDoubleGen);}
		numToConc(tmpVolume);
	}else{
		if(!concentrationFixed)
		{
			if (amount >= 1)
			{
				if(tmpStochDivision==1) // IF stochastic division
				{
					amount = random_poisson(acs_double(amount/(tmpVolumeBeforeDivision/tmpVolume)),tmp_rndDoubleGen);
					numToConc(tmpVolume);
				}else{
					if(amount > 1){amount = acsround((acs_double)amount/(tmpVolumeBeforeDivision/tmpVolume),tmp_rndDoubleGen);}
					else{if(tmp_rndDoubleGen() < (tmpVolume/tmpVolumeBeforeDivision)){amount = 1;}else{amount = 0;}}
					numToConc(tmpVolume);
				}
			}else{
				if(amount != 0){
					ExitWithError("species::resetToInitConc","FATAl ERROR: The amount the molecules should be 0!!!");
				}
			}
		}else{
			concToNum(tmpVolume,tmp_rndDoubleGen);
		}
	}
}
Exemple #2
0
static GnmValue *
gnumeric_randpoisson (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
{
	gnm_float x = value_get_as_float (argv[0]);

	if (x < 0)
		return value_new_error_NUM (ei->pos);

        return value_new_float (random_poisson (x));
}
static gboolean
tool_random_engine_run_poisson (data_analysis_output_t *dao,
				tools_data_random_t *info,
				poisson_random_tool_t *param)
{
	int i, n;
	for (i = 0; i < info->n_vars; i++) {
		for (n = 0; n < info->count; n++) {
			gnm_float v;
			v = random_poisson (param->lambda);
			dao_set_cell_float (dao, i, n, v);
		}
	}
	return FALSE;
}
Exemple #4
0
/** \brief This constructor is used when a new species is uploaded from file (CONCENTRATION BASED). Currently we are using this one
 @param tmpID species identificator
 @param tmpSequence species sequence (e.g. ABABAABABA)
 @param tmpAmount species initial amount of molecules
 @param tmpReactions_constant ????
 */
species::species(acs_longInt tmpID, string tmpSequence, acs_double tmpConcentration, acs_double tmpDiffusionEnh, 
				 acs_int tmpSoluble, acs_double tmpComplexDegEnh, acs_int tmpComplexCuttingPoint, 
				 acs_int tmpEvalueted, acs_double tmpAge, acs_int tmpReborns, acs_double tmpVolume, 
                 acs_longInt tmpNotUsedCatID, acs_longInt tmpNotUsedSubID, acs_double tmpK_phospho,
                 acs_double tmpKLoadConc, acs_int tmpLockConc, acs_double tmpInflux_rate, acs_int tmpMaxLOut,
                 bool tmpRndConcentration, acs_double tmpAlpha, MTRand& tmp_RndDoubleGen, int tmpSystemArchitecture)
{
	cout << "\t|- CONCENTRATION BASED SPECIES CONSTRUCTOR FROM FILE -|\n";

	id = tmpID;
	sequence = tmpSequence;
	chargedMols = round(tmpKLoadConc*tmpVolume*AVO);
	age = tmpAge;
	reborns = tmpReborns;
	diffusionEnh =tmpDiffusionEnh;
	soluble = tmpSoluble;
	complexDegradationEnh = tmpComplexDegEnh;
	complexCuttingPoint = tmpComplexCuttingPoint;
	evaluated = tmpEvalueted;
	catalyst_ID = tmpNotUsedCatID;
	substrate_ID = tmpNotUsedSubID;
	K_phospho = tmpK_phospho;
	energizable = tmpLockConc;
	
	// CONCENTRATION SETTINGS
    //cout << "concentration based random concentration: " << tmpRndConcentration << endl;
	//cin.ignore().get();
	concentration = tmpConcentration;
	concToNum(tmpVolume, tmp_RndDoubleGen);
	if(tmpRndConcentration){amount = random_poisson(acs_double(amount),tmp_RndDoubleGen);}
	numToConc(tmpVolume);

	// Set concentrationFixed proprerty
	// concentrationFixed = false;
	// if((tmpInflux_rate == 0) && (tmpMaxLOut > 0)){ if(sequence.length() <= tmpMaxLOut) concentrationFixed = true;}
	if (tmpSystemArchitecture == PROTOCELLFLUXBUFFERED)
	{
		if(tmpLockConc == 1) concentrationFixed = true;
		else concentrationFixed = false;
	}else{concentrationFixed = false;}

    firstConcentration = tmpConcentration; // If the species is loaded from file that's the very initial concentration
    lastSpeciesEvaluated = 0;
    alpha = tmpAlpha;

}
Exemple #5
0
/** \brief This constructor is used when a new species is uploaded from file (TOTAL AMOUNT BASED)
 @param tmpID species identificator
 @param tmpSequence species sequence (e.g. ABABAABABA)
 @param tmpAmount species initial amount of molecules
 @param tmpReactions_constant ????
 */
species::species(acs_longInt tmpID, string tmpSequence, acs_longInt tmpAmount, acs_double tmpDiffusionEnh, 
				 acs_int tmpSoluble, acs_double tmpComplexDegEnh, acs_int tmpComplexCuttingPoint, 
				 acs_int tmpEvalueted, acs_double tmpAge, acs_int tmpReborns, acs_double tmpVolume, 
                 acs_longInt tmpNotUsedCatID, acs_longInt tmpNotUsedSubID, acs_double tmpK_phospho,
                 acs_int tmpEnergizable, acs_double tmpInflux_rate, acs_int tmpMaxLOut,
                 bool tmpRndConcentration, acs_double tmpAlpha, MTRand& tmp_RndDoubleGen)
{

	id = tmpID;
	sequence = tmpSequence;
	amount = tmpAmount;
	chargedMols = 0;
    numToConc(tmpVolume); // The concetration is set within this function
	age = tmpAge;
	reborns = tmpReborns;
	diffusionEnh =tmpDiffusionEnh;
	soluble = tmpSoluble;
	complexDegradationEnh = tmpComplexDegEnh;
	complexCuttingPoint = tmpComplexCuttingPoint;
	evaluated = tmpEvalueted;
	catalyst_ID = tmpNotUsedCatID;
	substrate_ID = tmpNotUsedSubID;
	K_phospho = tmpK_phospho;
	energizable = tmpEnergizable;
	
	//cout << "concentration based random concentration: " << tmpRndConcentration << endl;
	//cin.ignore().get();
	if(tmpRndConcentration){amount = random_poisson(acs_double(amount),tmp_RndDoubleGen);}
	numToConc(tmpVolume);

	// Set concentrationFixed propriety
	concentrationFixed = false;
	if((tmpInflux_rate == 0) && (tmpMaxLOut > 0)){ if(sequence.length() <= tmpMaxLOut) concentrationFixed = true;}

    firstConcentration = concentration; // If the species is loaded from file that's the very initial concentration
    lastSpeciesEvaluated = 0;
    alpha = tmpAlpha;
	
}