Chapter 6 Appendix A: Package Function Reference

6.1 Purpose of This Appendix

This appendix serves as a comprehensive reference guide to the functions available in lifesimulatoR.

Throughout this book, we explored several major ideas in origin-of-life research, including:

  • Prebiotic chemistry
  • Molecular evolution
  • Mutation and selection
  • Diversity and complexity
  • Protocells and compartmentalization
  • Autocatalytic networks
  • Competing origin-of-life frameworks

The goal of this appendix is to bring together all package functions in a single location and explain how they fit into the broader conceptual framework of the package.

The package is designed to support teaching, learning, science communication, and exploratory research through simplified computational models inspired by origin-of-life science.

6.2 How the Package is Organized

The package follows a simple conceptual workflow:

  1. Create molecular populations.
  2. Measure molecular properties.
  3. Replicate molecules.
  4. Introduce mutation.
  5. Apply selection.
  6. Simulate evolutionary dynamics.
  7. Measure diversity and complexity.
  8. Explore alternative origin-of-life models.
  9. Visualize results.

These functions are intentionally simple so that the underlying scientific concepts remain transparent and easy to understand.

6.3 A Typical Workflow

A complete molecular evolution workflow might look like:

pool <- create_prebiotic_pool()

fitness <- molecule_fitness(pool)

next_generation <- evolve_generation(pool)

simulation <- simulate_abiogenesis()

plot_simulation(simulation)

This workflow represents a simplified progression from molecular diversity to evolutionary change.

6.4 Package Workflow Diagram

Create molecules
        ↓
Measure properties
        ↓
Replicate
        ↓
Mutate
        ↓
Select
        ↓
Simulate evolution
        ↓
Analyze results
        ↓
Visualize outcomes

Alternative workflows explore protocells and autocatalytic networks independently of molecular evolution.

6.5 Molecular Evolution Functions

These functions support the molecular evolution framework discussed throughout the book.

6.5.1 create_prebiotic_pool()

Creates an initial population of symbolic molecules.

Purpose:

  • Generate molecular diversity
  • Create starting populations
  • Explore prebiotic chemical space

Example:

pool <- create_prebiotic_pool(
  n_molecules = 100,
  min_length = 5,
  max_length = 20
)

Key concepts:

  • Prebiotic chemistry
  • Molecular diversity
  • Chemical space exploration

6.5.2 molecule_fitness()

Assigns simplified fitness values to symbolic molecules.

Purpose:

  • Model differential success
  • Support selection
  • Explore evolutionary dynamics

Example:

fitness <- molecule_fitness(pool)

Key concepts:

  • Selection
  • Differential success
  • Evolutionary potential

6.5.3 replicate_molecules()

Generates offspring molecules according to fitness and selection.

Purpose:

  • Simulate heredity
  • Create new generations
  • Explore selection effects

Example:

offspring <- replicate_molecules(pool)

Key concepts:

  • Replication
  • Heredity
  • Population growth

6.5.4 mutate_sequence()

Mutates a single molecular sequence.

Purpose:

  • Introduce novelty
  • Explore mutation effects
  • Demonstrate sequence variation

Example:

mutate_sequence(
  sequence = "AUGCAUGC",
  mutation_rate = 0.02,
  alphabet = c("A", "U", "G", "C")
)

Key concepts:

  • Mutation
  • Novelty
  • Sequence variation

6.5.5 mutate_population()

Applies mutation across an entire molecular population.

Purpose:

  • Generate population-level variation
  • Support evolutionary simulations

Example:

mutate_population(
  molecules = pool,
  mutation_rate = 0.02
)

Key concepts:

  • Population-level variation
  • Evolutionary exploration

6.5.6 evolve_generation()

Combines mutation, replication, and selection into a single evolutionary step.

Purpose:

  • Model one generation of evolution
  • Combine mutation and selection
  • Produce the next generation

Example:

next_generation <- evolve_generation(pool)

Key concepts:

  • Evolutionary dynamics
  • Selection
  • Adaptation

6.5.7 simulate_abiogenesis()

Runs a complete molecular evolution simulation over many generations.

Purpose:

  • Explore evolutionary trajectories
  • Study mutation-selection dynamics
  • Simulate simplified origin-of-life scenarios

Example:

sim <- simulate_abiogenesis(
  n_molecules = 100,
  generations = 200
)

Key concepts:

  • Evolutionary trajectories
  • Population change through time
  • Origin-of-life modeling

6.6 Diversity and Complexity Functions

These functions help quantify variation and organization within molecular populations.

6.6.1 summarize_molecules()

Generates summary statistics for a molecular population.

Purpose:

  • Summarize population properties
  • Monitor evolutionary change
  • Track simulation outcomes

Example:

summarize_molecules(pool)

Typical outputs include:

  • Population size
  • Average sequence length
  • Diversity
  • Mean fitness
  • Maximum fitness

6.6.2 shannon_entropy()

Calculates Shannon entropy from abundance counts.

Purpose:

  • Measure diversity
  • Explore information theory concepts
  • Compare molecular populations

Example:

counts <- c(10, 5, 1)

shannon_entropy(counts)

Key concepts:

  • Information theory
  • Diversity
  • Uncertainty
  • Complexity

6.7 Visualization Functions

Visualization helps reveal patterns that are difficult to see in raw numerical output.

6.7.1 plot_simulation()

Creates plots from simulation outputs.

Purpose:

  • Visualize evolutionary change
  • Explore diversity trends
  • Analyze protocell and network dynamics

Example:

plot_simulation(
  sim,
  x = "generation",
  y = "mean_fitness"
)

Common applications include:

  • Fitness through time
  • Diversity through time
  • Population growth
  • Protocell dynamics
  • Network abundance trajectories

6.8 Alternative Origin-of-Life Models

These functions explore major alternatives and complements to replication-first models.

6.8.1 protocell_simulation()

Simulates protocell growth, leakage, and division.

Purpose:

  • Explore compartmentalization
  • Investigate protocell dynamics
  • Study population growth

Example:

cells <- protocell_simulation(
  n_cells = 20,
  steps = 100
)

Key concepts:

  • Compartments
  • Growth
  • Division
  • Protocell evolution

Related chapter:

  • Protocells and Compartmentalization

6.8.2 autocatalytic_network()

Simulates catalytic network interactions.

Purpose:

  • Explore self-maintaining systems
  • Study emergence
  • Investigate network organization

Example:

network <- autocatalytic_network(
  n_types = 8,
  steps = 50
)

Key concepts:

  • Catalysis
  • Feedback loops
  • Emergence
  • Network self-maintenance

Related chapter:

  • Autocatalytic Networks

6.9 Function Relationship Map

The following diagram summarizes how the major functions relate to one another.

create_prebiotic_pool()
            │
            ▼
   molecule_fitness()
            │
            ▼
 replicate_molecules()
            │
            ▼
  mutate_population()
            │
            ▼
  evolve_generation()
            │
            ▼
 simulate_abiogenesis()
            │
            ▼
 summarize_molecules()
            │
            ▼
   shannon_entropy()
            │
            ▼
   plot_simulation()

Alternative pathways:

protocell_simulation()

autocatalytic_network()

These models can be explored independently or conceptually linked to molecular evolution scenarios.

6.10 Accessing Documentation

Every exported function includes documentation.

Useful commands include:

help(package = "lifesimulatoR")

?create_prebiotic_pool
?molecule_fitness
?replicate_molecules
?mutate_sequence
?mutate_population
?evolve_generation
?simulate_abiogenesis
?summarize_molecules
?shannon_entropy
?protocell_simulation
?autocatalytic_network
?plot_simulation

browseVignettes("lifesimulatoR")

6.11 Current Scope of the Package

The package currently supports:

  • Symbolic molecular evolution
  • Mutation and selection
  • Diversity measurement
  • Protocell simulations
  • Autocatalytic networks
  • Educational visualization

The models are intentionally simplified and should be viewed as educational tools rather than chemically realistic reconstructions of abiogenesis.

6.12 Future Development

Potential future modules include:

  • RNA World simulations
  • Metabolism-first models
  • Hydrothermal vent environments
  • Wet-dry cycling chemistry
  • Mineral surface catalysis
  • Energy-gradient simulations
  • Lipid vesicle formation
  • Multi-level selection
  • Spatial simulations
  • Reaction-diffusion systems
  • Information-theoretic complexity metrics
  • Artificial life environments
  • Interactive Shiny applications
  • Animated educational visualizations

6.13 Suggested Reading

For readers interested in deeper exploration of origin-of-life concepts:

  • Kauffman, S. (1993). The Origins of Order.
  • Deamer, D. (2019). Assembling Life.
  • Joyce, G. F. (2002). The Antiquity of RNA-Based Evolution.
  • Szostak, J. W., Bartel, D. P., & Luisi, P. L. (2001). Synthesizing Life.
  • Lancet, D., Zidovetzki, R., & Markovitch, O. (2018). Systems Protobiology.

6.14 Key Takeaways

  • lifesimulatoR provides educational tools for exploring major origin-of-life concepts.
  • Molecular evolution functions focus on mutation, replication, heredity, and selection.
  • Diversity functions quantify variation, uncertainty, and complexity.
  • Protocell simulations explore compartmentalization and population dynamics.
  • Autocatalytic network simulations explore emergence, feedback, and self-maintenance.
  • Visualization functions help reveal system-level patterns.
  • The package is intended for teaching, learning, science communication, and exploratory research.
  • The models emphasize conceptual understanding rather than detailed chemical realism.

This appendix can be revisited whenever you need a quick overview of the package structure, function relationships, and available simulation tools.