# aldodale/amber architecture

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

- Interactive diagram: https://gitdiagram.com/aldodale/amber
- Repository: https://github.com/aldodale/amber

## Overview

AMBER is an R package for microbial barcode analysis. Its documented user workflow sets up paired-read samples, trims and filters sequences, then merges reads and assigns taxonomy to produce an ASV-focused result. The source tree also exposes capabilities for diversity calculations, dataset and taxonomy filtering, statistical analysis, visualization, and tree construction. These additional modules are included as product branches, but their internal call relationships are not shown in the supplied excerpts; only the README-documented workflow is connected.

Main entry points: [`R/Classes.R`](https://github.com/aldodale/amber/blob/main/R/Classes.R) (AMBER result), [`R/el_trimmador.R`](https://github.com/aldodale/amber/blob/main/R/el_trimmador.R) (Read trimming), [`R/sample_setup.R`](https://github.com/aldodale/amber/blob/main/R/sample_setup.R) (Sample setup), [`R/mergeAndTaxonomy.R`](https://github.com/aldodale/amber/blob/main/R/mergeAndTaxonomy.R) (Merge and taxonomy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preprocess["Read preprocessing"]
  node_setup["Sample setup<br/>[sample_setup.R]"]
  node_quality["Quality check<br/>[Classes.R]"]
  node_trim["Read trimming<br/>[el_trimmador.R]"]
  node_primer["Primer removal"]
  node_merge["Merge and taxonomy<br/>[mergeAndTaxonomy.R]"]
end

subgraph group_analysis["Community analysis"]
  node_result["AMBER result<br/>[Classes.R]"]
  node_filter_data["Dataset filtering<br/>[filter_dataset.R]"]
  node_filter_tax["Taxonomy filtering<br/>[filter_taxonomy.R]"]
  node_diversity["Diversity analysis"]
  node_diversity_metrics["Diversity metrics<br/>[diversitiesCalc.R]"]
  node_anova["ANOVA analysis<br/>[plot_anova.R]"]
end

subgraph group_visualization["Visualization"]
  node_bars["Bar plots<br/>[plot_bars.R]"]
  node_heatmap["Heatmaps<br/>[plot_heatmap.R]"]
  node_rda["RDA plots<br/>[plot_rda.R]"]
  node_diversity_plot["Diversity plots<br/>[plotDiversities.R]"]
  node_asv_tree["ASV trees<br/>[do.tree.asvs.R]"]
  node_asv_clusters["ASV clustering"]
  node_sample_tree["Sample trees<br/>[do.tree.samples.R]"]
end

subgraph group_application["User interface"]
  node_shiny["Shiny interface<br/>[makeitshiny.R]"]
end

node_researcher(("Researcher"))
node_cutadapt{{"Cutadapt"}}

node_researcher -->|"provides samples"| node_setup
node_setup -->|"returns checks"| node_quality
node_researcher -->|"submits checked reads"| node_trim
node_trim -.->|"removes primers"| node_primer
node_trim -.->|"can invoke"| node_cutadapt
node_researcher -->|"submits filtered reads"| node_merge
node_merge -->|"returns ASVs"| node_result
node_result -.->|"may be filtered"| node_filter_data
node_result -.->|"may be filtered"| node_filter_tax
node_result -.->|"may be analyzed"| node_diversity
node_diversity -.->|"may calculate"| node_diversity_metrics
node_result -.->|"may support"| node_anova
node_result -.->|"may visualize"| node_bars
node_result -.->|"may visualize"| node_heatmap
node_result -.->|"may visualize"| node_rda
node_result -.->|"may visualize"| node_diversity_plot
node_result -.->|"may construct"| node_asv_tree
node_result -.->|"may cluster"| node_asv_clusters
node_result -.->|"may construct"| node_sample_tree
node_researcher -.->|"uses"| node_shiny

click node_setup "https://github.com/aldodale/amber/blob/main/R/sample_setup.R"
click node_quality "https://github.com/aldodale/amber/blob/main/R/Classes.R"
click node_trim "https://github.com/aldodale/amber/blob/main/R/el_trimmador.R"
click node_primer "https://github.com/aldodale/amber/blob/main/R/removePrimersCutadapt.R"
click node_merge "https://github.com/aldodale/amber/blob/main/R/mergeAndTaxonomy.R"
click node_result "https://github.com/aldodale/amber/blob/main/R/Classes.R"
click node_filter_data "https://github.com/aldodale/amber/blob/main/R/filter_dataset.R"
click node_filter_tax "https://github.com/aldodale/amber/blob/main/R/filter_taxonomy.R"
click node_diversity "https://github.com/aldodale/amber/blob/main/R/calculate_diversities.R"
click node_diversity_metrics "https://github.com/aldodale/amber/blob/main/R/diversitiesCalc.R"
click node_anova "https://github.com/aldodale/amber/blob/main/R/plot_anova.R"
click node_bars "https://github.com/aldodale/amber/blob/main/R/plot_bars.R"
click node_heatmap "https://github.com/aldodale/amber/blob/main/R/plot_heatmap.R"
click node_rda "https://github.com/aldodale/amber/blob/main/R/plot_rda.R"
click node_diversity_plot "https://github.com/aldodale/amber/blob/main/R/plotDiversities.R"
click node_asv_tree "https://github.com/aldodale/amber/blob/main/R/do.tree.asvs.R"
click node_asv_clusters "https://github.com/aldodale/amber/blob/main/R/do.tree.asvs.nclust.R"
click node_sample_tree "https://github.com/aldodale/amber/blob/main/R/do.tree.samples.R"
click node_shiny "https://github.com/aldodale/amber/blob/main/R/makeitshiny.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_setup,node_quality,node_trim,node_primer,node_merge toneBlue
class node_result,node_filter_data,node_filter_tax,node_diversity,node_diversity_metrics,node_anova toneAmber
class node_bars,node_heatmap,node_rda,node_diversity_plot,node_asv_tree,node_asv_clusters,node_sample_tree toneMint
class node_shiny toneRose
class node_researcher,node_cutadapt toneIndigo
```

## Components

### Read preprocessing

- [Sample setup](https://github.com/aldodale/amber/blob/main/R/sample_setup.R): `R/sample_setup.R`
- [Quality check](https://github.com/aldodale/amber/blob/main/R/Classes.R): `R/Classes.R`
- [Read trimming](https://github.com/aldodale/amber/blob/main/R/el_trimmador.R): `R/el_trimmador.R`
- [Primer removal](https://github.com/aldodale/amber/blob/main/R/removePrimersCutadapt.R): `R/removePrimersCutadapt.R`
- [Merge and taxonomy](https://github.com/aldodale/amber/blob/main/R/mergeAndTaxonomy.R): `R/mergeAndTaxonomy.R`

### Community analysis

- [AMBER result](https://github.com/aldodale/amber/blob/main/R/Classes.R): `R/Classes.R`
- [Dataset filtering](https://github.com/aldodale/amber/blob/main/R/filter_dataset.R): `R/filter_dataset.R`
- [Taxonomy filtering](https://github.com/aldodale/amber/blob/main/R/filter_taxonomy.R): `R/filter_taxonomy.R`
- [Diversity analysis](https://github.com/aldodale/amber/blob/main/R/calculate_diversities.R): `R/calculate_diversities.R`
- [Diversity metrics](https://github.com/aldodale/amber/blob/main/R/diversitiesCalc.R): `R/diversitiesCalc.R`
- [ANOVA analysis](https://github.com/aldodale/amber/blob/main/R/plot_anova.R): `R/plot_anova.R`

### Visualization

- [Bar plots](https://github.com/aldodale/amber/blob/main/R/plot_bars.R): `R/plot_bars.R`
- [Heatmaps](https://github.com/aldodale/amber/blob/main/R/plot_heatmap.R): `R/plot_heatmap.R`
- [RDA plots](https://github.com/aldodale/amber/blob/main/R/plot_rda.R): `R/plot_rda.R`
- [Diversity plots](https://github.com/aldodale/amber/blob/main/R/plotDiversities.R): `R/plotDiversities.R`
- [ASV trees](https://github.com/aldodale/amber/blob/main/R/do.tree.asvs.R): `R/do.tree.asvs.R`
- [ASV clustering](https://github.com/aldodale/amber/blob/main/R/do.tree.asvs.nclust.R): `R/do.tree.asvs.nclust.R`
- [Sample trees](https://github.com/aldodale/amber/blob/main/R/do.tree.samples.R): `R/do.tree.samples.R`

### User interface

- [Shiny interface](https://github.com/aldodale/amber/blob/main/R/makeitshiny.R): `R/makeitshiny.R`

### Other components

- **Researcher**
- **Cutadapt**

## Connections

- Researcher → Sample setup: provides samples (evidence: `readme.md`)
- Sample setup → Quality check: returns checks (evidence: `readme.md`)
- Researcher → Read trimming: submits checked reads (evidence: `readme.md`)
- Read trimming → Primer removal: removes primers
- Read trimming → Cutadapt: can invoke (evidence: `readme.md`)
- Researcher → Merge and taxonomy: submits filtered reads (evidence: `readme.md`)
- Merge and taxonomy → AMBER result: returns ASVs (evidence: `readme.md`)
- AMBER result → Dataset filtering: may be filtered
- AMBER result → Taxonomy filtering: may be filtered
- AMBER result → Diversity analysis: may be analyzed
- Diversity analysis → Diversity metrics: may calculate
- AMBER result → ANOVA analysis: may support
- AMBER result → Bar plots: may visualize
- AMBER result → Heatmaps: may visualize
- AMBER result → RDA plots: may visualize
- AMBER result → Diversity plots: may visualize
- AMBER result → ASV trees: may construct
- AMBER result → ASV clustering: may cluster
- AMBER result → Sample trees: may construct
- Researcher → Shiny interface: uses
