# gledguri/quantitative-multispecies-edna architecture

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

- Interactive diagram: https://gitdiagram.com/gledguri/quantitative-multispecies-edna
- Repository: https://github.com/gledguri/quantitative-multispecies-edna
- Video tour (about a minute): https://gitdiagram.com/gledguri/quantitative-multispecies-edna/video

## Overview

This repository is a reproducible multispecies eDNA analysis pipeline: obtain input data and sequencing reads, prepare qPCR/metabarcoding data, fit a joint calibration-and-abundance model, spatially smooth concentration estimates, and produce manuscript figures. The README documents the analysis stages and their artifacts; only the SRA download and FASTQ concatenation implementations were excerpted, so other workflow links reflect README evidence rather than inspected notebook code.

Main entry points: [`code/1_Run_QM_qPCR.qmd`](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/1_Run_QM_qPCR.qmd) (Joint model workflow), [`code/0_Download_data.R`](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/0_Download_data.R) (Download setup), [`code/2_sdmTMB_smooths_13sp.qmd`](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/2_sdmTMB_smooths_13sp.qmd) (Spatial smooth fitting), [`code/sra_python/download_sra.py`](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/sra_python/download_sra.py) (SRA downloader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_setup["Download setup<br/>[0_Download_data.R]"]
  node_sra_download["SRA downloader<br/>[download_sra.py]"]
  node_fastq_concat["FASTQ concatenator"]
end

subgraph group_analysis["Joint inference"]
  node_data_prep["Input preparation"]
  node_prep_helpers["Cleaning and QC"]
  node_joint_workflow["Joint model workflow<br/>[1_Run_QM_qPCR.qmd]"]
  node_joint_model["Joint qPCR metabarcoding model<br/>[Joint_model.stan]"]
  node_mock_model["Mock calibration model<br/>[Mock_model.stan]"]
  node_mock_fit["Saved calibration fit<br/>[Mock_model.rds]"]
end

subgraph group_mapping["Spatial mapping"]
  node_spatial_workflow["Spatial smooth fitting"]
  node_smooth_helpers["Smoothing helpers<br/>[smoothers.R]"]
end

subgraph group_presentation["Figure production"]
  node_figure_workflow["Manuscript figures<br/>[3_All_Figures.qmd]"]
  node_final_plots["Final figures"]
  node_raw_plots["External-software figures"]
end

node_analyst(("Analyst"))
node_zenodo[("Zenodo data")]
node_ncbi[("NCBI SRA")]
node_intermediate[("Cached analysis outputs")]
node_sra_files[("Downloaded FASTQ reads")]

node_analyst -->|"runs first"| node_setup
node_setup -->|"downloads data"| node_zenodo
node_setup -->|"calls"| node_sra_download
node_ncbi -->|"provides metadata"| node_sra_download
node_sra_download -->|"downloads reads"| node_sra_files
node_setup -->|"calls"| node_fastq_concat
node_sra_files -->|"reads files"| node_fastq_concat
node_fastq_concat -->|"writes combined reads"| node_sra_files
node_zenodo -->|"supplies inputs"| node_data_prep
node_data_prep -.->|"uses utilities"| node_prep_helpers
node_analyst -->|"renders"| node_joint_workflow
node_joint_workflow -->|"loads inputs"| node_data_prep
node_joint_workflow -->|"fits model"| node_joint_model
node_joint_workflow -->|"runs calibration"| node_mock_model
node_joint_workflow -->|"reuses fit"| node_mock_fit
node_joint_workflow -->|"writes estimates"| node_intermediate
node_analyst -->|"renders"| node_spatial_workflow
node_intermediate -->|"provides concentrations"| node_spatial_workflow
node_spatial_workflow -.->|"uses functions"| node_smooth_helpers
node_spatial_workflow -->|"writes smooths"| node_intermediate
node_analyst -->|"renders"| node_figure_workflow
node_intermediate -->|"provides model outputs"| node_figure_workflow
node_figure_workflow -->|"produces figures"| node_final_plots
node_raw_plots -->|"provides provenance figures"| node_analyst

click node_setup "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/0_Download_data.R"
click node_sra_download "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/sra_python/download_sra.py"
click node_fastq_concat "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/sra_python/concatenate_fastq.py"
click node_data_prep "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/load_QM-qPCR_data.R"
click node_prep_helpers "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/qm_data_prep_functions.R"
click node_joint_workflow "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/1_Run_QM_qPCR.qmd"
click node_joint_model "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Joint_model.stan"
click node_mock_model "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Mock_model.stan"
click node_mock_fit "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Mock_model.rds"
click node_spatial_workflow "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/2_sdmTMB_smooths_13sp.qmd"
click node_smooth_helpers "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/smoothers.R"
click node_figure_workflow "https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/3_All_Figures.qmd"
click node_final_plots "https://github.com/gledguri/quantitative-multispecies-edna/tree/main/plots"
click node_raw_plots "https://github.com/gledguri/quantitative-multispecies-edna/tree/main/raw_plots"

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_sra_download,node_fastq_concat toneBlue
class node_data_prep,node_prep_helpers,node_joint_workflow,node_joint_model,node_mock_model,node_mock_fit,node_zenodo,node_ncbi,node_intermediate,node_sra_files toneAmber
class node_spatial_workflow,node_smooth_helpers toneMint
class node_figure_workflow,node_final_plots,node_raw_plots toneRose
class node_analyst toneIndigo
```

## Components

### Data acquisition

- [Download setup](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/0_Download_data.R): `code/0_Download_data.R`
- [SRA downloader](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/sra_python/download_sra.py): `code/sra_python/download_sra.py`
- [FASTQ concatenator](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/sra_python/concatenate_fastq.py): `code/sra_python/concatenate_fastq.py`

### Joint inference

- [Input preparation](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/load_QM-qPCR_data.R): `code/load_QM-qPCR_data.R`
- [Cleaning and QC](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/qm_data_prep_functions.R): `code/qm_data_prep_functions.R`
- [Joint model workflow](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/1_Run_QM_qPCR.qmd): `code/1_Run_QM_qPCR.qmd`
- [Joint qPCR metabarcoding model](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Joint_model.stan): `code/Stan_models/Joint_model.stan`
- [Mock calibration model](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Mock_model.stan): `code/Stan_models/Mock_model.stan`
- [Saved calibration fit](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/Stan_models/Mock_model.rds): `code/Stan_models/Mock_model.rds`

### Spatial mapping

- [Spatial smooth fitting](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/2_sdmTMB_smooths_13sp.qmd): `code/2_sdmTMB_smooths_13sp.qmd`
- [Smoothing helpers](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/smoothers.R): `code/smoothers.R`

### Figure production

- [Manuscript figures](https://github.com/gledguri/quantitative-multispecies-edna/blob/main/code/3_All_Figures.qmd): `code/3_All_Figures.qmd`
- [Final figures](https://github.com/gledguri/quantitative-multispecies-edna/tree/main/plots): `plots`
- [External-software figures](https://github.com/gledguri/quantitative-multispecies-edna/tree/main/raw_plots): `raw_plots`

### Other components

- **Analyst**
- **Zenodo data**
- **NCBI SRA**
- **Cached analysis outputs**
- **Downloaded FASTQ reads**

## Connections

- Analyst → Download setup: runs first (evidence: `README.md`)
- Download setup → Zenodo data: downloads data (evidence: `README.md`)
- Download setup → SRA downloader: calls (evidence: `README.md`)
- NCBI SRA → SRA downloader: provides metadata (evidence: `code/sra_python/download_sra.py`)
- SRA downloader → Downloaded FASTQ reads: downloads reads (evidence: `code/sra_python/download_sra.py`)
- Download setup → FASTQ concatenator: calls (evidence: `README.md`)
- Downloaded FASTQ reads → FASTQ concatenator: reads files (evidence: `code/sra_python/concatenate_fastq.py`)
- FASTQ concatenator → Downloaded FASTQ reads: writes combined reads (evidence: `code/sra_python/concatenate_fastq.py`)
- Zenodo data → Input preparation: supplies inputs (evidence: `README.md`)
- Input preparation → Cleaning and QC: uses utilities
- Analyst → Joint model workflow: renders (evidence: `README.md`)
- Joint model workflow → Input preparation: loads inputs (evidence: `README.md`)
- Joint model workflow → Joint qPCR metabarcoding model: fits model (evidence: `README.md`)
- Joint model workflow → Mock calibration model: runs calibration (evidence: `README.md`)
- Joint model workflow → Saved calibration fit: reuses fit (evidence: `README.md`)
- Joint model workflow → Cached analysis outputs: writes estimates (evidence: `README.md`)
- Analyst → Spatial smooth fitting: renders (evidence: `README.md`)
- Cached analysis outputs → Spatial smooth fitting: provides concentrations (evidence: `README.md`)
- Spatial smooth fitting → Smoothing helpers: uses functions
- Spatial smooth fitting → Cached analysis outputs: writes smooths (evidence: `README.md`)
- Analyst → Manuscript figures: renders (evidence: `README.md`)
- Cached analysis outputs → Manuscript figures: provides model outputs (evidence: `README.md`)
- Manuscript figures → Final figures: produces figures (evidence: `README.md`)
- External-software figures → Analyst: provides provenance figures (evidence: `README.md`)
