|
Nemo
2.2.0
|
This class contains traits along with other individual information (sex, pedigree, etc. ). More...
#include <individual.h>
Collaboration diagram for Individual:Public Types | |
| typedef int | IDX |
Public Member Functions | |
| Individual () | |
| ~Individual () | |
| Individual * | init () |
| Inits parameters and traits. | |
| void | reset () |
| Resets parameters and traits values. | |
| void | show_up () |
| Write some info to stdout. | |
| Individual * | clone () |
| Cloning procedure, clones all the traits present in the individual. | |
Setters | |
| void | setID (unsigned long value) |
| void | setAge (unsigned short value) |
| void | Aging () |
| void | setFatherID (unsigned long value) |
| void | setMotherID (unsigned long value) |
| void | setFather (Individual *f) |
| void | setMother (Individual *m) |
| void | setHome (unsigned short value) |
| void | setSex (sex_t sex) |
| void | setCurrentID (unsigned long value) |
| void | setIsSelfed (bool s) |
| void | setPedigreeClass (Individual *mother, Individual *father) |
| void | setPedigreeClass (unsigned char ped) |
Getters | |
| unsigned long | getID () |
| unsigned short | getAge () |
| unsigned long | getFatherID () |
| unsigned long | getMotherID () |
| Individual * | getFather () |
| Individual * | getMother () |
| unsigned short | getHome () |
| sex_t | getSex () |
| bool | isFemale () |
| bool | getIsSelfed () |
| unsigned long | getcurrentID () |
| double | getFecundity () |
| unsigned short | getMatings (unsigned int cat) |
| Gives the number of matings that individual had with mates from a given pedigree class. | |
| unsigned short | getLocalMatings () |
| Gives the number of times an individual mated with an individual from the same patch. | |
| unsigned int | getTotMatings () |
| Gives the total number of matings of an individual. | |
| unsigned short | getRealizedFecundity (unsigned int cat) |
| Gives the number of surviving offspring for a given pedigree class of mating. | |
| unsigned int | getLocalRealizedFecundity () |
| Gives the total number of surviving offspring when mating occures with mates of the same patch. | |
| unsigned int | getTotRealizedFecundity () |
| Gives the total number of surviving offspring for all categories of mating. | |
| unsigned int | getPedigreeClass () |
| Returns the pedigree class of the individual, as set during offspring creation. | |
| unsigned int | getPedigreeClass (Individual *mother, Individual *father) |
| Returns the pedigree class of two individuals. | |
implementation | |
| void | store_data (BinaryStorageBuffer *saver) |
| void | retrieve_data (BinaryStorageBuffer *reader) |
Matings and Fecundity | |
| double | setFecundity (double value) |
| Sets the fecundity to the value given and returns it. | |
| void | reset_counters () |
| Resets the mating and fecundity counters. | |
| void | addMating (unsigned int category) |
| Increments the mating counter according to the pedigree class of the offspring. | |
| void | DidHaveABaby (unsigned int category) |
| Increments the mating and realized fecundity counters according to the pedigree class of the offspring. | |
| double | getFecWithHomePatchMate () |
| Returns the proportion of succesfull local matings (i.e. | |
| double | getFecWithOtherPatchMate () |
| Returns the proportion of successfull remote matings. | |
Trait interface | |
| unsigned int | getTraitNumber () |
| Accessor to the size of the traits table. | |
| std::deque< TTrait * > & | getTraits () |
| Accessot to the traits table itself. | |
| void * | setTrait (IDX T, void *value) |
| Sets the phenotype/value of a trait to a particular value. | |
| void | setTraitValue (IDX T) |
| Calls the value setting procedure of a particular trait. | |
| void | setTraitValue () |
| Calls the value setting procedure of all traits present in an individual. | |
| void * | getTraitValue (IDX T) |
| Accessor to the value (phenotype) of a particular trait. | |
| TTrait * | getTrait (IDX T) |
| Trait accessor. | |
| void | addTrait (TTrait *theTrait, IDX pos) |
| Adds a trait to the table. | |
| void | removeTrait (IDX T) |
| Removes a trait from the table. | |
| void | clearTraits () |
| Clears the traits container. | |
| void | inheritTrait (IDX T, Individual *mother, Individual *father) |
| Calls the inheritance procedure of a particular trait. | |
| void | mutateTrait (IDX T) |
| Calls the mutation procedure of a particular trait. | |
| void | createTrait (IDX i, Individual *mother, Individual *father) |
| Sets a particular trait's genotype and phenotype values from the two parents. | |
| Individual * | createTrait (IDX i, bool do_inherit, bool do_mutate) |
| Creates an individual's genotypes and phenotypes with optional recombination or mutations on one trait only. | |
| Individual * | create_first_gen () |
| Creates an individual's genotypes and phenotypes for first generation. | |
| Individual * | create () |
| Creates an individual's genotypes and phenotypes with recombination and mutations. | |
| Individual * | create (bool do_inherit, bool do_mutate) |
| Creates an individual's genotypes and phenotypes with optional recombination or mutations. | |
| Individual * | create (Individual *mother, Individual *father) |
| Creates an individual, inherit, mutate and set all its trait's values. | |
| void | inherit (Individual *mother, Individual *father) |
| Calls the inheritance procedure of all the traits present in the individual. | |
| void | mutate () |
| Calls the mutation procedure of all the traits present in the individual. | |
Operators | |
| Individual & | operator= (const Individual &i) |
| Assignment, make a deep copy of the parameter values and traits. | |
| bool | operator== (const Individual &i) |
| Only checks for traits equivalence. | |
| bool | operator!= (const Individual &i) |
Public Attributes | |
| std::deque< TTrait * > | Traits |
| The traits table. | |
Static Public Attributes | |
| static unsigned long | currentID = 0 |
| The ID counter, reset at the beginning of each simulation. | |
Private Attributes | |
| unsigned long | _id |
| ID tag, unique for one simulation. | |
| unsigned short | _age |
| Age. | |
| sex_t | _sex |
| Sex tag. | |
| unsigned long | _motherID |
| Parents ID tags. | |
| unsigned long | _fatherID |
| Individual * | _mother |
| Parents pointers. | |
| Individual * | _father |
| unsigned short | _home |
| Natal Patch tag. | |
| unsigned char | _pedigreeClass |
| Pedigree class of the individual. | |
| double | _fecundity |
| Assigned fecundity. | |
| unsigned short | _matings [5] |
| Mating counter. | |
| unsigned short | _realizedFecundity [5] |
| Number of surviving offspring from the different mating categories (see matings). | |
| unsigned int | _trait_nb |
| Number of traits in the table. | |
This class contains traits along with other individual information (sex, pedigree, etc. ).
The Individual class can be view as a trait container. It encapsulates the basic interface to manipulate the traits an individual is carrying like initialization, inheritance, mutation and phenotype getter. It also stores the basic individual info like its sex, pedigree (home Patch, mather and father id, etc.) and its mating and fecundity values. It is not a StorableComponent but declares a similar interface to store and retrieve all the previous info to/from a binary file. All individuals in a simulation are instantiated by a call to the IndFactory class (through its derived class Metapop) which contains the individual and traits prototypes.
Definition at line 48 of file individual.h.
| typedef int Individual::IDX |
Definition at line 82 of file individual.h.
| Individual::Individual | ( | ) |
Definition at line 41 of file individual.cc.
References _id, _matings, _realizedFecundity, and currentID.
Referenced by clone().
: _age(0), _sex(MAL),_motherID(0),_fatherID(0),_mother(NULL),_father(NULL), _home(0),_pedigreeClass(0),_fecundity(0),_trait_nb(0) { _id = currentID++; for(unsigned int i = 0; i < 5; i++) { _matings[i] = 0; _realizedFecundity[i] = 0; } }
| Individual::~Individual | ( | ) | [inline] |
| void Individual::addMating | ( | unsigned int | category | ) | [inline] |
Increments the mating counter according to the pedigree class of the offspring.
| category | the pedigree class of the offspring |
Definition at line 215 of file individual.h.
References _matings.
Referenced by LCE_Breed_Selection::makeOffspringWithSelection().
{ _matings[category]++; }
Adds a trait to the table.
| theTrait | pointer to the trait to add |
| pos | the position where the trait should be added in the traits table. Used to check that the index of the trait in the table is correctly set. |
Definition at line 284 of file individual.h.
References _trait_nb, fatal(), and Traits.
Referenced by clone().
| void Individual::Aging | ( | ) | [inline] |
| void Individual::clearTraits | ( | ) | [inline] |
Clears the traits container.
Definition at line 296 of file individual.h.
References _trait_nb, and Traits.
Referenced by ~Individual().
| Individual * Individual::clone | ( | ) |
Cloning procedure, clones all the traits present in the individual.
Definition at line 149 of file individual.cc.
References _trait_nb, addTrait(), Individual(), and Traits.
Referenced by IndFactory::makeNewIndividual().
{
Individual* myClone = new Individual();
for(unsigned int i = 0; i < _trait_nb; i++)
myClone->addTrait(Traits[i]->clone(), i);
return myClone;
}
| Individual* Individual::create | ( | ) | [inline] |
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition at line 353 of file individual.h.
References _father, _mother, inherit(), mutate(), and setTraitValue().
Referenced by IndFactory::makeOffsprg(), and LCE_Breed_base::makeOffspring().
{
inherit(_mother, _father);
mutate();
setTraitValue();
return this;
}
| Individual* Individual::create | ( | bool | do_inherit, |
| bool | do_mutate | ||
| ) | [inline] |
Creates an individual's genotypes and phenotypes with optional recombination or mutations.
| do_inherit | if true, do traits inheritance and recombination |
| do_mutate | if true, performs mutation of the traits |
Definition at line 363 of file individual.h.
References _father, _mother, inherit(), mutate(), and setTraitValue().
{
if(do_inherit) inherit(_mother, _father);
if(do_mutate) mutate();
setTraitValue();
return this;
}
| Individual* Individual::create | ( | Individual * | mother, |
| Individual * | father | ||
| ) | [inline] |
Creates an individual, inherit, mutate and set all its trait's values.
| mother | the mother |
| father | the father |
Definition at line 374 of file individual.h.
References _trait_nb, fatal(), getTrait(), TTrait::inherit(), TTrait::mutate(), TTrait::set_value(), and Traits.
| Individual* Individual::create_first_gen | ( | ) | [inline] |
Creates an individual's genotypes and phenotypes for first generation.
Definition at line 339 of file individual.h.
References _fatherID, _motherID, _trait_nb, and Traits.
Referenced by Patch::setNewGeneration().
{
for(unsigned int i = 0; i < _trait_nb; i++) {
Traits[i]->init_sequence();
Traits[i]->set_value();
}
//we have to set the parents ids otherwise the first offspring generation will be made of full sibs only.
static unsigned long ID = std::numeric_limits< unsigned long >::max();
_motherID = ID--;
_fatherID = ID--;
return this;
}
| void Individual::createTrait | ( | IDX | i, |
| Individual * | mother, | ||
| Individual * | father | ||
| ) | [inline] |
Sets a particular trait's genotype and phenotype values from the two parents.
Includes its inheritance, mutation and value setting.
| i | the index of the trait to create in the traits table |
| mother | the mother |
| father | the father |
Definition at line 318 of file individual.h.
References fatal(), getTrait(), TTrait::inherit(), TTrait::mutate(), TTrait::set_value(), and Traits.
Referenced by LCE_Breed_Selection::makeOffspringWithSelection().
| Individual* Individual::createTrait | ( | IDX | i, |
| bool | do_inherit, | ||
| bool | do_mutate | ||
| ) | [inline] |
Creates an individual's genotypes and phenotypes with optional recombination or mutations on one trait only.
| i | the index of the trait in the traits' table |
| do_inherit | if true, does inheritance and recombination of the trait |
| do_mutate | if true, performs mutation of the trait |
Definition at line 330 of file individual.h.
References _father, _mother, inheritTrait(), mutateTrait(), and setTraitValue().
{
if(do_inherit) inheritTrait(i, _mother, _father);
if(do_mutate) mutateTrait(i);
setTraitValue(i);
return this;
}
| void Individual::DidHaveABaby | ( | unsigned int | category | ) | [inline] |
Increments the mating and realized fecundity counters according to the pedigree class of the offspring.
| category | the pedigree class of the offspring |
Definition at line 221 of file individual.h.
References _matings, and _realizedFecundity.
Referenced by IndFactory::makeOffsprg(), LCE_Breed_base::makeOffspring(), and LCE_Breed_Selection::makeOffspringWithSelection().
{ _matings[category]++; _realizedFecundity[category]++; }
| unsigned short Individual::getAge | ( | ) | [inline] |
| unsigned long Individual::getcurrentID | ( | ) | [inline] |
| Individual* Individual::getFather | ( | ) | [inline] |
Definition at line 122 of file individual.h.
References _father.
Referenced by LCE_Breed_base::makeOffspring(), and LCE_Breed_Selection::makeOffspringWithSelection().
{return _father;}
| unsigned long Individual::getFatherID | ( | ) | [inline] |
Definition at line 120 of file individual.h.
References _fatherID.
Referenced by getPedigreeClass().
{return _fatherID;}
| double Individual::getFecundity | ( | ) | [inline] |
| double Individual::getFecWithHomePatchMate | ( | ) | [inline] |
Returns the proportion of succesfull local matings (i.e.
those that survived selection).
Definition at line 225 of file individual.h.
References getLocalMatings(), and getLocalRealizedFecundity().
{
unsigned short mate = getLocalMatings();
return (mate != 0 ? (double) getLocalRealizedFecundity()/mate : 0.0);
}
| double Individual::getFecWithOtherPatchMate | ( | ) | [inline] |
Returns the proportion of successfull remote matings.
Definition at line 233 of file individual.h.
References _matings, and _realizedFecundity.
{
return (_matings[0] != 0 ? (double) _realizedFecundity[0]/_matings[0] : 0.0);
}
| unsigned short Individual::getHome | ( | ) | [inline] |
Definition at line 124 of file individual.h.
References _home.
Referenced by TTDeletMutBitstrFH::FHwrite(), getPedigreeClass(), and TTNeutralGenesFH::write_FSTAT().
{return _home;}
| unsigned long Individual::getID | ( | ) | [inline] |
Definition at line 118 of file individual.h.
References _id.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{return _id;}
| bool Individual::getIsSelfed | ( | ) | [inline] |
Definition at line 127 of file individual.h.
References _pedigreeClass.
{return (_pedigreeClass == 4);}
| unsigned short Individual::getLocalMatings | ( | ) | [inline] |
Gives the number of times an individual mated with an individual from the same patch.
Definition at line 143 of file individual.h.
References _matings.
Referenced by getFecWithHomePatchMate(), and getTotMatings().
| unsigned int Individual::getLocalRealizedFecundity | ( | ) | [inline] |
Gives the total number of surviving offspring when mating occures with mates of the same patch.
Definition at line 166 of file individual.h.
References _realizedFecundity.
Referenced by getFecWithHomePatchMate(), and getTotRealizedFecundity().
{
return _realizedFecundity[1]+_realizedFecundity[2]+_realizedFecundity[3]+_realizedFecundity[4];
}
| unsigned short Individual::getMatings | ( | unsigned int | cat | ) | [inline] |
Gives the number of matings that individual had with mates from a given pedigree class.
| cat | the mating category (= the pedigree class of the offspring):
|
Definition at line 138 of file individual.h.
References _matings.
{
return _matings[cat];
}
| Individual* Individual::getMother | ( | ) | [inline] |
Definition at line 123 of file individual.h.
References _mother.
Referenced by LCE_Breed_base::makeOffspring(), and LCE_Breed_Selection::makeOffspringWithSelection().
{return _mother;}
| unsigned long Individual::getMotherID | ( | ) | [inline] |
Definition at line 121 of file individual.h.
References _motherID.
Referenced by getPedigreeClass().
{return _motherID;}
| unsigned int Individual::getPedigreeClass | ( | ) | [inline] |
Returns the pedigree class of the individual, as set during offspring creation.
Definition at line 175 of file individual.h.
References _pedigreeClass.
Referenced by LCE_Selection_base::doViabilitySelection(), TTDeletMutBitstrFH::FHwrite(), LCE_Selection_base::getFitnessFixedEffect(), IndFactory::makeOffsprg(), LCE_Breed_base::makeOffspring(), LCE_Breed_Selection::makeOffspringWithSelection(), setPedigreeClass(), and TTNeutralGenesFH::write_FSTAT().
{
return _pedigreeClass;
}
| unsigned int Individual::getPedigreeClass | ( | Individual * | mother, |
| Individual * | father | ||
| ) |
Returns the pedigree class of two individuals.
| mother | the first individual (e.g.the mother of this individual) |
| father | the second individual (e.g. the father of this individual) |
Definition at line 220 of file individual.cc.
References getFatherID(), getHome(), and getMotherID().
{
if(mother == father) return 4; //selfed
if(mother->getHome() != father->getHome()) return 0; //outbred between patch
unsigned int mm,mf,fm,ff;
//mother's parents:
mm = mother->getMotherID();
mf = mother->getFatherID();
//father's parents:
fm = father->getMotherID();
ff = father->getFatherID();
if(mm != fm && mf != ff) return 1; //outbred within patch
else if((mm == fm && mf != ff) || (mm != fm && mf == ff)) return 2; //half sibs
else return 3; //full sibs
}
| unsigned short Individual::getRealizedFecundity | ( | unsigned int | cat | ) | [inline] |
Gives the number of surviving offspring for a given pedigree class of mating.
| cat | the mating category:
|
Definition at line 160 of file individual.h.
References _realizedFecundity.
{
return _realizedFecundity[cat];
}
| sex_t Individual::getSex | ( | ) | [inline] |
Definition at line 125 of file individual.h.
References _sex.
Referenced by LCE_Breed_Selection::execute(), LCE_Breed::execute(), Metapop::retrieve_data(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().
{return _sex;}
| unsigned int Individual::getTotMatings | ( | ) | [inline] |
Gives the total number of matings of an individual.
Definition at line 148 of file individual.h.
References _matings, and getLocalMatings().
{
return _matings[0] + getLocalMatings();
}
| unsigned int Individual::getTotRealizedFecundity | ( | ) | [inline] |
Gives the total number of surviving offspring for all categories of mating.
Definition at line 172 of file individual.h.
References _realizedFecundity, and getLocalRealizedFecundity().
{return _realizedFecundity[0] + getLocalRealizedFecundity( );}
Trait accessor.
| T | the trait's index in the traits table |
Definition at line 273 of file individual.h.
References _trait_nb, fatal(), and Traits.
Referenced by create(), createTrait(), TTNeutralGenesFH::FHread(), TTDeletMutBitstrFH::FHread(), TTDeletMutBitstrFH::FHwrite(), getTraitValue(), inherit(), inheritTrait(), mutateTrait(), setTrait(), setTraitValue(), TTNeutralGenesFH::write_FSTAT(), and TTNeutralGenesFH::write_varcompWC().
| unsigned int Individual::getTraitNumber | ( | ) | [inline] |
Accessor to the size of the traits table.
Definition at line 243 of file individual.h.
References _trait_nb.
Referenced by LCE_Selection_base::setParameters().
{ return _trait_nb;}
| std::deque<TTrait *>& Individual::getTraits | ( | ) | [inline] |
Accessot to the traits table itself.
Definition at line 247 of file individual.h.
References Traits.
{return Traits;}
| void* Individual::getTraitValue | ( | IDX | T | ) | [inline] |
Accessor to the value (phenotype) of a particular trait.
| T | the trait's index in the traits table |
Definition at line 267 of file individual.h.
References getTrait(), and TTrait::getValue().
Referenced by LCE_Disperse_EvolDisp::evoldisp(), LCE_Selection_base::getFitnessDirect(), LCE_Selection_base::getFitnessMultivariateGaussian(), LCE_Selection_base::getFitnessMultivariateGaussian_VE(), LCE_Selection_base::getFitnessUnivariateGaussian(), LCE_Selection_base::getFitnessUnivariateGaussian_VE(), TTWolbachiaSH::getMeanFemaleInfection_perPatch(), TTWolbachiaSH::getMeanMaleInfection_perPatch(), TTWolbachiaSH::getMeanOffsprgFemaleInfection_perPatch(), TTWolbachiaSH::getMeanOffsprgInfection(), TTWolbachiaSH::getMeanOffsprgMaleInfection_perPatch(), LCE_Breed_Wolbachia::hasInfectedFemale(), TTWolbachiaSH::setInfectionStats(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().
| void Individual::inherit | ( | Individual * | mother, |
| Individual * | father | ||
| ) | [inline] |
Calls the inheritance procedure of all the traits present in the individual.
| mother | the mother |
| father | the father |
Definition at line 389 of file individual.h.
References _trait_nb, getTrait(), inherit(), and Traits.
| void Individual::inheritTrait | ( | IDX | T, |
| Individual * | mother, | ||
| Individual * | father | ||
| ) | [inline] |
Calls the inheritance procedure of a particular trait.
| T | the trait's index in the traits table |
| mother | the mother |
| father | the father |
Definition at line 305 of file individual.h.
References getTrait(), and TTrait::inherit().
Referenced by createTrait().
| Individual * Individual::init | ( | ) |
Inits parameters and traits.
Called by IndFactory::makeNewIndividual() to allocate the traits' sequences memory.
Definition at line 53 of file individual.cc.
References _age, _father, _fatherID, _home, _matings, _mother, _motherID, _pedigreeClass, _realizedFecundity, _trait_nb, error(), and Traits.
Referenced by IndFactory::makeNewIndividual().
{
_age = 0;
_pedigreeClass = 0;
_motherID = 0;
_fatherID = 0;
_mother = NULL;
_father = NULL;
_home = 0;
for(unsigned int i = 0; i < 5; i++) {
_matings[i] = 0; _realizedFecundity[i] = 0;
}
if(_trait_nb != Traits.size()){
error("Individual::init: trait counter and table size differ, resetting\n");
_trait_nb = Traits.size();
}
for(unsigned int i = 0; i < _trait_nb; i++)
Traits[i]->init();
return this;
}
| bool Individual::isFemale | ( | ) | [inline] |
| void Individual::mutate | ( | ) | [inline] |
| void Individual::mutateTrait | ( | IDX | T | ) | [inline] |
Calls the mutation procedure of a particular trait.
| T | trait's index in the traits table |
Definition at line 310 of file individual.h.
References getTrait(), and TTrait::mutate().
Referenced by createTrait().
| bool Individual::operator!= | ( | const Individual & | i | ) |
Definition at line 210 of file individual.cc.
{
if(!((*this) == i))
return true;
else
return false;
}
| Individual & Individual::operator= | ( | const Individual & | i | ) |
Assignment, make a deep copy of the parameter values and traits.
Definition at line 161 of file individual.cc.
References _age, _father, _fatherID, _fecundity, _home, _matings, _mother, _motherID, _pedigreeClass, _realizedFecundity, _sex, _trait_nb, error(), fatal(), and Traits.
{
if(this != &i) {
if(Traits.size() != i.Traits.size()) fatal("Individual::operator=:not same number of traits in left and right sides of assignment\n");
if(_trait_nb != i._trait_nb) {
error("Individual::operator=:trait counters differ, restting\n");
_trait_nb = i._trait_nb;
}
_sex = i._sex;
_age = i._age;
_motherID = i._motherID;
_fatherID = i._fatherID;
_mother = i._mother;
_father = i._father;
_home = i._home;
_pedigreeClass = i._pedigreeClass;
_fecundity = i._fecundity;
for(unsigned int j = 0; j < 5; j++) {
_matings[j] = i._matings[j];
_realizedFecundity[j] = i._realizedFecundity[j];
}
for(unsigned int t = 0; t < _trait_nb; t++){
if(Traits[t]->get_type().compare(i.Traits[t]->get_type()) != 0)
fatal("Individual::operator=: not same kinds of traits on left and right sides of assignment\n");
(*Traits[t]) = (*i.Traits[t]);
}
}
return *this;
}
| bool Individual::operator== | ( | const Individual & | i | ) |
Only checks for traits equivalence.
Definition at line 195 of file individual.cc.
References Traits.
| void Individual::removeTrait | ( | IDX | T | ) | [inline] |
| void Individual::reset | ( | ) |
Resets parameters and traits values.
Does not de-allocate the traits' sequences memory (i.e. is not calling TTrait::reset() on each trait).
Definition at line 79 of file individual.cc.
References _age, _father, _fatherID, _home, _id, _matings, _mother, _motherID, _pedigreeClass, _realizedFecundity, _sex, _trait_nb, MAL, Traits, and warning().
Referenced by IndFactory::makeNewIndividual().
{
_id = 0;
_age = 0;
_sex = MAL;
_pedigreeClass = 0;
_motherID = 0;
_fatherID = 0;
_mother = NULL;
_father = NULL;
_home = 0;
for(unsigned int i = 0; i < 5; i++) {
_matings[i] = 0; _realizedFecundity[i] = 0;
}
if(_trait_nb != Traits.size()){
warning("Individual::reset: trait counter and table size differ, resetting\n");
_trait_nb = Traits.size();
}
}
| void Individual::reset_counters | ( | ) | [inline] |
Resets the mating and fecundity counters.
Definition at line 206 of file individual.h.
References _matings, and _realizedFecundity.
Referenced by LCE_Breed_base::breed_cloning().
{
for(unsigned int i = 0; i < 5; i++) {
_matings[i] = 0; _realizedFecundity[i] = 0;
} }
| void Individual::retrieve_data | ( | BinaryStorageBuffer * | reader | ) |
Definition at line 117 of file individual.cc.
References _fatherID, _home, _id, _matings, _motherID, _realizedFecundity, _sex, and BinaryStorageBuffer::read().
Referenced by Metapop::retrieve_data().
{
reader->read(&_id, sizeof(unsigned long));
reader->read(&_motherID, sizeof(unsigned long));
reader->read(&_fatherID, sizeof(unsigned long));
reader->read(&_sex, sizeof(sex_t));
reader->read(&_home, sizeof(unsigned short));
reader->read(&_matings, 2*sizeof(unsigned short));
reader->read(&_realizedFecundity, 2*sizeof(unsigned short));
//reader->read(&_pedigreeClass, 1);
//reader->read(&_age, sizeof(unsigned short));
}
| void Individual::setAge | ( | unsigned short | value | ) | [inline] |
Definition at line 101 of file individual.h.
References _age.
Referenced by LCE_Breed_base::breed_cloning(), and TTDeletMutBitstrFH::FHread().
{_age = value;}
| void Individual::setCurrentID | ( | unsigned long | value | ) | [inline] |
| void Individual::setFather | ( | Individual * | f | ) | [inline] |
Definition at line 105 of file individual.h.
References _father.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{_father = f;}
| void Individual::setFatherID | ( | unsigned long | value | ) | [inline] |
Definition at line 103 of file individual.h.
References _fatherID.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{_fatherID = value;}
| double Individual::setFecundity | ( | double | value | ) | [inline] |
Sets the fecundity to the value given and returns it.
| value | the fecundity |
Definition at line 203 of file individual.h.
References _fecundity.
Referenced by LCE_Breed_Selection::execute(), LCE_Breed::execute(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().
{_fecundity = value; return value;}
| void Individual::setHome | ( | unsigned short | value | ) | [inline] |
Definition at line 107 of file individual.h.
References _home.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{_home = value;}
| void Individual::setID | ( | unsigned long | value | ) | [inline] |
Definition at line 100 of file individual.h.
References _id.
Referenced by IndFactory::makeNewIndividual().
{_id = value;}
| void Individual::setIsSelfed | ( | bool | s | ) | [inline] |
Definition at line 110 of file individual.h.
References _pedigreeClass.
Referenced by LCE_Breed_base::breed_cloning().
{_pedigreeClass = (s ? 4 : 0);}
| void Individual::setMother | ( | Individual * | m | ) | [inline] |
Definition at line 106 of file individual.h.
References _mother.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{_mother = m;}
| void Individual::setMotherID | ( | unsigned long | value | ) | [inline] |
Definition at line 104 of file individual.h.
References _motherID.
Referenced by LCE_Breed_base::breed_cloning(), and IndFactory::makeNewIndividual().
{_motherID = value;}
| void Individual::setPedigreeClass | ( | Individual * | mother, |
| Individual * | father | ||
| ) | [inline] |
Definition at line 111 of file individual.h.
References _pedigreeClass, and getPedigreeClass().
Referenced by TTNeutralGenesFH::FHread(), TTDeletMutBitstrFH::FHread(), and IndFactory::makeNewIndividual().
{_pedigreeClass = getPedigreeClass(mother,father);}
| void Individual::setPedigreeClass | ( | unsigned char | ped | ) | [inline] |
| void Individual::setSex | ( | sex_t | sex | ) | [inline] |
Definition at line 108 of file individual.h.
References _sex.
Referenced by IndFactory::makeNewIndividual().
{_sex = sex;}
| void* Individual::setTrait | ( | IDX | T, |
| void * | value | ||
| ) | [inline] |
Sets the phenotype/value of a trait to a particular value.
| T | the trait's index in the traits table |
| value | the value passed to the trait (using the TTrait interface) |
Definition at line 252 of file individual.h.
References getTrait(), and TTrait::set_trait().
Referenced by LCE_Breed_Wolbachia::inoculate_wolbachia().
| void Individual::setTraitValue | ( | IDX | T | ) | [inline] |
Calls the value setting procedure of a particular trait.
| T | the trait's index in the traits table |
Definition at line 257 of file individual.h.
References getTrait(), and TTrait::set_value().
| void Individual::setTraitValue | ( | ) | [inline] |
Calls the value setting procedure of all traits present in an individual.
Definition at line 261 of file individual.h.
References _trait_nb, and Traits.
Referenced by create(), and createTrait().
| void Individual::show_up | ( | ) |
Write some info to stdout.
Definition at line 132 of file individual.cc.
References _age, _fatherID, _home, _id, _motherID, _pedigreeClass, _sex, _trait_nb, message(), and Traits.
Referenced by TTDeletMutBitstrFH::FHread().
| void Individual::store_data | ( | BinaryStorageBuffer * | saver | ) |
Definition at line 102 of file individual.cc.
References _fatherID, _home, _id, _matings, _motherID, _realizedFecundity, _sex, and BinaryStorageBuffer::store().
{
saver->store(&_id, sizeof(unsigned long));
saver->store(&_motherID, sizeof(unsigned long));
saver->store(&_fatherID, sizeof(unsigned long));
saver->store(&_sex, sizeof(sex_t));
saver->store(&_home, sizeof(unsigned short));
saver->store(&_matings, 2*sizeof(unsigned short));
saver->store(&_realizedFecundity, 2*sizeof(unsigned short));
//saver->store(&_pedigreeClass, 1);
//saver->store(&_age, sizeof(unsigned short));
}
unsigned short Individual::_age [private] |
Age.
Definition at line 53 of file individual.h.
Referenced by Aging(), getAge(), init(), operator=(), reset(), setAge(), and show_up().
Individual * Individual::_father [private] |
Definition at line 59 of file individual.h.
Referenced by create(), createTrait(), getFather(), init(), operator=(), reset(), and setFather().
unsigned long Individual::_fatherID [private] |
Definition at line 57 of file individual.h.
Referenced by create_first_gen(), getFatherID(), init(), operator=(), reset(), retrieve_data(), setFatherID(), show_up(), and store_data().
double Individual::_fecundity [private] |
Assigned fecundity.
Definition at line 71 of file individual.h.
Referenced by getFecundity(), operator=(), and setFecundity().
unsigned short Individual::_home [private] |
Natal Patch tag.
Definition at line 61 of file individual.h.
Referenced by getHome(), init(), operator=(), reset(), retrieve_data(), setHome(), show_up(), and store_data().
unsigned long Individual::_id [private] |
ID tag, unique for one simulation.
Definition at line 51 of file individual.h.
Referenced by getID(), Individual(), reset(), retrieve_data(), setID(), show_up(), and store_data().
unsigned short Individual::_matings[5] [private] |
Mating counter.
The relationship
Definition at line 73 of file individual.h.
Referenced by addMating(), DidHaveABaby(), getFecWithOtherPatchMate(), getLocalMatings(), getMatings(), getTotMatings(), Individual(), init(), operator=(), reset(), reset_counters(), retrieve_data(), and store_data().
Individual* Individual::_mother [private] |
Parents pointers.
Definition at line 59 of file individual.h.
Referenced by create(), createTrait(), getMother(), init(), operator=(), reset(), and setMother().
unsigned long Individual::_motherID [private] |
Parents ID tags.
Definition at line 57 of file individual.h.
Referenced by create_first_gen(), getMotherID(), init(), operator=(), reset(), retrieve_data(), setMotherID(), show_up(), and store_data().
unsigned char Individual::_pedigreeClass [private] |
Pedigree class of the individual.
Definition at line 69 of file individual.h.
Referenced by getIsSelfed(), getPedigreeClass(), init(), operator=(), reset(), setIsSelfed(), setPedigreeClass(), and show_up().
unsigned short Individual::_realizedFecundity[5] [private] |
Number of surviving offspring from the different mating categories (see matings).
Definition at line 75 of file individual.h.
Referenced by DidHaveABaby(), getFecWithOtherPatchMate(), getLocalRealizedFecundity(), getRealizedFecundity(), getTotRealizedFecundity(), Individual(), init(), operator=(), reset(), reset_counters(), retrieve_data(), and store_data().
sex_t Individual::_sex [private] |
Sex tag.
Definition at line 55 of file individual.h.
Referenced by getSex(), isFemale(), operator=(), reset(), retrieve_data(), setSex(), show_up(), and store_data().
unsigned int Individual::_trait_nb [private] |
Number of traits in the table.
Definition at line 77 of file individual.h.
Referenced by addTrait(), clearTraits(), clone(), create(), create_first_gen(), getTrait(), getTraitNumber(), inherit(), init(), mutate(), operator=(), removeTrait(), reset(), setTraitValue(), and show_up().
unsigned long Individual::currentID = 0 [static] |
The ID counter, reset at the beginning of each simulation.
Definition at line 80 of file individual.h.
Referenced by getcurrentID(), Individual(), IndFactory::makeNewIndividual(), and setCurrentID().
| std::deque<TTrait*> Individual::Traits |
The traits table.
Definition at line 84 of file individual.h.
Referenced by addTrait(), clearTraits(), clone(), create(), create_first_gen(), createTrait(), getTrait(), getTraits(), inherit(), init(), mutate(), operator=(), operator==(), removeTrait(), reset(), setTraitValue(), and show_up().
1.7.5.1 -- Nemo is hosted by