# ncbi/amr architecture

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

- Interactive diagram: https://gitdiagram.com/ncbi/amr
- Repository: https://github.com/ncbi/amr

## Overview

AMRFinderPlus is a command-line bioinformatics tool for identifying acquired antimicrobial-resistance genes and point mutations, with additional stress, heat, biocide-resistance, and virulence-factor findings for some organisms. Its principal user workflow supplies protein and/or assembled nucleotide sequences to the finder, which uses a reference database and produces tabular findings. The repository also contains database maintenance, mutation analysis, sequence/GFF utilities, and shared analysis infrastructure. The excerpts establish module references but do not expose every runtime call, so uncertain links are omitted.

Main entry points: [`common.cpp`](https://github.com/ncbi/amr/blob/master/common.cpp) (Shared runtime), [`amrfinder.cpp`](https://github.com/ncbi/amr/blob/master/amrfinder.cpp) (AMR finder), [`amr_report.cpp`](https://github.com/ncbi/amr/blob/master/amr_report.cpp) (AMR reporting), [`seq.cpp`](https://github.com/ncbi/amr/blob/master/seq.cpp) (Sequence and translation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["AMR analysis"]
  node_finder["AMR finder<br/>[amrfinder.cpp]"]
  node_report["AMR reporting<br/>[amr_report.cpp]"]
  node_mutation["DNA mutation analysis<br/>[dna_mutation.cpp]"]
end

subgraph group_reference["Reference data"]
  node_dbindex["Database indexing"]
  node_dbupdate["Database updates"]
  node_http["HTTP transfer<br/>[curl_easy.cpp]"]
end

subgraph group_sequence["Sequence utilities"]
  node_fasta_check["FASTA validation<br/>[fasta_check.cpp]"]
  node_fasta_extract["FASTA extraction<br/>[fasta_extract.cpp]"]
  node_fasta_parts["FASTA partitioning<br/>[fasta2parts.cpp]"]
  node_gff_check["GFF validation<br/>[gff_check.cpp]"]
  node_disruption["Disruption mapping"]
end

subgraph group_core["Analysis infrastructure"]
  node_sequence_model["Sequence and translation<br/>[seq.cpp]"]
  node_alignment["Alignment engine<br/>[alignment.cpp]"]
  node_gff["GFF annotations<br/>[gff.cpp]"]
  node_graph["Graph algorithms<br/>[graph.cpp]"]
  node_tsv["TSV handling<br/>[tsv.cpp]"]
  node_common["Shared runtime<br/>[common.cpp]"]
end

node_user(("Sequence user"))
node_results["Tabular results"]
node_database[("AMR reference database")]

node_user -->|"submits sequences"| node_finder
node_finder -->|"reports findings"| node_results
node_finder -->|"uses reference data"| node_database
node_finder -->|"uses runtime"| node_common
node_finder -->|"uses tables"| node_tsv
node_finder -->|"uses annotations"| node_gff
node_finder -->|"uses sequences"| node_sequence_model
node_report -->|"uses runtime"| node_common
node_report -->|"formats tables"| node_tsv
node_report -->|"uses sequences"| node_sequence_model
node_report -->|"uses annotations"| node_gff
node_report -->|"uses alignments"| node_alignment
node_report -.->|"emits results"| node_results
node_mutation -->|"uses runtime"| node_common
node_mutation -->|"formats tables"| node_tsv
node_mutation -->|"uses alignments"| node_alignment
node_dbindex -->|"uses runtime"| node_common
node_dbupdate -->|"uses runtime"| node_common
node_dbupdate -->|"downloads data"| node_http
node_http -->|"uses runtime"| node_common
node_fasta_check -->|"uses runtime"| node_common
node_fasta_extract -->|"uses runtime"| node_common
node_fasta_parts -->|"uses runtime"| node_common
node_gff_check -->|"uses runtime"| node_common
node_gff_check -->|"uses annotations"| node_gff
node_disruption -->|"uses runtime"| node_common
node_disruption -->|"uses sequences"| node_sequence_model
node_sequence_model -->|"uses runtime"| node_common
node_alignment -->|"uses runtime"| node_common
node_alignment -->|"uses sequence types"| node_sequence_model
node_gff -->|"uses runtime"| node_common
node_graph -->|"uses runtime"| node_common
node_tsv -->|"uses runtime"| node_common

click node_finder "https://github.com/ncbi/amr/blob/master/amrfinder.cpp"
click node_report "https://github.com/ncbi/amr/blob/master/amr_report.cpp"
click node_mutation "https://github.com/ncbi/amr/blob/master/dna_mutation.cpp"
click node_dbindex "https://github.com/ncbi/amr/blob/master/amrfinder_index.cpp"
click node_dbupdate "https://github.com/ncbi/amr/blob/master/amrfinder_update.cpp"
click node_http "https://github.com/ncbi/amr/blob/master/curl_easy.cpp"
click node_fasta_check "https://github.com/ncbi/amr/blob/master/fasta_check.cpp"
click node_fasta_extract "https://github.com/ncbi/amr/blob/master/fasta_extract.cpp"
click node_fasta_parts "https://github.com/ncbi/amr/blob/master/fasta2parts.cpp"
click node_gff_check "https://github.com/ncbi/amr/blob/master/gff_check.cpp"
click node_disruption "https://github.com/ncbi/amr/blob/master/disruption2genesymbol.cpp"
click node_sequence_model "https://github.com/ncbi/amr/blob/master/seq.cpp"
click node_alignment "https://github.com/ncbi/amr/blob/master/alignment.cpp"
click node_gff "https://github.com/ncbi/amr/blob/master/gff.cpp"
click node_graph "https://github.com/ncbi/amr/blob/master/graph.cpp"
click node_tsv "https://github.com/ncbi/amr/blob/master/tsv.cpp"
click node_common "https://github.com/ncbi/amr/blob/master/common.cpp"

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_finder,node_report,node_mutation,node_user toneBlue
class node_dbindex,node_dbupdate,node_http,node_database toneAmber
class node_fasta_check,node_fasta_extract,node_fasta_parts,node_gff_check,node_disruption toneMint
class node_sequence_model,node_alignment,node_gff,node_graph,node_tsv,node_common toneRose
class node_results toneIndigo
```

## Components

### AMR analysis

- [AMR finder](https://github.com/ncbi/amr/blob/master/amrfinder.cpp): `amrfinder.cpp`
- [AMR reporting](https://github.com/ncbi/amr/blob/master/amr_report.cpp): `amr_report.cpp`
- [DNA mutation analysis](https://github.com/ncbi/amr/blob/master/dna_mutation.cpp): `dna_mutation.cpp`

### Reference data

- [Database indexing](https://github.com/ncbi/amr/blob/master/amrfinder_index.cpp): `amrfinder_index.cpp`
- [Database updates](https://github.com/ncbi/amr/blob/master/amrfinder_update.cpp): `amrfinder_update.cpp`
- [HTTP transfer](https://github.com/ncbi/amr/blob/master/curl_easy.cpp): `curl_easy.cpp`

### Sequence utilities

- [FASTA validation](https://github.com/ncbi/amr/blob/master/fasta_check.cpp): `fasta_check.cpp`
- [FASTA extraction](https://github.com/ncbi/amr/blob/master/fasta_extract.cpp): `fasta_extract.cpp`
- [FASTA partitioning](https://github.com/ncbi/amr/blob/master/fasta2parts.cpp): `fasta2parts.cpp`
- [GFF validation](https://github.com/ncbi/amr/blob/master/gff_check.cpp): `gff_check.cpp`
- [Disruption mapping](https://github.com/ncbi/amr/blob/master/disruption2genesymbol.cpp): `disruption2genesymbol.cpp`

### Analysis infrastructure

- [Sequence and translation](https://github.com/ncbi/amr/blob/master/seq.cpp): `seq.cpp`
- [Alignment engine](https://github.com/ncbi/amr/blob/master/alignment.cpp): `alignment.cpp`
- [GFF annotations](https://github.com/ncbi/amr/blob/master/gff.cpp): `gff.cpp`
- [Graph algorithms](https://github.com/ncbi/amr/blob/master/graph.cpp): `graph.cpp`
- [TSV handling](https://github.com/ncbi/amr/blob/master/tsv.cpp): `tsv.cpp`
- [Shared runtime](https://github.com/ncbi/amr/blob/master/common.cpp): `common.cpp`

### Other components

- **Sequence user**
- **Tabular results**
- **AMR reference database**

## Connections

- Sequence user → AMR finder: submits sequences (evidence: `README.md`)
- AMR finder → Tabular results: reports findings (evidence: `README.md`)
- AMR finder → AMR reference database: uses reference data (evidence: `amrfinder.cpp`)
- AMR finder → Shared runtime: uses runtime (evidence: `amrfinder.cpp`)
- AMR finder → TSV handling: uses tables (evidence: `amrfinder.cpp`)
- AMR finder → GFF annotations: uses annotations (evidence: `amrfinder.cpp`)
- AMR finder → Sequence and translation: uses sequences (evidence: `amrfinder.cpp`)
- AMR reporting → Shared runtime: uses runtime (evidence: `amr_report.cpp`)
- AMR reporting → TSV handling: formats tables (evidence: `amr_report.cpp`)
- AMR reporting → Sequence and translation: uses sequences (evidence: `amr_report.cpp`)
- AMR reporting → GFF annotations: uses annotations (evidence: `amr_report.cpp`)
- AMR reporting → Alignment engine: uses alignments (evidence: `amr_report.cpp`)
- AMR reporting → Tabular results: emits results
- DNA mutation analysis → Shared runtime: uses runtime (evidence: `dna_mutation.cpp`)
- DNA mutation analysis → TSV handling: formats tables (evidence: `dna_mutation.cpp`)
- DNA mutation analysis → Alignment engine: uses alignments (evidence: `dna_mutation.cpp`)
- Database indexing → Shared runtime: uses runtime (evidence: `amrfinder_index.cpp`)
- Database updates → Shared runtime: uses runtime (evidence: `amrfinder_update.cpp`)
- Database updates → HTTP transfer: downloads data (evidence: `amrfinder_update.cpp`)
- HTTP transfer → Shared runtime: uses runtime (evidence: `curl_easy.cpp`)
- FASTA validation → Shared runtime: uses runtime (evidence: `fasta_check.cpp`)
- FASTA extraction → Shared runtime: uses runtime (evidence: `fasta_extract.cpp`)
- FASTA partitioning → Shared runtime: uses runtime (evidence: `fasta2parts.cpp`)
- GFF validation → Shared runtime: uses runtime (evidence: `gff_check.cpp`)
- GFF validation → GFF annotations: uses annotations (evidence: `gff_check.cpp`)
- Disruption mapping → Shared runtime: uses runtime (evidence: `disruption2genesymbol.cpp`)
- Disruption mapping → Sequence and translation: uses sequences (evidence: `disruption2genesymbol.cpp`)
- Sequence and translation → Shared runtime: uses runtime (evidence: `seq.cpp`)
- Alignment engine → Shared runtime: uses runtime (evidence: `alignment.cpp`)
- Alignment engine → Sequence and translation: uses sequence types
- GFF annotations → Shared runtime: uses runtime (evidence: `gff.cpp`)
- Graph algorithms → Shared runtime: uses runtime (evidence: `graph.cpp`)
- TSV handling → Shared runtime: uses runtime (evidence: `tsv.cpp`)
