# mseelab/jopqua architecture

> Architecture diagram of the GitHub repository mseelab/jopqua, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mseelab/jopqua
- Repository: https://github.com/mseelab/jopqua

## Overview

jOpqua is a Julia simulator for pathogen, host, and immunity dynamics across populations. The documented workflow is to define a model and its population-specific parameters, select an event using model-level rates, then sample participating entities through hierarchical weights; sequence-dependent pathogen and immunity effects influence those weights and event likelihoods. The graph also preserves host genetics, acquired-immunity extensions, and analysis capabilities visible in the source tree. Source excerpts were not provided, so edges rely on the README; the analysis and extension nodes are included as documented-by-tree subsystems without inferred connections.

Main entry points: [`src/simulation/weights.jl`](https://github.com/mseelab/jopqua/blob/main/src/simulation/weights.jl) (Entity weights), [`src/simulation/events.jl`](https://github.com/mseelab/jopqua/blob/main/src/simulation/events.jl) (Event processes), [`src/simulation/choice.jl`](https://github.com/mseelab/jopqua/blob/main/src/simulation/choice.jl) (Event selection), [`src/simulation/structs.jl`](https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl) (Pathogen genetics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Model configuration"]
  node_setup["Model setup<br/>[setup.jl]"]
  node_defaults["Default parameters<br/>[default.jl]"]
end

subgraph group_engine["Simulation engine"]
  node_model["Model entities<br/>[structs.jl]"]
  node_initializers["Initialization<br/>[initializers.jl]"]
  node_constants["Event constants<br/>[constants.jl]"]
  node_simulation["Simulation loop<br/>[simulation.jl]"]
  node_events["Event processes<br/>[events.jl]"]
  node_choice["Event selection<br/>[choice.jl]"]
  node_weights["Entity weights<br/>[weights.jl]"]
end

subgraph group_biology["Biological dynamics"]
  node_pathogen["Pathogen genetics<br/>[structs.jl]"]
  node_host["Host populations<br/>[structs.jl]"]
  node_immunity["Acquired immunity<br/>[immunity.jl]"]
  node_intrahost["Intrahost dynamics<br/>[intrahost.jl]"]
end

subgraph group_analysis["Analysis"]
  node_data["Simulation data<br/>[data.jl]"]
  node_plots["Plots<br/>[plots.jl]"]
end

node_user(("Modeler"))

node_user -->|"configures"| node_setup
node_model -->|"provides rates"| node_choice
node_choice -->|"selects event"| node_events
node_events -->|"samples entities"| node_weights
node_weights -->|"samples hosts"| node_host
node_weights -->|"samples pathogens"| node_pathogen
node_weights -->|"samples immunities"| node_immunity
node_pathogen -->|"modifies weights"| node_weights
node_immunity -->|"modifies weights"| node_weights

click node_setup "https://github.com/mseelab/jopqua/blob/main/src/parameters/setup.jl"
click node_defaults "https://github.com/mseelab/jopqua/blob/main/src/parameters/default.jl"
click node_model "https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl"
click node_initializers "https://github.com/mseelab/jopqua/blob/main/src/simulation/initializers.jl"
click node_constants "https://github.com/mseelab/jopqua/blob/main/src/simulation/constants.jl"
click node_simulation "https://github.com/mseelab/jopqua/blob/main/src/simulation/simulation.jl"
click node_events "https://github.com/mseelab/jopqua/blob/main/src/simulation/events.jl"
click node_choice "https://github.com/mseelab/jopqua/blob/main/src/simulation/choice.jl"
click node_weights "https://github.com/mseelab/jopqua/blob/main/src/simulation/weights.jl"
click node_pathogen "https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl"
click node_host "https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl"
click node_immunity "https://github.com/mseelab/jopqua/blob/main/src/extensions/immunity/immunity.jl"
click node_intrahost "https://github.com/mseelab/jopqua/blob/main/src/extensions/intrahost/intrahost.jl"
click node_data "https://github.com/mseelab/jopqua/blob/main/src/analysis/data.jl"
click node_plots "https://github.com/mseelab/jopqua/blob/main/src/analysis/plots.jl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_setup,node_defaults toneBlue
class node_model,node_initializers,node_constants,node_simulation,node_events,node_choice,node_weights toneAmber
class node_pathogen,node_host,node_immunity,node_intrahost toneMint
class node_data,node_plots toneRose
class node_user toneIndigo
```

## Components

### Model configuration

- [Model setup](https://github.com/mseelab/jopqua/blob/main/src/parameters/setup.jl): `src/parameters/setup.jl`
- [Default parameters](https://github.com/mseelab/jopqua/blob/main/src/parameters/default.jl): `src/parameters/default.jl`

### Simulation engine

- [Model entities](https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl): `src/simulation/structs.jl`
- [Initialization](https://github.com/mseelab/jopqua/blob/main/src/simulation/initializers.jl): `src/simulation/initializers.jl`
- [Event constants](https://github.com/mseelab/jopqua/blob/main/src/simulation/constants.jl): `src/simulation/constants.jl`
- [Simulation loop](https://github.com/mseelab/jopqua/blob/main/src/simulation/simulation.jl): `src/simulation/simulation.jl`
- [Event processes](https://github.com/mseelab/jopqua/blob/main/src/simulation/events.jl): `src/simulation/events.jl`
- [Event selection](https://github.com/mseelab/jopqua/blob/main/src/simulation/choice.jl): `src/simulation/choice.jl`
- [Entity weights](https://github.com/mseelab/jopqua/blob/main/src/simulation/weights.jl): `src/simulation/weights.jl`

### Biological dynamics

- [Pathogen genetics](https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl): `src/simulation/structs.jl`
- [Host populations](https://github.com/mseelab/jopqua/blob/main/src/simulation/structs.jl): `src/simulation/structs.jl`
- [Acquired immunity](https://github.com/mseelab/jopqua/blob/main/src/extensions/immunity/immunity.jl): `src/extensions/immunity/immunity.jl`
- [Intrahost dynamics](https://github.com/mseelab/jopqua/blob/main/src/extensions/intrahost/intrahost.jl): `src/extensions/intrahost/intrahost.jl`

### Analysis

- [Simulation data](https://github.com/mseelab/jopqua/blob/main/src/analysis/data.jl): `src/analysis/data.jl`
- [Plots](https://github.com/mseelab/jopqua/blob/main/src/analysis/plots.jl): `src/analysis/plots.jl`

### Other components

- **Modeler**

## Connections

- Modeler → Model setup: configures (evidence: `README.md`)
- Model entities → Event selection: provides rates (evidence: `README.md`)
- Event selection → Event processes: selects event (evidence: `README.md`)
- Event processes → Entity weights: samples entities (evidence: `README.md`)
- Entity weights → Host populations: samples hosts (evidence: `README.md`)
- Entity weights → Pathogen genetics: samples pathogens (evidence: `README.md`)
- Entity weights → Acquired immunity: samples immunities (evidence: `README.md`)
- Pathogen genetics → Entity weights: modifies weights (evidence: `README.md`)
- Acquired immunity → Entity weights: modifies weights (evidence: `README.md`)
