# microbial-ecology-group/amrplusplus architecture

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

- Interactive diagram: https://gitdiagram.com/microbial-ecology-group/amrplusplus
- Repository: https://github.com/microbial-ecology-group/amrplusplus

## Overview

AMR++ is a Nextflow pipeline for turning sequencing reads into antimicrobial-resistance, microbiome, and related analysis outputs. Its main workflow is raw FASTQ input through quality control, alignment and resistome counting, followed by count matrices and optional SNV confirmation, rarefaction, or coverage-threshold evaluation. The README documents these capabilities, but the Nextflow orchestration files were not excerpted; links to specific workflow stages are therefore shown as unverified dashed edges. The graph also includes the source-indexed analysis scripts and the MEGARes reference data.

Main entry points: [`subworkflows/AMR++_standard.nf`](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/AMR%2B%2B_standard.nf) (Standard workflows), [`main_AMR++.nf`](https://github.com/microbial-ecology-group/amrplusplus/blob/master/main_AMR%2B%2B.nf) (Pipeline entry), [`subworkflows/fastq_align.nf`](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_align.nf) (Read alignment), [`bin/alignment_analyzer.py`](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/alignment_analyzer.py) (Alignment counting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Workflow orchestration"]
  node_nextflow_entry["Pipeline entry<br/>[main_AMR++.nf]"]
  node_standard_workflows["Standard workflows<br/>[AMR++_standard.nf]"]
  node_workflow_variants["Workflow variants"]
end

subgraph group_read_processing["Read processing"]
  node_qc_trim["QC and trimming"]
  node_merge_reads["Read merging<br/>[fastq_merging.nf]"]
  node_host_removal["Host removal"]
  node_alignment["Read alignment<br/>[fastq_align.nf]"]
end

subgraph group_analysis["Resistance analysis"]
  node_resistome["Resistome workflow<br/>[fastq_resistome.nf]"]
  node_analyzer["Alignment counting"]
  node_megares[("MEGARes references")]
  node_microbiome["Microbiome profiling"]
end

subgraph group_extensions["Analysis extensions"]
  node_snv_workflow["SNV confirmation<br/>[bam_snv.nf]"]
  node_snv_prep["SNV preparation<br/>[prep_NGLess.py]"]
  node_snv_matrix["SNV matrix filtering"]
  node_coverage_eval["Coverage evaluation"]
end

subgraph group_reporting["Reporting"]
  node_kraken_matrix["Taxonomy matrices"]
  node_evaluation_combine["Evaluation matrices"]
  node_rarefaction["Rarefaction plots<br/>[rfplot.py]"]
  node_read_stats["Read statistics"]
  node_mapq_report["Alignment diagnostics"]
  node_count_matrices["Resistome matrices"]
end

node_researcher(("Researcher"))
node_fastq["Sequencing reads"]

node_researcher -->|"runs"| node_nextflow_entry
node_fastq -->|"provides reads"| node_nextflow_entry
node_nextflow_entry -.->|"dispatches"| node_standard_workflows
node_nextflow_entry -.->|"selects variant"| node_workflow_variants
node_standard_workflows -.->|"runs QC"| node_qc_trim
node_standard_workflows -.->|"supports merging"| node_merge_reads
node_standard_workflows -.->|"supports removal"| node_host_removal
node_standard_workflows -.->|"aligns reads"| node_alignment
node_standard_workflows -.->|"runs analysis"| node_resistome
node_resistome -.->|"counts alignments"| node_analyzer
node_analyzer -->|"uses reference"| node_megares
node_analyzer -->|"writes counts"| node_count_matrices
node_standard_workflows -.->|"offers profiling"| node_microbiome
node_microbiome -.->|"formats taxonomy"| node_kraken_matrix
node_standard_workflows -->|"offers confirmation"| node_snv_workflow
node_snv_workflow -.->|"prepares calls"| node_snv_prep
node_snv_workflow -.->|"filters matrix"| node_snv_matrix
node_alignment -.->|"evaluates thresholds"| node_coverage_eval
node_coverage_eval -->|"combines outputs"| node_evaluation_combine
node_standard_workflows -.->|"offers rarefaction"| node_rarefaction
node_qc_trim -.->|"summarizes stats"| node_read_stats
node_alignment -.->|"reports MAPQ"| node_mapq_report

click node_nextflow_entry "https://github.com/microbial-ecology-group/amrplusplus/blob/master/main_AMR%2B%2B.nf"
click node_standard_workflows "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/AMR%2B%2B_standard.nf"
click node_workflow_variants "https://github.com/microbial-ecology-group/amrplusplus/tree/master/subworkflows"
click node_qc_trim "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_QC_trimming.nf"
click node_merge_reads "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_merging.nf"
click node_host_removal "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_host_removal.nf"
click node_alignment "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_align.nf"
click node_resistome "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_resistome.nf"
click node_analyzer "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/alignment_analyzer.py"
click node_megares "https://github.com/microbial-ecology-group/amrplusplus/tree/master/data/amr"
click node_microbiome "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_microbiome.nf"
click node_kraken_matrix "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/kraken2_long_to_wide.py"
click node_snv_workflow "https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/bam_snv.nf"
click node_snv_prep "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/SNV_calling/prep_NGLess.py"
click node_snv_matrix "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/SNV_calling/Filter_SNV_matrix.py"
click node_coverage_eval "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/coverage_threshold_evaluation.py"
click node_evaluation_combine "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/combine_evaluation_results.py"
click node_rarefaction "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/rfplot.py"
click node_read_stats "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/summarize_read_stats.py"
click node_mapq_report "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/reads_to_gene_mapq.py"
click node_count_matrices "https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/alignment_analyzer.py"

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_nextflow_entry,node_standard_workflows,node_workflow_variants toneBlue
class node_qc_trim,node_merge_reads,node_host_removal,node_alignment toneAmber
class node_resistome,node_analyzer,node_megares,node_microbiome toneMint
class node_snv_workflow,node_snv_prep,node_snv_matrix,node_coverage_eval toneRose
class node_kraken_matrix,node_evaluation_combine,node_rarefaction,node_read_stats,node_mapq_report,node_count_matrices,node_researcher,node_fastq toneIndigo
```

## Components

### Workflow orchestration

- [Pipeline entry](https://github.com/microbial-ecology-group/amrplusplus/blob/master/main_AMR%2B%2B.nf): `main_AMR++.nf`
- [Standard workflows](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/AMR%2B%2B_standard.nf): `subworkflows/AMR++_standard.nf`
- [Workflow variants](https://github.com/microbial-ecology-group/amrplusplus/tree/master/subworkflows): `subworkflows`

### Read processing

- [QC and trimming](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_QC_trimming.nf): `subworkflows/fastq_QC_trimming.nf`
- [Read merging](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_merging.nf): `subworkflows/fastq_merging.nf`
- [Host removal](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_host_removal.nf): `subworkflows/fastq_host_removal.nf`
- [Read alignment](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_align.nf): `subworkflows/fastq_align.nf`

### Resistance analysis

- [Resistome workflow](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_resistome.nf): `subworkflows/fastq_resistome.nf`
- [Alignment counting](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/alignment_analyzer.py): `bin/alignment_analyzer.py`
- [MEGARes references](https://github.com/microbial-ecology-group/amrplusplus/tree/master/data/amr): `data/amr`
- [Microbiome profiling](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/fastq_microbiome.nf): `subworkflows/fastq_microbiome.nf`

### Analysis extensions

- [SNV confirmation](https://github.com/microbial-ecology-group/amrplusplus/blob/master/subworkflows/bam_snv.nf): `subworkflows/bam_snv.nf`
- [SNV preparation](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/SNV_calling/prep_NGLess.py): `bin/SNV_calling/prep_NGLess.py`
- [SNV matrix filtering](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/SNV_calling/Filter_SNV_matrix.py): `bin/SNV_calling/Filter_SNV_matrix.py`
- [Coverage evaluation](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/coverage_threshold_evaluation.py): `bin/coverage_threshold_evaluation.py`

### Reporting

- [Taxonomy matrices](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/kraken2_long_to_wide.py): `bin/kraken2_long_to_wide.py`
- [Evaluation matrices](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/combine_evaluation_results.py): `bin/combine_evaluation_results.py`
- [Rarefaction plots](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/rfplot.py): `bin/rfplot.py`
- [Read statistics](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/summarize_read_stats.py): `bin/summarize_read_stats.py`
- [Alignment diagnostics](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/reads_to_gene_mapq.py): `bin/reads_to_gene_mapq.py`
- [Resistome matrices](https://github.com/microbial-ecology-group/amrplusplus/blob/master/bin/alignment_analyzer.py): `bin/alignment_analyzer.py`

### Other components

- **Researcher**
- **Sequencing reads**

## Connections

- Researcher → Pipeline entry: runs (evidence: `README.md`)
- Sequencing reads → Pipeline entry: provides reads (evidence: `README.md`)
- Pipeline entry → Standard workflows: dispatches
- Pipeline entry → Workflow variants: selects variant
- Standard workflows → QC and trimming: runs QC
- Standard workflows → Read merging: supports merging
- Standard workflows → Host removal: supports removal
- Standard workflows → Read alignment: aligns reads
- Standard workflows → Resistome workflow: runs analysis
- Resistome workflow → Alignment counting: counts alignments
- Alignment counting → MEGARes references: uses reference (evidence: `README.md`)
- Alignment counting → Resistome matrices: writes counts (evidence: `README.md`)
- Standard workflows → Microbiome profiling: offers profiling
- Microbiome profiling → Taxonomy matrices: formats taxonomy
- Standard workflows → SNV confirmation: offers confirmation (evidence: `README.md`)
- SNV confirmation → SNV preparation: prepares calls
- SNV confirmation → SNV matrix filtering: filters matrix
- Read alignment → Coverage evaluation: evaluates thresholds
- Coverage evaluation → Evaluation matrices: combines outputs (evidence: `bin/combine_evaluation_results.py`)
- Standard workflows → Rarefaction plots: offers rarefaction
- QC and trimming → Read statistics: summarizes stats
- Read alignment → Alignment diagnostics: reports MAPQ
