# grace-hoang/automated-microbiome-r-pipeline architecture

> Architecture diagram of the GitHub repository grace-hoang/automated-microbiome-r-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/grace-hoang/automated-microbiome-r-pipeline
- Repository: https://github.com/grace-hoang/automated-microbiome-r-pipeline

## Overview

This repository is an automated R pipeline for bacterial 16S amplicon analysis. Its principal workflow takes paired FASTQ reads through quality assessment, primer removal, filtering, ASV inference and taxonomy assignment, then builds phyloseq data for downstream analyses. The README documents read tracking, phylogenetic-tree construction, rarefaction, diversity, composition and differential-abundance results, plus resumable intermediate RDS files. The graph follows those documented stages; source excerpts were unavailable, so exact calls and some downstream data dependencies cannot be verified.

Main entry points: [`main.R`](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/main.R) (Pipeline runner), [`R/10_phyloseq_build.R`](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/10_phyloseq_build.R) (Phyloseq construction), [`R/07_chimera_length_filter.R`](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/07_chimera_length_filter.R) (Chimera filtering), [`R/12_rarefaction.R`](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/12_rarefaction.R) (Rarefaction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Configuration"]
  node_params["Pipeline parameters<br/>[00_parameters.R]"]
  node_helpers["Helper functions"]
  node_entry["Pipeline runner<br/>[main.R]"]
end

subgraph group_sequencing["Sequence processing"]
  node_quality["Quality profiles"]
  node_primers["Primer removal"]
  node_filter["Filter and trim<br/>[04_filter_trim.R]"]
  node_errors["Learn errors<br/>[05_learn_errors.R]"]
  node_denoise["Denoise and merge<br/>[06_denoise_merge.R]"]
  node_chimera["Chimera filtering"]
  node_tracking["Read tracking<br/>[08_read_tracking.R]"]
end

subgraph group_modeling["Community modeling"]
  node_taxonomy["Taxonomic assignment<br/>[09_taxonomy.R]"]
  node_phyloseq["Phyloseq construction"]
  node_tree["Phylogenetic tree"]
  node_rarefaction["Rarefaction<br/>[12_rarefaction.R]"]
end

subgraph group_analysis["Downstream analysis"]
  node_alpha["Alpha diversity"]
  node_beta["Beta diversity"]
  node_abundance["Relative abundance"]
  node_ancombc["Differential abundance<br/>[16_ancombc.R]"]
end

node_user(("Analyst"))
node_fastq["FASTQ reads"]
node_metadata["Sample metadata"]
node_silva["SILVA training set"]
node_cutadapt["cutadapt"]
node_results["Saved results"]

node_user -->|"configures"| node_params
node_user -->|"runs"| node_entry
node_entry -->|"runs"| node_quality
node_entry -->|"runs"| node_primers
node_entry -->|"runs"| node_filter
node_entry -->|"runs"| node_errors
node_entry -->|"runs"| node_denoise
node_entry -->|"runs"| node_chimera
node_entry -->|"runs"| node_tracking
node_entry -->|"runs"| node_taxonomy
node_entry -->|"runs"| node_phyloseq
node_entry -->|"runs"| node_tree
node_entry -->|"runs"| node_rarefaction
node_entry -->|"runs"| node_alpha
node_entry -->|"runs"| node_beta
node_entry -->|"runs"| node_abundance
node_entry -->|"runs"| node_ancombc
node_fastq -->|"provides reads"| node_quality
node_quality -->|"guides trimming"| node_primers
node_fastq -->|"provides reads"| node_primers
node_primers -->|"trimmed reads"| node_filter
node_cutadapt -.->|"removes primers"| node_primers
node_filter -->|"filtered reads"| node_errors
node_errors -->|"error models"| node_denoise
node_denoise -->|"ASV table"| node_chimera
node_chimera -->|"read counts"| node_tracking
node_chimera -->|"filtered ASVs"| node_taxonomy
node_silva -->|"training set"| node_taxonomy
node_chimera -->|"filtered ASVs"| node_phyloseq
node_taxonomy -->|"taxonomy"| node_phyloseq
node_metadata -->|"sample data"| node_phyloseq
node_phyloseq -->|"builds tree"| node_tree
node_phyloseq -->|"rarefies"| node_rarefaction
node_rarefaction -->|"diversity input"| node_alpha
node_rarefaction -->|"diversity input"| node_beta
node_rarefaction -->|"composition input"| node_abundance
node_rarefaction -->|"analysis input"| node_ancombc
node_entry -->|"saves checkpoints"| node_results
node_quality -->|"saves outputs"| node_results
node_primers -->|"saves outputs"| node_results
node_filter -->|"saves outputs"| node_results
node_errors -->|"saves outputs"| node_results
node_denoise -->|"saves outputs"| node_results
node_chimera -->|"saves outputs"| node_results
node_tracking -->|"saves outputs"| node_results
node_taxonomy -->|"saves outputs"| node_results
node_phyloseq -->|"saves outputs"| node_results
node_tree -->|"saves outputs"| node_results

click node_params "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/00_parameters.R"
click node_helpers "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/01_helper_functions.R"
click node_entry "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/main.R"
click node_quality "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/02_quality_profiles.R"
click node_primers "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/03_primer_removal.R"
click node_filter "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/04_filter_trim.R"
click node_errors "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/05_learn_errors.R"
click node_denoise "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/06_denoise_merge.R"
click node_chimera "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/07_chimera_length_filter.R"
click node_tracking "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/08_read_tracking.R"
click node_taxonomy "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/09_taxonomy.R"
click node_phyloseq "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/10_phyloseq_build.R"
click node_tree "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/11_phylogenetic_tree.R"
click node_rarefaction "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/12_rarefaction.R"
click node_alpha "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/13_alpha_diversity.R"
click node_beta "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/14_beta_diversity.R"
click node_abundance "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/15_relative_abundance.R"
click node_ancombc "https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/16_ancombc.R"

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_params,node_helpers,node_entry toneBlue
class node_quality,node_primers,node_filter,node_errors,node_denoise,node_chimera,node_tracking toneAmber
class node_taxonomy,node_phyloseq,node_tree,node_rarefaction toneMint
class node_alpha,node_beta,node_abundance,node_ancombc toneRose
class node_user,node_fastq,node_metadata,node_silva,node_cutadapt,node_results toneIndigo
```

## Components

### Configuration

- [Pipeline parameters](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/00_parameters.R): `R/00_parameters.R`
- [Helper functions](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/01_helper_functions.R): `R/01_helper_functions.R`
- [Pipeline runner](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/main.R): `main.R`

### Sequence processing

- [Quality profiles](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/02_quality_profiles.R): `R/02_quality_profiles.R`
- [Primer removal](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/03_primer_removal.R): `R/03_primer_removal.R`
- [Filter and trim](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/04_filter_trim.R): `R/04_filter_trim.R`
- [Learn errors](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/05_learn_errors.R): `R/05_learn_errors.R`
- [Denoise and merge](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/06_denoise_merge.R): `R/06_denoise_merge.R`
- [Chimera filtering](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/07_chimera_length_filter.R): `R/07_chimera_length_filter.R`
- [Read tracking](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/08_read_tracking.R): `R/08_read_tracking.R`

### Community modeling

- [Taxonomic assignment](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/09_taxonomy.R): `R/09_taxonomy.R`
- [Phyloseq construction](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/10_phyloseq_build.R): `R/10_phyloseq_build.R`
- [Phylogenetic tree](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/11_phylogenetic_tree.R): `R/11_phylogenetic_tree.R`
- [Rarefaction](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/12_rarefaction.R): `R/12_rarefaction.R`

### Downstream analysis

- [Alpha diversity](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/13_alpha_diversity.R): `R/13_alpha_diversity.R`
- [Beta diversity](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/14_beta_diversity.R): `R/14_beta_diversity.R`
- [Relative abundance](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/15_relative_abundance.R): `R/15_relative_abundance.R`
- [Differential abundance](https://github.com/grace-hoang/automated-microbiome-r-pipeline/blob/main/R/16_ancombc.R): `R/16_ancombc.R`

### Other components

- **Analyst**
- **FASTQ reads**
- **Sample metadata**
- **SILVA training set**
- **cutadapt**
- **Saved results**

## Connections

- Analyst → Pipeline parameters: configures
- Analyst → Pipeline runner: runs
- Pipeline runner → Quality profiles: runs
- Pipeline runner → Primer removal: runs
- Pipeline runner → Filter and trim: runs
- Pipeline runner → Learn errors: runs
- Pipeline runner → Denoise and merge: runs
- Pipeline runner → Chimera filtering: runs
- Pipeline runner → Read tracking: runs
- Pipeline runner → Taxonomic assignment: runs
- Pipeline runner → Phyloseq construction: runs
- Pipeline runner → Phylogenetic tree: runs
- Pipeline runner → Rarefaction: runs
- Pipeline runner → Alpha diversity: runs
- Pipeline runner → Beta diversity: runs
- Pipeline runner → Relative abundance: runs
- Pipeline runner → Differential abundance: runs
- FASTQ reads → Quality profiles: provides reads
- Quality profiles → Primer removal: guides trimming
- FASTQ reads → Primer removal: provides reads
- Primer removal → Filter and trim: trimmed reads
- cutadapt → Primer removal: removes primers
- Filter and trim → Learn errors: filtered reads
- Learn errors → Denoise and merge: error models
- Denoise and merge → Chimera filtering: ASV table
- Chimera filtering → Read tracking: read counts
- Chimera filtering → Taxonomic assignment: filtered ASVs
- SILVA training set → Taxonomic assignment: training set
- Chimera filtering → Phyloseq construction: filtered ASVs
- Taxonomic assignment → Phyloseq construction: taxonomy
- Sample metadata → Phyloseq construction: sample data
- Phyloseq construction → Phylogenetic tree: builds tree
- Phyloseq construction → Rarefaction: rarefies
- Rarefaction → Alpha diversity: diversity input
- Rarefaction → Beta diversity: diversity input
- Rarefaction → Relative abundance: composition input
- Rarefaction → Differential abundance: analysis input
- Pipeline runner → Saved results: saves checkpoints
- Quality profiles → Saved results: saves outputs
- Primer removal → Saved results: saves outputs
- Filter and trim → Saved results: saves outputs
- Learn errors → Saved results: saves outputs
- Denoise and merge → Saved results: saves outputs
- Chimera filtering → Saved results: saves outputs
- Read tracking → Saved results: saves outputs
- Taxonomic assignment → Saved results: saves outputs
- Phyloseq construction → Saved results: saves outputs
- Phylogenetic tree → Saved results: saves outputs
