Empirical
|
A tool to track phylogenetic relationships among organisms. The systematics class tracks the relationships among all organisms based on the INFO_TYPE provided. If an offspring has the same value for INFO_TYPE as its parent, it is grouped into the same taxon. Otherwise a new Taxon is created and the old one is used as its parent in the phylogeny. If the provided INFO_TYPE is the organsism's genome, a traditional phylogeny is formed, with genotypes. If the organism's behavior/task set is used, then organisms are grouped by phenotypes. If the organsims's position is used, the evolutionary path through space is tracked. Any other aspect of organisms can be tracked this way as well. More...
#include <Systematics.h>
Public Types | |
using | data_node_t = DataNode< double, data::Current, data::Info, data::Range, data::Stats, data::Pull > |
Public Member Functions | |
Systematics (fun_calc_info_t calc_taxon, bool _active=true, bool _anc=true, bool _all=false, bool _pos=true) | |
Systematics (const Systematics &)=delete | |
Systematics (Systematics &&)=default | |
~Systematics () | |
void | Update () |
void | SetCalcInfoFun (fun_calc_info_t f) |
std::unordered_set< Ptr< taxon_t >, hash_t > * | GetActivePtr () |
const std::unordered_set< Ptr< taxon_t >, hash_t > & | GetActive () const |
const std::unordered_set< Ptr< taxon_t >, hash_t > & | GetAncestors () const |
size_t | GetNumActive () const |
How many taxa are still active in the population? More... | |
size_t | GetNumAncestors () const |
How many taxa are ancestors of living organisms (but have died out themselves)? More... | |
size_t | GetNumOutside () const |
How many taxa are stored that have died out, as have their descendents? More... | |
size_t | GetTreeSize () const |
How many taxa are in the current phylogeny? More... | |
size_t | GetNumTaxa () const |
How many taxa are stored in total? More... | |
void | SetNextParent (int pos) |
void | SetNextParent (Ptr< taxon_t > p) |
SignalKey | OnNew (std::function< void(Ptr< taxon_t >)> &fun) |
SignalKey | OnPrune (std::function< void(Ptr< taxon_t >)> &fun) |
virtual data_ptr_t | AddEvolutionaryDistinctivenessDataNode (const std::string &name="evolutionary_distinctiveness") |
virtual data_ptr_t | AddPairwiseDistanceDataNode (const std::string &name="pairwise_distances") |
virtual data_ptr_t | AddPhylogeneticDiversityDataNode (const std::string &name="phylogenetic_diversity") |
virtual data_ptr_t | AddDeleteriousStepDataNode (const std::string &name="deleterious_steps") |
data_ptr_t | AddDeleteriousStepDataNodeImpl (bool decoy, const std::string &name="deleterious_steps") |
template<typename T = int> | |
data_ptr_t | AddDeleteriousStepDataNodeImpl (typename std::enable_if< DATA_STRUCT::has_fitness_t::value, T >::type decoy, const std::string &name="deleterious_steps") |
virtual data_ptr_t | AddVolatilityDataNode (const std::string &name="volatility") |
data_ptr_t | AddVolatilityDataNodeImpl (bool decoy, const std::string &name="volatility") |
template<typename T = int> | |
data_ptr_t | AddVolatilityDataNodeImpl (typename std::enable_if< DATA_STRUCT::has_phen_t::value, T >::type decoy, const std::string &name="volatility") |
virtual data_ptr_t | AddUniqueTaxaDataNode (const std::string &name="unique_taxa") |
data_ptr_t | AddUniqueTaxaDataNodeImpl (bool decoy, const std::string &name="unique_taxa") |
template<typename T = int> | |
data_ptr_t | AddUniqueTaxaDataNodeImpl (typename std::enable_if< DATA_STRUCT::has_phen_t::value, T >::type decoy, const std::string &name="unique_taxa") |
virtual data_ptr_t | AddMutationCountDataNode (const std::string &name="mutation_count", const std::string &mutation="substitution") |
data_ptr_t | AddMutationCountDataNodeImpl (bool decoy, const std::string &name="mutation_count", const std::string &mutation="substitution") |
template<typename T = int> | |
data_ptr_t | AddMutationCountDataNodeImpl (typename std::enable_if< DATA_STRUCT::has_mutations_t::value, T >::type decoy, const std::string &name="mutation_count", const std::string &mutation="substitution") |
Ptr< taxon_t > | GetTaxonAt (int id) |
Ptr< taxon_t > | GetNextTaxonAt (int id) |
int | GetPhylogeneticDiversity () const |
double | GetTaxonDistinctiveness (Ptr< taxon_t > tax) const |
double | GetEvolutionaryDistinctiveness (Ptr< taxon_t > tax, double time) const |
double | GetMeanPairwiseDistance (bool branch_only=false) const |
double | GetSumPairwiseDistance (bool branch_only=false) const |
double | GetVariancePairwiseDistance (bool branch_only=false) const |
emp::vector< double > | GetPairwiseDistances (bool branch_only=false) const |
int | GetDistanceToRoot (Ptr< taxon_t > tax) const |
int | GetBranchesToRoot (Ptr< taxon_t > tax) const |
Ptr< taxon_t > | GetMRCA () const |
Request a pointer to the Most-Recent Common Ancestor for the population. More... | |
int | GetMRCADepth () const |
Request the depth of the Most-Recent Common Ancestor; return -1 for none. More... | |
void | AddOrg (ORG &&org, int pos, int update=-1, bool next=false) |
Ptr< taxon_t > | AddOrg (ORG &&org, int pos, Ptr< taxon_t > parent=nullptr, int update=-1, bool next=false) |
Ptr< taxon_t > | AddOrg (ORG &&org, Ptr< taxon_t > parent=nullptr, int update=-1, bool next=false) |
void | AddOrg (ORG &org, int pos, int update=-1, bool next=false) |
Ptr< taxon_t > | AddOrg (ORG &org, int pos, Ptr< taxon_t > parent=nullptr, int update=-1, bool next=false) |
Ptr< taxon_t > | AddOrg (ORG &org, Ptr< taxon_t > parent=nullptr, int update=-1, bool next=false) |
bool | RemoveOrg (int pos) |
Remove an instance of an organism; track when it's gone. More... | |
bool | RemoveOrg (Ptr< taxon_t > taxon) |
bool | RemoveNextOrg (int pos) |
Remove org from next population (for use with synchronous generations) More... | |
bool | RemoveNextOrg (Ptr< taxon_t > taxon) |
Ptr< taxon_t > | Parent (Ptr< taxon_t > taxon) const |
Climb up a lineage... More... | |
void | PrintStatus (std::ostream &os=std::cout) const |
Print details about the Systematics manager. More... | |
void | PrintLineage (Ptr< taxon_t > taxon, std::ostream &os=std::cout) const |
Print whole lineage. More... | |
double | CalcDiversity () const |
Calculate the genetic diversity of the population. More... | |
bool | GetTrackSynchronous () const |
Are we tracking a synchronous population? More... | |
bool | GetStoreActive () const |
Are we storing all taxa that are still alive in the population? More... | |
bool | GetStoreAncestors () const |
Are we storing all taxa that are the ancestors of living organims in the population? More... | |
bool | GetStoreOutside () const |
Are we storing all taxa that have died out, as have all of their descendants. More... | |
bool | GetArchive () const |
Are we storing any taxa types that have died out? More... | |
bool | GetStorePosition () const |
Are we storing the positions of taxa? More... | |
size_t | GetTotalOrgs () const |
How many living organisms are currently being tracked? More... | |
size_t | GetNumRoots () const |
How many independent trees are being tracked? More... | |
double | GetAveDepth () const |
What is the average phylogenetic depth of organisms in the population? More... | |
void | SetTrackSynchronous (bool new_val) |
Are we tracking organisms evolving in synchronous generations? More... | |
void | SetStoreActive (bool new_val) |
Are we storing all taxa that are still alive in the population? More... | |
void | SetStoreAncestors (bool new_val) |
Are we storing all taxa that are the ancestors of living organims in the population? More... | |
void | SetStoreOutside (bool new_val) |
Are we storing all taxa that have died out, as have all of their descendants. More... | |
void | SetArchive (bool new_val) |
Are we storing any taxa types that have died out? More... | |
void | SetStorePosition (bool new_val) |
Are we storing the location of taxa? More... | |
data_ptr_t | AddDataNode (const std::string &name) |
data_ptr_t | AddDataNode (std::function< emp::vector< double >()> pull_set_fun, const std::string &name) |
data_ptr_t | AddDataNode (std::function< double()> pull_fun, const std::string &name) |
data_ptr_t | GetDataNode (const std::string &name) |
Protected Attributes | |
bool | store_active |
Store all of the currently active taxa? More... | |
bool | store_ancestors |
Store all of the direct ancestors from living taxa? More... | |
bool | store_outside |
Store taxa that are extinct with no living descendants? More... | |
bool | archive |
Set to true if we are supposed to do any archiving of extinct taxa. More... | |
bool | store_position |
Keep a vector mapping positions to pointers. More... | |
bool | track_synchronous |
Does this systematics manager need to keep track of current and next positions? More... | |
size_t | org_count |
How many organisms are currently active? More... | |
size_t | total_depth |
Sum of taxa depths for calculating average. More... | |
size_t | num_roots |
How many distint injected ancestors are currently in population? More... | |
size_t | next_id |
What ID value should the next new taxon have? More... | |
size_t | curr_update |
DataManager< double, data::Current, data::Info, data::Range, data::Stats, data::Pull > | data_nodes |
A tool to track phylogenetic relationships among organisms. The systematics class tracks the relationships among all organisms based on the INFO_TYPE provided. If an offspring has the same value for INFO_TYPE as its parent, it is grouped into the same taxon. Otherwise a new Taxon is created and the old one is used as its parent in the phylogeny. If the provided INFO_TYPE is the organsism's genome, a traditional phylogeny is formed, with genotypes. If the organism's behavior/task set is used, then organisms are grouped by phenotypes. If the organsims's position is used, the evolutionary path through space is tracked. Any other aspect of organisms can be tracked this way as well.
|
inherited |
|
inline |
Contructor for Systematics; controls what information should be stored.
store_active | Should living organisms' taxa be tracked? (typically yes!) |
store_ancestors | Should ancestral organims' taxa be maintained? (yes for lineages!) |
store_outside | Should all dead taxa be maintained? (typically no; it gets BIG!) |
|
delete |
|
default |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
|
virtual |
Add information about a new organism, including its stored info and parent's taxon; If you would like the systematics manager to track taxon age, you can also supply the update at which the taxon is being added. return a pointer for the associated taxon.
Implements emp::SystematicsBase< ORG >.
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::AddOrg | ( | ORG && | org, |
int | pos, | ||
Ptr< taxon_t > | parent = nullptr , |
||
int | update = -1 , |
||
bool | next = false |
||
) |
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::AddOrg | ( | ORG && | org, |
Ptr< taxon_t > | parent = nullptr , |
||
int | update = -1 , |
||
bool | next = false |
||
) |
|
virtual |
Implements emp::SystematicsBase< ORG >.
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::AddOrg | ( | ORG & | org, |
int | pos, | ||
Ptr< taxon_t > | parent = nullptr , |
||
int | update = -1 , |
||
bool | next = false |
||
) |
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::AddOrg | ( | ORG & | org, |
Ptr< taxon_t > | parent = nullptr , |
||
int | update = -1 , |
||
bool | next = false |
||
) |
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
|
virtual |
Calculate the genetic diversity of the population.
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
|
inline |
|
inlineinherited |
Are we storing any taxa types that have died out?
|
inlineinherited |
What is the average phylogenetic depth of organisms in the population?
|
inline |
Counts the number of branching points leading to multiple extant taxa between
tax | and the most-recent common ancestor (or the root of its subtree, if no MRCA exists). This is useful because a lot of stats for phylogenies are designed for phylogenies reconstructed from extant taxa. These phylogenies generally only contain branching points, rather than every ancestor along the way to the current taxon. |
|
inlineinherited |
|
inline |
Counts the total number of ancestors between
tax | and MRCA, if there is one. If there is no common ancestor, distance to the root of this tree is calculated instead. |
|
inline |
This metric (from Isaac, 2007; reviewd in Winter et al., 2013) measures how distinct
tax | is from the rest of the population, weighted for the amount of unique evolutionary history that it represents. |
To quantify length of evolutionary history, this method needs
time | the current time, in whatever units time is being measured in when taxa are added to the systematics manager. Note that passing a time in the past will produce innacurate results (since we don't know what the state of the tree was at that time). |
Assumes the tree is all connected. Will return -1 if this assumption isn't met.
|
inlinevirtual |
Calculates mean pairwise distance between extant taxa (Webb and Losos, 2000). This measurement is also called Average Taxonomic Diversity (Warwick and Clark, 1998) (for demonstration of equivalence see Tucker et al, 2016). This measurment tells you about the amount of distinctness in the community as a whole.
branch_only | only counts distance in terms of nodes that represent a branch between two extant taxa (poentially useful for comparison to biological data, where non-branching nodes generally cannot be inferred). |
This measurement assumes that the tree is fully connected. Will return -1 if this is not the case.
Implements emp::SystematicsBase< ORG >.
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::GetMRCA | ( | ) | const |
Request a pointer to the Most-Recent Common Ancestor for the population.
|
virtual |
Request the depth of the Most-Recent Common Ancestor; return -1 for none.
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inlinevirtual |
How many taxa are still active in the population?
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
How many taxa are ancestors of living organisms (but have died out themselves)?
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
How many taxa are stored that have died out, as have their descendents?
Implements emp::SystematicsBase< ORG >.
|
inlineinherited |
How many independent trees are being tracked?
|
inlinevirtual |
How many taxa are stored in total?
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
Calculates a vector of all pairwise distances between extant taxa.
branch_only | only counts distance in terms of nodes that represent a branch between two extant taxa (poentially useful for comparison to biological data, where non-branching nodes generally cannot be inferred). |
This method assumes that the tree is fully connected. Will return -1 if this is not the case.
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
From (Faith 1992, reviewed in Winters et al., 2013), phylogenetic diversity is the sum of edges in the minimal spanning tree connected the taxa you're calculating diversity of.
This calculates phylogenetic diversity for all extant taxa in the tree, assuming all edges from parent to child have a length of one. Possible extensions to this function that might be useful in the future include:
Implements emp::SystematicsBase< ORG >.
|
inlineinherited |
Are we storing all taxa that are still alive in the population?
|
inlineinherited |
Are we storing all taxa that are the ancestors of living organims in the population?
|
inlineinherited |
Are we storing all taxa that have died out, as have all of their descendants.
|
inlineinherited |
Are we storing the positions of taxa?
|
inlinevirtual |
Calculates summed pairwise distance between extant taxa. Tucker et al 2017 points out that this is a measure of phylogenetic richness.
branch_only | only counts distance in terms of nodes that represent a branch between two extant taxa (poentially useful for comparison to biological data, where non-branching nodes generally cannot be inferred). |
This measurement assumes that the tree is fully connected. Will return -1 if this is not the case.
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
This is a metric of how distinct
tax | is from the rest of the population. |
(From Vane-Wright et al., 1991; reviewed in Winter et al., 2013)
|
inlineinherited |
How many living organisms are currently being tracked?
|
inlineinherited |
Are we tracking a synchronous population?
|
inlinevirtual |
How many taxa are in the current phylogeny?
Implements emp::SystematicsBase< ORG >.
|
inlinevirtual |
Calculates variance of pairwise distance between extant taxa. Tucker et al 2017 points out that this is a measure of phylogenetic regularity.
branch_only | only counts distance in terms of nodes that represent a branch between two extant taxa (poentially useful for comparison to biological data, where non-branching nodes generally cannot be inferred). |
This measurement assumes that the tree is fully connected. Will return -1 if this is not the case.
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inline |
Privide a function for Systematics to call each time a taxon is about to be pruned. Trigger: Taxon is about to be killed Argument: Pounter to taxon
Ptr< typename Systematics< ORG, ORG_INFO, DATA_STRUCT >::taxon_t > emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::Parent | ( | Ptr< taxon_t > | taxon | ) | const |
Climb up a lineage...
void emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::PrintLineage | ( | Ptr< taxon_t > | taxon, |
std::ostream & | os = std::cout |
||
) | const |
Print whole lineage.
|
virtual |
Print details about the Systematics manager.
Implements emp::SystematicsBase< ORG >.
|
virtual |
Remove org from next population (for use with synchronous generations)
Implements emp::SystematicsBase< ORG >.
bool emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::RemoveNextOrg | ( | Ptr< taxon_t > | taxon | ) |
|
virtual |
Remove an instance of an organism; track when it's gone.
Implements emp::SystematicsBase< ORG >.
bool emp::Systematics< ORG, ORG_INFO, DATA_STRUCT >::RemoveOrg | ( | Ptr< taxon_t > | taxon | ) |
|
inlineinherited |
Are we storing any taxa types that have died out?
|
inline |
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
inline |
|
inlineinherited |
Are we storing all taxa that are still alive in the population?
|
inlineinherited |
Are we storing all taxa that are the ancestors of living organims in the population?
|
inlineinherited |
Are we storing all taxa that have died out, as have all of their descendants.
|
inlineinherited |
Are we storing the location of taxa?
|
inlineinherited |
Are we tracking organisms evolving in synchronous generations?
|
inlinevirtual |
Implements emp::SystematicsBase< ORG >.
|
protectedinherited |
Set to true if we are supposed to do any archiving of extinct taxa.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
What ID value should the next new taxon have?
|
protectedinherited |
How many distint injected ancestors are currently in population?
|
protectedinherited |
How many organisms are currently active?
|
protectedinherited |
Store all of the currently active taxa?
|
protectedinherited |
Store all of the direct ancestors from living taxa?
|
protectedinherited |
Store taxa that are extinct with no living descendants?
|
protectedinherited |
Keep a vector mapping positions to pointers.
|
protectedinherited |
Sum of taxa depths for calculating average.
|
protectedinherited |
Does this systematics manager need to keep track of current and next positions?