To run simulations, we resort to a single function with a wide variety of parameters.

Patches.repeat_paramsFunction

MANDATORY ARGUMENTS

  • n_repeats::Int64: Number of repetitions for the simulation.
  • basepath::String: Path to the directory where the results will be saved.

OPTIONAL ARGUMENTS Resource parameters:

  • n_complex::Int64: Number of complex resources. Default is 3.
  • n_simple::Int64: Number of simple resources. Default is 10.
  • n_monomer::Int64: Number of monomer resources. Default is 5.
  • gapsize::Int64: Size of the gap between complex and simple resources. Default is 15.

Resource supply parameters:

  • influx_amount::Float64: Amount of resource influx. Default is 0.0.
  • influx_time::Float64: Time between resource influxes. Default is 1.0.
  • alpha_high::Float64: Controls constant resource supply if mucus=false. Each local community receives a continuous supply 100 units of complex resource, of which alpha_high amount is dedicated to a single complex resource. The remainder is split evenly between other complex resources. Default is 100.0.

Species parameters:

  • n_invaders::Int64: Number of invading species. Default is 100.
  • t_inv::Float64: Time between the introduction of invading species. Default is 1.0.
  • n_species::Int64: Number of species initially in the habitat. Default is 1.
  • pool_size::Int64: Size of the species pool. Default is 500.
  • tradeoff_strength__number_consumed::Float64: Trade-off strength for the number of resources consumed. Default is 0.1.
  • tradeoff_strength__numberofsplits::Float64: Trade-off strength for the "complexity" of a species' reaction repertoire, based on the number of enzymatic cuts they perform. Default is 0.1.
  • h::Float64: Reaction rate allocation tradeoff. The h-th power of reaction rates in a species always sums to one. Default is 1.0.
  • gen_n_consumed::Int64: Number of resources consumed by generalist species. Default is 4.
  • spec_n_consumed::Int64: Number of resources consumed by specialist species. Default is 1.
  • consume_all_monomers::Bool: Whether every species is able to consume all monomers. Default is false.

Mucus parameters:

  • mucus::Bool: Whether to include mucus in the simulation, where resource supply is constant. Default is true.
  • mucus_disjunct::Bool: Whether the mucus resource is disjunct from the rest of the primary resources (there is no overlap in their byproducts). Default is true.
  • mucus_simple::Int64: Only used if mucus_disjunt=true Number of simple resources in the mucus resource breakdown pathways. Default is 5.
  • mucus_mono::Int64: Only used if mucus_disjunt=true Number of monomer resources in the mucus resource breakdown pathways. Default is 4.
  • mucus_gap::Int64: Only used if mucus_disjunt=true Size of the gap between mucus and simple mucus-specific resources. Default is 10.

Simulation parameters:

  • ncomms::Int64: Number of communities in the simulation. Default is 3.
  • t_span::Tuple{Float64, Float64}: Time span of the simulation. Default is (0, 150).
  • cutoff::Float64: Species under cutoff are considered extinct. Default is 0.0001.
  • symmetrical::Bool: Whether diffusion is symmetrical or directional across communities. Default is true.
  • limited_pathways::Bool: Whether to limit the underlying metabolic reaction system by excluding ~half of the energetically possible byproducts of resources. Default is true.

Stochasticity parameters:

  • set_seeds::Union{Nothing, Vector{Int64}}: If provided, seeds for each repeat. Default is nothing.
  • fix_metab::Bool: Whether to use the same metabolism for all repeats. Default is false.
  • fix_pool::Bool: Whether to use the same species pool for all repeats. Default is false.
  • fix_sample::Bool: Whether to use the same sample for all repeats. Default is false.
  • fix_callbacks::Bool: Whether to use the same callbacks for all repeats. Default is false.
  • fix_order::Bool: Whether to fix the order of invading species. Default is false.
source

Each simulation will have its own subfolder in the specified output folder, where the following things are saved:

  • params: Parameters of the simulation
  • beta_diversity plot: A measure of how different the composition of local communities are

Beta diversity plot

  • shannon_diversity plot: A measure of the diversity of all populations of the simulation pooled together

Shannon diversity plot

  • MCI plot: Metabolic Capacity Index of the of the system. Tracks the total number of different reactions by taking all of the species stoichiometric matrices and adding 1 for each position where at least 1 species has a non-zero entry

MCI plot

  • consumer_types plot: Tracks the total number of primary consumer (generalist) and secondary consumer (specialist) species across the system

Consumer types plot

  • species_counts plot: Tracks the total number of different species across the system

Species counts plot

  • comm_totals plot: Tracks the total abundance of members for each local community

Community total abundances plot

  • community graph plots: A separate graph for each local community, depicting the active pathways. Species nodes are blue, resource nodes are green. Red arrows indicate consumption, green arrows indicate production. Arrow widths are weighted according to the pathway fluxes.

Community graph plots

Outside of the individual run folders, we will find the following outputs:

  • Aggregated versions of the Beta diversity, Shannon diversity, Species counts, MCI, Consumer types and Community totals figures. Standard deviation is shown in all but the last two figures of the above list.

  • Tr_rel_something plots correspond to the same measures, but they take an average of these measures around the end of the transient (tr) and at the end of the relaxation (rel) period for each simulation. The mean and standard deviation are shown.

  • JLD2 format files are used to store the data needed for generating all of the above plots.