# nhm-sequencing-facility/map architecture

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

- Interactive diagram: https://gitdiagram.com/nhm-sequencing-facility/map
- Repository: https://github.com/nhm-sequencing-facility/map

## Overview

MAP is a containerized metabarcoding analysis pipeline. The user supplies read files and a parameter spreadsheet, then invokes `MAP.sh`; the documented workflow demultiplexes and trims reads, clusters OTUs, corrects and filters sequences, assigns taxonomy and BINs, and produces tables and reports. The graph preserves those documented stages and the reference-library capability. Most stage implementations are not sampled, so their paths and ordering follow the README and tree; the internal sequence-correction implementation is evidenced by its excerpt.

Main entry points: [`Docker`](https://github.com/nhm-sequencing-facility/map/tree/main/Docker) (Taxonomy assignment), [`Docker/6-MAP_binmatch.R`](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/6-MAP_binmatch.R) (BOLD BIN matching), [`Docker/MAP.sh`](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/MAP.sh) (MAP runner), [`Docker/2-MAP_runwideotuformat.R`](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/2-MAP_runwideotuformat.R) (Run-wide OTUs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run control"]
  node_runner["MAP runner<br/>[MAP.sh]"]
  node_inputs["Reads and parameters<br/>[parameters.xlsx]"]
end

subgraph group_sequence["Sequence processing"]
  node_demux["Demultiplex and trim"]
  node_samplecluster["Per-sample OTUs"]
  node_runwide["Run-wide OTUs"]
  node_correction["Sequence correction"]
end

subgraph group_classification["Classification and filtering"]
  node_chimera["Chimera screening"]
  node_taxonomy["Taxonomy assignment"]
  node_contaminants["Contaminant removal"]
  node_binmatch["BOLD BIN matching<br/>[6-MAP_binmatch.R]"]
  node_references[("Reference library")]
end

subgraph group_results["Reporting"]
  node_results["Final results"]
  node_report["Interactive report"]
end

node_user(("Pipeline user"))
node_internet(("Internet access"))

node_user -->|"invokes"| node_runner
node_user -->|"provides"| node_inputs
node_runner -->|"runs"| node_demux
node_demux -->|"produces reads"| node_samplecluster
node_samplecluster -->|"clusters OTUs"| node_runwide
node_runwide -->|"corrects sequences"| node_correction
node_correction -->|"screens"| node_chimera
node_chimera -->|"assigns taxonomy"| node_taxonomy
node_taxonomy -->|"filters OTUs"| node_contaminants
node_contaminants -->|"matches BINs"| node_binmatch
node_taxonomy -->|"uses library"| node_references
node_binmatch -->|"matches against"| node_references
node_internet -->|"downloads library"| node_references
node_binmatch -->|"writes tables"| node_results
node_results -->|"renders report"| node_report

click node_runner "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/MAP.sh"
click node_inputs "https://github.com/nhm-sequencing-facility/map/blob/main/workdir/data/parameters.xlsx"
click node_demux "https://github.com/nhm-sequencing-facility/map/tree/main/Docker"
click node_samplecluster "https://github.com/nhm-sequencing-facility/map/tree/main/Docker"
click node_runwide "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/2-MAP_runwideotuformat.R"
click node_correction "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/3-MAP_sequence_correction.py"
click node_chimera "https://github.com/nhm-sequencing-facility/map/tree/main/Docker"
click node_taxonomy "https://github.com/nhm-sequencing-facility/map/tree/main/Docker"
click node_contaminants "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/4-RemoveContaminants.R"
click node_binmatch "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/6-MAP_binmatch.R"
click node_references "https://github.com/nhm-sequencing-facility/map/tree/main/Docker"
click node_results "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/5-MAP_final_results.R"
click node_report "https://github.com/nhm-sequencing-facility/map/blob/main/Docker/7a-MAP_reporting.qmd"

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_runner,node_inputs,node_user toneBlue
class node_demux,node_samplecluster,node_runwide,node_correction toneAmber
class node_chimera,node_taxonomy,node_contaminants,node_binmatch,node_references toneMint
class node_results,node_report toneRose
class node_internet toneIndigo
```

## Components

### Run control

- [MAP runner](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/MAP.sh): `Docker/MAP.sh`
- [Reads and parameters](https://github.com/nhm-sequencing-facility/map/blob/main/workdir/data/parameters.xlsx): `workdir/data/parameters.xlsx`

### Sequence processing

- [Demultiplex and trim](https://github.com/nhm-sequencing-facility/map/tree/main/Docker): `Docker`
- [Per-sample OTUs](https://github.com/nhm-sequencing-facility/map/tree/main/Docker): `Docker`
- [Run-wide OTUs](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/2-MAP_runwideotuformat.R): `Docker/2-MAP_runwideotuformat.R`
- [Sequence correction](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/3-MAP_sequence_correction.py): `Docker/3-MAP_sequence_correction.py`

### Classification and filtering

- [Chimera screening](https://github.com/nhm-sequencing-facility/map/tree/main/Docker): `Docker`
- [Taxonomy assignment](https://github.com/nhm-sequencing-facility/map/tree/main/Docker): `Docker`
- [Contaminant removal](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/4-RemoveContaminants.R): `Docker/4-RemoveContaminants.R`
- [BOLD BIN matching](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/6-MAP_binmatch.R): `Docker/6-MAP_binmatch.R`
- [Reference library](https://github.com/nhm-sequencing-facility/map/tree/main/Docker): `Docker`

### Reporting

- [Final results](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/5-MAP_final_results.R): `Docker/5-MAP_final_results.R`
- [Interactive report](https://github.com/nhm-sequencing-facility/map/blob/main/Docker/7a-MAP_reporting.qmd): `Docker/7a-MAP_reporting.qmd`

### Other components

- **Pipeline user**
- **Internet access**

## Connections

- Pipeline user → MAP runner: invokes (evidence: `README.md`)
- Pipeline user → Reads and parameters: provides (evidence: `README.md`)
- MAP runner → Demultiplex and trim: runs (evidence: `README.md`)
- Demultiplex and trim → Per-sample OTUs: produces reads (evidence: `README.md`)
- Per-sample OTUs → Run-wide OTUs: clusters OTUs (evidence: `README.md`)
- Run-wide OTUs → Sequence correction: corrects sequences (evidence: `README.md`)
- Sequence correction → Chimera screening: screens (evidence: `README.md`)
- Chimera screening → Taxonomy assignment: assigns taxonomy (evidence: `README.md`)
- Taxonomy assignment → Contaminant removal: filters OTUs (evidence: `README.md`)
- Contaminant removal → BOLD BIN matching: matches BINs (evidence: `README.md`)
- Taxonomy assignment → Reference library: uses library (evidence: `README.md`)
- BOLD BIN matching → Reference library: matches against (evidence: `README.md`)
- Internet access → Reference library: downloads library (evidence: `README.md`)
- BOLD BIN matching → Final results: writes tables (evidence: `README.md`)
- Final results → Interactive report: renders report (evidence: `README.md`)
