diff --git a/coalescence_binary_tree.html b/coalescence_binary_tree.html index 1a16eaa8..cca0ace5 100644 --- a/coalescence_binary_tree.html +++ b/coalescence_binary_tree.html @@ -149,11 +149,11 @@
Coalescence Binary Trees classes provide a way to guarantee that each vertex \(v\) has exactly
The graph structure is bidirectional and allows to model a forest of disconnected trees. That is, if a vertex has no predecessor, then it's either a root (if it has 2 successors) or an isolated vertex (if it has no successor).
Users will encounter this type of tree when returning from coalescence binary mergers, or if they simply want to build and manipulate graphs while enforcing a binary tree structure.
-Coalescence Binary Trees can store an additional arbitrary type of information (called a Property Class) along their vertices or edges: if the user decides to do so, the tree class interface adapts to offer ways to manipulate this information.
There are logically 4 different classes (equivalently interfaces) resulting from this:
Coalescence k-ary Trees classes are similar to Binary Trees, but provide an interface guaranteeing that each vertex \(v\) has exactly
The graph structure is bidirectional and allows to model a forest of disconnected trees. That is, if a vertex has no predecessor, then it's either a root (if it has 2 or more successors) or an isolated vertex (if it has no successor).
Users will encounter this type of tree when returning from coalescence multiple mergers, or if they simply want to build and manipulate graphs that do not make strong assumptions on the tree structure.
-Coalescence K-ary Trees can store an additional arbitrary type of information (called a Property Class) along their vertices or edges: if the user decides to do so, the tree class interface adapts to offer ways to manipulate this information.
There are logically 4 different classes (equivalently interfaces) resulting from this:
In population genetics, demographic history refers to the historical changes in population size, structure, and distribution of individuals within a species over time. It encompasses various events and processes that have shaped the genetic diversity and characteristics of a population. Some key aspects of demographic history include:
There a different modeling approaches to look at these demographic histories, primarily based on the level of intricacy one intends to incorporate into the framework:
-Typically represent a bifurcating pattern of evolution, where each node (or branching point) represents a speciation event. This gives population histories the semantic of a tree graph (called a population tree or species tree), where ancestral populations split into sub-populations, sometimes loosely connected by migration. Gene trees coalesce into these species tree. Genetic inference under this kind of model aims at estimating the tree topology and/or the timing and parameters of events, such as ancestral population size changes and migration rates. It is important to note that in this framework geography is implicit and events such as population size changes and admixture events are explicitely modeled and estimated.
-While a phylogenetic tree typically represents a bifurcating pattern of evolution, real-world evolutionary processes can be more intricate. Phylogenetic networks are employed when evolutionary events like horizontal gene transfer, hybridization, recombination, and other reticulate processes are involved. These events can lead to interconnected patterns that cannot be accurately illustrated by a simple tree. Networks with Hybridization are specifically designed to capture the evolutionary relationships of organisms that have undergone hybridization events, where two distinct species interbreed to produce hybrid offspring.
-Another category of models puts an emphasis on the geographic structure of these populations and embed GIS information into the model. Here the demographic history receives the semantic of a dense spatial graph where geolocalized nodes represent demes and local processes whereas edges represent distances and dispersal processes. In this kind of models estimating the individual properties of so many demes is not judicious and genetic inference rather aims at estimating species-wide parameters that link local deme conditions (such as rainfall) to populational processes (like growth rate). It's crucial to understand that within this geospatial framework, events like population changes and admixture events are emergent properties of the model: they are generally not explicitly outlined in the model nor subjected to direct estimation.
A straightforward approach to determine the dispersal mode across a complete spatial graph involves correlating the geographic distance between two locations with the likelihood of dispersal between them. The objective of this section is to highlight this model choice by parametrizing a simple Dispersal Location Kernel (in the sense of Nathan et al. 2012). Additionally, we will calculate essential metrics, such as the distance between two coordinates, the dispersal probability between them, and the average dispersal distance anticipated under this distribution.
-The dispersal location kernel represents the statistical pattern of dispersal distances within a population. In this context, it essentially serves as the probability density function (pdf) that outlines the distribution of locations after dispersal in relation to the original location. The expressions have been adjusted to incorporate a scale parameter, \(a\), which is consistent with a distance unit, and a shape parameter, \(b\), that dictates the curvature of the distribution curve, emphasizing the influence of long-distance events.
For a source \((x_0,y_0)\), the dispersal location kernel denoted as \(k_L(r)\) provides the density of the probability of the dispersal end point in the 2D space. In this case, \(k_L(r)dA\) is the probability of a dispersal end point to be within a small 2D area \(dA\) around the location \((x,y)\). Since a probability is unitless and \(dA\) is an area, \(k_L(r)\) is expressed in per unit area in a 2D space.
Quetzal incorporates various kernel types available in the quetzal::demography::dispersal_kernel
namespace, and streamlines compile-time dimensional analysis and units conversion using the mp-units
library.
Users can create a spatial graph from landscape data, customizing assumptions about connectivity and topology. By defining a dispersal kernel and calculating dispersal probabilities for each edge based on distance metrics, users can uncover insights into potential dispersal patterns within the spatial graph. This approach offers a powerful means for exploring and understanding spatial dynamics and connectivity, facilitating deeper analysis of ecological or geographic phenomena.
-Input
-Output
-+ |
+ Quetzal-CoaTL
+
+ The Coalescence Template Library
+ |
+
quetzal::geography::landscape
and prepare their integration into the simulation framework with quetzal::expressive
and account for trans-oceanic dispersal events by dynamically defining the friction and the carrying capacity of a cell as functions of the suitability and elevation value.Drafting events, in the context of biological dispersal, refer to a phenomenon where organisms are carried across large distances by clinging to or being transported by other organisms, objects, or air currents. This can be thought of as a form of passive dispersal where an organism takes advantage of external forces to move beyond its usual range.
+The term "drafting" is borrowed from concepts in physics. In biology, this concept is applied to scenarios where organisms, often small and lightweight, catch a ride on other organisms (like birds, insects, or larger animals), objects (like debris), or wind currents. Drafting events can play a significant role in the dispersal of organisms, especially those with limited mobility.
+These drafting events provide an opportunity for organisms to reach new areas that they might not be able to access through their own locomotion. It's an interesting ecological phenomenon that highlights the intricate ways in which different species interact and influence each other's distribution and survival.
+The general idea is to define lambda expressions that embed stochastic aspects of the model, while preserving the callable interface (space, time) -> double
.
Input
+Output
++ |
+ Quetzal-CoaTL
+
+ The Coalescence Template Library
+ |
+
quetzal::geography::landscape
and prepare their integration into the simulation framework with quetzal::expressive
by dynamically modulating the suitability value as a function of the local elevation.It is a common approach to pack a wealth of information into a sole raster file. For instance, this can involve using a single friction file and designating ocean cells with NA values, and obstacles for dispersal with values of 1. Another way is to try to inject elevational data into the suitability map during the Ecological Niche Modeling step.
+While these approaches are feasible and occasionally advantageous, they do not consistently represent the optimal or most adaptable solution.
+In a broader sense, it's advisable to consider each Geographic Information System (GIS) input file as a means of representing a distinct attribute of the landscape such as suitability, friction, or elevation, utilizing quetzal::geography::landscape
to read and align these input files then utilizing quetzal::expressive
to adjust or combine these quantities according to the user's modeling intentions.
As an illustration we will show in this example how to adjust the stochasticity of a suitability-driven process as a function of the elevation model. This case and its variations can be applicable in various contexts:
+Input
+Output
++ |
+ Quetzal-CoaTL
+
+ The Coalescence Template Library
+ |
+
quetzal::geography::raster
and prepare its integration into the simulation framework with quetzal::expressive
.In the context of ecological niche modeling (ENM), suitability refers to the degree of appropriateness or favorability of a particular environmental condition for a species to thrive and persist. ENM is a technique used in ecology to predict the distribution of species across landscapes based on their known occurrences and environmental variables.
+Suitability can be thought of as a spectrum, ranging from conditions that are highly suitable for a species' survival and reproduction to conditions that are unsuitable or even detrimental. ENM attempts to map this spectrum across geographical space by analyzing the relationships between species occurrences and various environmental factors, such as temperature, precipitation, elevation, soil type, and vegetation cover.
+It's important to note that suitability does not solely depend on a single environmental variable. Instead, it's a complex interplay of multiple factors that determine whether a species can survive, reproduce, and establish a viable population in a given area. Suitability GIS maps derived from previous analysis steps (see e.g. the niche models in Quetzal-crumbs python package) can then be integrated into the coalescence simulation framework.
+The following example code
quetzal::geography::raster
quetzal::expressive
f(x,t)
quetzal::expressive::use
Input
+Output
+Landscapes, along with their spatial and temporal heterogeneity, play a significant role in shaping the dynamics of populations and lineages. In computational models, these landscapes are often represented as geospatial grids or rasters.
In most analyses, it is common for users to establish connections between local growth processes and a habitability raster obtained from Ecological Niche Models. Additionally, they may associate dispersal or connectivity with a Digital Elevation Model.
@@ -313,7 +313,7 @@Aligning rasters refers to a spatial data representation technique used in Geographic Information Systems (GIS). In this context, raster data layers are aligned and registered to a common coordinate system and grid structure. This ensures that the cells or pixels in the raster layers are spatially aligned and correspond to the same geographic locations.
Alignment is achieved in quetzal::geography::raster
objects by defining a consistent grid structure, such as a uniform cell size and orientation, for all raster layers.
Geospatial datasets play a crucial role in coalescence by providing valuable information about the demographic process. Once a raster is successfully parsed, users typically have three primary objectives they may want to pursue:
The rasters grid structure can be employed to construct a spatial graph of demes that is fully connected and utilized for simulating the demographic process. This is pertinent when looking at very larged continuous land masses. In this context:
In archipelagos or clusters of loosely connected islands, the fluctuations in sea levels have a notable impact on the dynamics of species. These variations cause the intermittent connection and separation of land masses and their corresponding populations. Similarly, climatic shifts in sky-island complexes can have similar effects. As a result, the assumption of a completely interconnected graph representing population units (demes) is no longer applicable in these situations.
To address this, Digital Elevation Models (DEMs) can be utilized to establish a relationship between the dynamics of sea levels and species. In these cases, the connectivity of the graph at any given time is determined by the current elevation, and changes in elevation directly impact the level of connectivity between different areas.
Ecological Niche Models (ENMs) play a crucial role in predicting how populations might respond to changes in climate, both in the past and the future.
Typically, these models produce raster outputs that represent estimates of suitability. These suitability values are then utilized to determine growth rates and carrying capacity.
diff --git a/graphs_in_quetzal.html b/graphs_in_quetzal.html index 933daeb4..0921743d 100644 --- a/graphs_in_quetzal.html +++ b/graphs_in_quetzal.html @@ -149,35 +149,35 @@Although graphs are ubiquitous in phylogeography and coalescence frameworks, they can represent quite different objects depending on the exact context. Consequently Quetzal had to make a number of design choices in their implementation.
-As geneticists, we expect from a simple Kingman coalescent tree to exhibit certain characteristics (for example the guarantee of having either 0 or 2 children but never only 1) that we don't expect from a phylogenetic network (that would in contrast exhibit cycles and hybrid nodes).
In programming jargon, these expectations are called class invariants.
Rather than exposing a 1-fit-all type of graph and be prone to programming mistakes, Quetzal comes with more specialized classes that maintain their invariants.
-A point common to all class of graphs is that vertices and edges have unique identifiers.
This identifier is implementation-dependent and not always of type int
. It is instead referred by a type nested in each graph class: vertex_descriptor
and edge_descriptor
.
Methods of a class that receive or return specific edges/vertices will manipulate objects of this type.
-The quality of information attached to the vertices and edges of a graph also varies depending on the user problem.
For example, a spatial coalescent tree may need a way to store the geographic location of the visited locations, whereas a Kingman coalescent tree does not need to allocated storage for this. Similarly, Phylogenetic Networks will surely embed completely different types of information, like \(\gamma\), the inheritance probability.
To reflect this variability in the type of information, graphs can embed arbitrary information along edges and vertices through small user-defined classes called property classes.
The type of information a graph class embeds is referred by a nested type: vertex_property
and edge_property
.
DFS is a form of graph traversal referering to the process of visiting (e.g. retrieving, updating, or deleting) each node in a tree data structure, exactly once.
-When the graph has the structure of a tree, there are only three operations that are worth worrying about:
pre-order
,Like the C++ Standard Library and Boost and numerous other libraries, Quetzal follows thede guidelines:
unordered_map
._
prefix to distinguish it from public data.If you refresh the doxygen-awesome package, make sure to add this snippet in the header.html
before closing </head>
:
This page gives an overview of the features available in the library.
Please refer to the Tutorials section for more detals on how to use them. If proper documentation does not exist yet, or lacks of clarity, please open an issue.
-Quetzal-CoaTL provides a set of functions and classes that facilitate the reading of data structures (using parsers) and the writing of data structures (using generators) that are crucial for addressing coalescence problems.
-The Quetzal-CoaTL algorithms consist of a core set of algorithm patterns (implemented as generic algorithms) and graph algorithms:
By themselves, these algorithm patterns do not compute or update any meaningful quantities over lineages; they are merely building blocks for instantiating coalescence algorithms.
-Since algorithms are decoupled from data-structures, these need to
-A part of the Quetzal-CoaTL uses mp-units to enable compile-time dimensional analysis and unit/quantity manipulation. The rational of compile-time support for Physical Units in C++ libraries can be found here.
In fewer words, instead of having double
and int
all across the code base with comments similar to // !!! THIS IS IN km !!!
, Quetzal actually implements them as distinct types so that the compiler can check before runtime that you are not trying to add for example a branch length in unit of coalescence with a branch length in units of generations.
[1] M. H. Austern. Generic Programming and the STL. Professional computing series. Addison-Wesley, 1999.
In this tutorial section you will learn how to:
quetzal::format::newick::generate_from
function to generate a Newick stringWhen a Newick string is generated from a tree that has no vertex nor edge information/properties attached to it, it is then assumed the only interest is the tree topology: as there is no clear way to populate the labels or branch length data fields in the Newick string, those are left empty.
Input
@@ -217,11 +217,11 @@Since there are no comments stored in the labels of the generated random tree, the output of the different flavors are here quite similar:
Output
-When a Newick string is generated from a tree that has some information attached to its vertices and edges through a property class, the formatter can acccess this information as long as the property class defined a std::string label() const
method.
Input
@@ -280,13 +280,13 @@Output
-Extending the string generation to a k-ary tree is straightforward: instead of passing a quetzal::coalescence::binary_tree
object, just pass a quetzal::coalescence::k_ary_tree
to the quetzal::format::newick::generate_from
function.
No vertex nor edge properties are embedded: the vertices labels and branch length data fields of the Newick string are left empty.
Input
@@ -324,7 +324,7 @@The Newick string is generated from a tree that embeds some information attached to its vertices and edges through a property class, the formatter can acccess this information as long as the property class defined a std::string label() const
method.
Input
@@ -385,9 +385,9 @@If your existing code heavily dependson your own class to describe a tree graph, then refactoring your whole project to switch to Quetzal trees may be too costly.
In this case, you can connect the quetzal::format::newick::generator
class to your own legacy code.
Quetzal implements a quetzal::format::newick::generator
that consumes a tree graph and produces a newick string.
This generator is not aware of your class. Instead, it requires you to defined 4 functors that embed all the information there is to know about a vertex \(v\):
Output
Once you understand the previous example with no property, then generating a Newick string from one of your legacy tree class object with added vertices and/or edge labels is pretty straightforward.
You only need to modify three things:
Newick tree format is a way of representing graph-theoretical trees with edge lengths using parentheses and commas.
Yet not very efficient, Newick is a simple and popular format for representing trees, and provides a rather useful abstraction in coalescence theory for representing the shared history of populations (species trees, population trees) or gene genealogies that coalesce into these trees.
Quetzal provides some utilities to parse, generate and manipulate such format.
Whitespace here refer to any of the following: spaces, tabs, carriage returns, and linefeeds.
In this tutorial section you will learn how to:
In this example we will use the default (and simplistic) properties of the graph synthetized by the parsing. By properties we mean the type the data structures used to store arbitrary information along the vertices and edges of a graph.
For general graphs it could be anything, but since we are parsing Newick formats, we can reasonably expect ad minima:
In the previous example we used default types to represent the properties of a vertex and an edge. These defaults are useful, but not always sufficient. For example, you may want to visit your tree graph and trigger specific events when specific nodes or edges are visited.
In this case, you would need to define your own small structures to represent the graph properties you want:
If you have been coding for a while, you may already depend heavily on your own class to describe a tree graph, and not feel very excited about refactoring your whole project to switch to Quetzal trees. Fair enough.
This section shows how to use Quetzal parser to populate your own legacy class and then forget about Quetzal.
diff --git a/niche_in_quetzal.html b/niche_in_quetzal.html new file mode 100644 index 00000000..b3905335 --- /dev/null +++ b/niche_in_quetzal.html @@ -0,0 +1,224 @@ + + + + + + + + ++ |
+ Quetzal-CoaTL
+
+ The Coalescence Template Library
+ |
+
In the field of ecology, the niche refers to the compatibility between a species and a specific environmental condition. It explains how an organism or a population adapts to the availability of resources and competition.
+For instance, when resources are plentiful and the presence of predators, parasites, and pathogens is low, the organism or population tends to grow. In locations and times of resources scarcity and high predation, the populations tend to shrink.
+The composition and significance of environmental variables that constitute the dimensions of a niche can vary among species, and the importance of specific environmental factors for a species may change depending on geographical and ecological contexts.
+Given this understanding, the primary goal of Quetzal is to provide users with quetzal::expressive
, a user-friendly means to effectively combine geospatial and temporal elements. This enables users to establish meaningful mathematical connections between a diverse and heterogeneous landscape and the underlying demographic processes, based on their own perspectives and preferences. Generally speaking, users will want to use quetzal::expressive
to mathematically compose spatio-temporal expressions with a signature double (location_type, time_type)
until they reach a satisfying definition of the local demographic parameter of interest.
Mathematical composition in C++ is not trivial as unlike languages, C++ does not understand mathematical expressions and their composition. In this strongly-typed language, you can not simply multiply the integer 42
and the function \( f(x,y) = x^y \) and expect it to work. Indeed, if you try to rescale a lambda function, e.g.:
it will not compile. As the compiler does not know natively what the rules are to multiply a number with whatever type f
is, it will (verbosely) insult you saying the operator*()
is not defined for the type int
and an anonymous type (the lambda function).
You need a library to tell the compiler what to do. This is where quetzal::expressive
comes handy: it allows you to add, substract, multiply, or compose mathematical expressions by giving them a uniform interface.
In the context of demographic models, my_expression
in the example below could represent for example r(x,t)
the growth rate at location x
at time t
. Being able to compose several smaller expressions into bigger expressions gives much freedom to users who can for example define r
in one part on the program and compose it at a later time with a different expression e.g. k(x,t)
the carrying capacity at location x
at time t
. By treating these local demographic parameters as independent expressions that can be mixed and matched, quetzal::expressive
allows great freedom in the implementation details of a spatio-temporal process.
Input
+Output
+Constructing a spatial graph from a spatial grid, also known as a raster, is a fundamental step in spatial analysis and modeling. Spatial graphs provide a powerful representation of relationships and connectivity between different locations within a geographic area. This process involves transforming the discrete and gridded structure of a spatial grid into a network of vertices and edges, where vertices represent spatial entities (such as cells or locations), and edges capture the spatial relationships and connections between these entities.
There are different ways to build such graph.
-The provided code snippet contains the logic for constructing a spatial graph from a quetzal::geography::raster
.
This involves identifying the cells of the raster to map location_type
values to the vertices, and defining edges based on the desired connectivity.
Output
The provided code snippet contains the logic for constructing a spatial graph from a quetzal::geography::landscape
.
This involves identifying the cells of the landscape to map location_type
values to the vertices, and defining edges based on the desired connectivity.
Output
The provided code snippet contains the logic for constructing a spatial graph from a user-defined abstract grid.
This involves identifying the height and width of the space to define linearly-indexed vertices, and defining edges based on the desired connectivity.
@@ -258,8 +258,8 @@Output
-The provided code snippet contains the logic for creating a sparse versus dense graph from scratch. This involves dynamically adding vertices and edges based on user-defined conditions, resulting in a graph that represents the desired spatial relationships.
-Input
Output
Input
- |
- Quetzal-CoaTL
-
- The Coalescence Template Library
- |
-
In the field of ecology, the niche refers to the compatibility between a species and a specific environmental condition. It explains how an organism or a population adapts to the availability of resources and competition.
-For instance, when resources are plentiful and the presence of predators, parasites, and pathogens is low, the organism or population tends to grow. In locations and times of resources scarcity and high predation, the populations tend to shrink.
-The composition and significance of environmental variables that constitute the dimensions of a niche can vary among species, and the importance of specific environmental factors for a species may change depending on geographical and ecological contexts.
-Given this understanding, the primary goal of Quetzal is to provide users with quetzal::expressive
, a user-friendly means to effectively combine geospatial and temporal elements. This enables users to establish meaningful mathematical connections between a diverse and heterogeneous landscape and the underlying demographic processes, based on their own perspectives and preferences. Generally speaking, users will want to use quetzal::expressive
to mathematically compose spatio-temporal expressions with a signature double (location_type, time_type)
until they reach a satisfying definition of the local demographic parameter of interest.
Mathematical composition in C++ is not trivial as unlike languages, C++ does not understand mathematical expressions and their composition. In this strongly-typed language, you can not simply multiply the integer 42
and the function \( f(x,y) = x^y \) and expect it to work. Indeed, if you try to rescale a lambda function, e.g.:
it will not compile. As the compiler does not know natively what the rules are to multiply a number with whatever type f
is, it will (verbosely) insult you saying the operator*()
is not defined for the type int
and an anonymous type (the lambda function).
You need a library to tell the compiler what to do. This is where quetzal::expressive
comes handy: it allows you to add, substract, multiply, or compose mathematical expressions by giving them a uniform interface.
In the context of demographic models, my_expression
in the example below could represent for example r(x,t)
the growth rate at location x
at time t
. Being able to compose several smaller expressions into bigger expressions gives much freedom to users who can for example define r
in one part on the program and compose it at a later time with a different expression e.g. k(x,t)
the carrying capacity at location x
at time t
. By treating these local demographic parameters as independent expressions that can be mixed and matched, quetzal::expressive
allows great freedom in the implementation details of a spatio-temporal process.
Input
-Output
-quetzal::geography::raster
and prepare its integration into the simulation framework with quetzal::expressive
.In the context of ecological niche modeling (ENM), suitability refers to the degree of appropriateness or favorability of a particular environmental condition for a species to thrive and persist. ENM is a technique used in ecology to predict the distribution of species across landscapes based on their known occurrences and environmental variables.
-Suitability can be thought of as a spectrum, ranging from conditions that are highly suitable for a species' survival and reproduction to conditions that are unsuitable or even detrimental. ENM attempts to map this spectrum across geographical space by analyzing the relationships between species occurrences and various environmental factors, such as temperature, precipitation, elevation, soil type, and vegetation cover.
-It's important to note that suitability does not solely depend on a single environmental variable. Instead, it's a complex interplay of multiple factors that determine whether a species can survive, reproduce, and establish a viable population in a given area. Suitability GIS maps derived from previous analysis steps (see e.g. the niche models in Quetzal-crumbs python package) can then be integrated into the coalescence simulation framework.
-The following example code
quetzal::geography::raster
quetzal::expressive
f(x,t)
quetzal::expressive::use
Input
-Output
-quetzal::geography::landscape
and prepare their integration into the simulation framework with quetzal::expressive
by dynamically modulating the suitability value as a function of the local elevation.It is a common approach to pack a wealth of information into a sole raster file. For instance, this can involve using a single friction file and designating ocean cells with NA values, and obstacles for dispersal with values of 1. Another way is to try to inject elevational data into the suitability map during the Ecological Niche Modeling step.
-While these approaches are feasible and occasionally advantageous, they do not consistently represent the optimal or most adaptable solution.
-In a broader sense, it's advisable to consider each Geographic Information System (GIS) input file as a means of representing a distinct attribute of the landscape such as suitability, friction, or elevation, utilizing quetzal::geography::landscape
to read and align these input files then utilizing quetzal::expressive
to adjust or combine these quantities according to the user's modeling intentions.
As an illustration we will show in this example how to adjust the stochasticity of a suitability-driven process as a function of the elevation model. This case and its variations can be applicable in various contexts:
-Input
-Output
-quetzal::geography::landscape
and prepare their integration into the simulation framework with quetzal::expressive
and account for trans-oceanic dispersal events by dynamically defining the friction and the carrying capacity of a cell as functions of the suitability and elevation value.Drafting events, in the context of biological dispersal, refer to a phenomenon where organisms are carried across large distances by clinging to or being transported by other organisms, objects, or air currents. This can be thought of as a form of passive dispersal where an organism takes advantage of external forces to move beyond its usual range.
-The term "drafting" is borrowed from concepts in physics. In biology, this concept is applied to scenarios where organisms, often small and lightweight, catch a ride on other organisms (like birds, insects, or larger animals), objects (like debris), or wind currents. Drafting events can play a significant role in the dispersal of organisms, especially those with limited mobility.
-These drafting events provide an opportunity for organisms to reach new areas that they might not be able to access through their own locomotion. It's an interesting ecological phenomenon that highlights the intricate ways in which different species interact and influence each other's distribution and survival.
-The general idea is to define lambda expressions that embed stochastic aspects of the model, while preserving the callable interface (space, time) -> double
.
Input
-Output
-- |
- Quetzal-CoaTL
-
- The Coalescence Template Library
- |
-
While local parameters describe a static relationship to the environment, local processes on a spatial graph are dynamic in nature. They encompass the dynamic phenomena occurring within localized regions defined by the vertices of the graph, including interactions, transformations, and behaviors unfolding at a granular level. Understanding these processes is vital for comprehending how spatial relationships evolve, how information or resources propagate through the graph, and how localized phenomena contribute to broader spatial patterns and their temporal trends.
-In the realm of ecology and evolution, these local processes encompass the intricate dynamics unfolding within specific ecological niches or habitats delineated by the vertices of the graph. These processes encapsulate ecological interactions, evolutionary adaptations, and population dynamics occurring at localized scales, shaping the distribution, abundance, and genetic diversity of species within the spatial landscape.
-Formalizing these local processes is crucial for understanding ecological community assembly, species responses to environmental changes, and the emergence of biodiversity patterns in spatially diverse landscapes. By investigating local ecological and evolutionary dynamics, researchers can uncover the mechanisms underlying species interactions, habitat fragmentation, and speciation events, thus deepening our understanding of ecosystem functioning and resilience in the face of environmental perturbations.
-Local population growth models, integral to ecological and evolutionary studies, allow researchers to simulate and comprehend population dynamics within specific geographic areas or habitats. These models consider environmental conditions, species interactions, and demographic processes to forecast changes in population size and composition over time.
-This page provides examples of how to combine Quetzal components to construct the local simulation process corresponding to your hypotheses.
-A process in which the value at time \( t \) depends on its value at time \( t−1 \) (like population growth over time) is commonly referred to as an autoregressive process or a first-order autoregressive process ( \(AR(1)\)). These are widely used in time series analysis and modeling to capture temporal dependencies and patterns in data.
-In mathematical terms, it can be represented as:
--\[ X_t = \phi X_{t-1} + \epsilon_t \] -
-where:
-Users can represent first-order (or even p-order) autoregressive processes using Quetzal components. Although flexible, the general approach will be to represent time series as std::vector
structures embedded in each vertex or edges they relate to, where a quantity \(q\) a time \(t\) at vertex \(x\) is described by graph[x][q][t]
.
Deterministic models describe population growth based on precise mathematical equations that govern population dynamics. These models typically assume constant parameters and predictable relationships between population variables, such as birth rates, death rates, and carrying capacity. While deterministic models provide valuable insights into long-term population trends, they may oversimplify real-world complexities and fail to account for stochastic fluctuations or environmental variability.
-In this example, we store a time-series vector at each vertex of the graph to monitor the population dynamics. After initializing one vertex with a non-zero value, we iterate through time to update the series. It's important to note that, since we defined no migration along the graph's edges, all time-series except one remain at zero.
-Input
-Output
-Stochastic models introduce randomness and variability into population growth processes, acknowledging the inherent uncertainty in ecological systems. These models incorporate probabilistic elements, such as random fluctuations in birth and death rates, environmental variability, and demographic stochasticity. Stochastic models are particularly useful for capturing the effects of environmental variability and demographic stochasticity on population dynamics, allowing researchers to assess the likelihood of rare events and population extinctions.
-We build up on the previous example by adding some stochasticity in the process. We store a time-series vector at each vertex of the graph to monitor the population dynamics. After initializing one vertex with a non-zero value, we iterate through time to update the series. It's important to note that, since we defined no migration along the graph's edges, some time-series remain at zero.
-Input
-Output
-Environmental niche models focus on how environmental factors influence the distribution and abundance of species within specific habitats. These models integrate ecological niche theory and environmental data to predict species' occurrence probabilities and population densities across spatial gradients. By quantifying the relationships between environmental variables (e.g., temperature, precipitation, habitat quality) and species' ecological requirements, environmental niche models help elucidate how environmental factors shape local population growth and species distributions.
-Input
-Output
-Species competition models explore how interspecific interactions, such as competition for resources or interactions with predators, influence population dynamics and species coexistence within local communities. These models typically incorporate competition coefficients, representing the strength of interspecific interactions, into population equations to simulate the effects of species interactions on population growth rates and carrying capacities. Species competition models provide insights into the mechanisms driving species coexistence, competitive exclusion, and community dynamics within ecological communities.
-Input
-Output
-The challenge of replicating a demographic process within a discrete landscape can be framed as a process on a spatial graph. In this graph, the vertices represent the cells of the landscape grid, while the edges link the areas where migration occurs.
The quantity of edges in this graph significantly influences both complexity and performance. For instance, in a landscape containing \(n\) cells, considering migration between any two arbitrary locations would result in a complete graph with \(\frac{n(n-1)}{2}\) edges, which could pose computational difficulties. A number of alternative assumptions can be made to control the computational feasibility.
All these choices are independently represented in the code and can be extended (although that may require some efforts).
-Constructing a spatial graph first requires to account for the modality of dispersal between the vertices (locations) of the graph. That is, from one source vertex, define which vertices can be targeted: this is the concept of vicinity, or neighborhood.
We distinguish at least 3 modalities:
@@ -183,7 +183,7 @@connect_8_neighbors
: each cell of the landscape grid is connected only to its cardinal (N, E, S, W) and intercardinal (NE, SE, SW, NW) neighbors.connect_fully
: each cell of the landscape grid is connected to all others: the graph is complete.Similarly, assumptions we make about the model's behavior at the bounds of the finite landscape influence the connectivity of the graph. We distinguish at least three bounding modalities:
sink
: cells at the borders of the landscape will be connected to a sink vertex: individuals that migrate past the boundaries of the landscape escape into the world and never come back.torus
: the 2D landscape becomes a 3D torus world, as vertices on opposite borders are linked to their symmetric vertex: individuals that cross the Northern (resp. Western) border reappear on the Southern (resp. Eastern) border.Finally, a last assumption we make about the population process that impacts the graph representation is the directionality of the process:
isotropy
: the migration process is independent of the direction of movement. Moving from vertex \(u\) to \(v\) follows the same rules as moving from \(v\) to \(u\): the edge \(( u,v)\) is the same as \((v,u)\).anisotropy
migration will distinguish between \(( u,v)\) and \((v,u)\), doubling the number of edges in the graph.Input
Output