# bigest-icube/normd architecture

> Architecture diagram of the GitHub repository bigest-icube/normd, 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/bigest-icube/normd
- Repository: https://github.com/bigest-icube/normd

## Overview

NorMD is a command-line tool for scoring multiple-sequence alignment quality. Its main workflow reads an alignment, optionally reduces computation by grouping similar sequences, calculates alignment and gap statistics, and prints a normalized score. The source tree also contains alignment-format readers/writers and phylogenetic-tree utilities; these are represented as adjacent capabilities, not assumed steps in scoring. Edges are limited to relationships visible in the excerpts or documented in the README; unsampled implementation details are not inferred.

Main entry points: [`src/normd.c`](https://github.com/bigest-icube/normd/blob/main/src/normd.c) (NorMD scorer), [`src/readseq.c`](https://github.com/bigest-icube/normd/blob/main/src/readseq.c) (Sequence reader), [`src/score.h`](https://github.com/bigest-icube/normd/blob/main/src/score.h) (Alignment data model), [`src/normd_aln1.c`](https://github.com/bigest-icube/normd/blob/main/src/normd_aln1.c) (Alignment scorer v1)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scoring["NorMD scoring"]
  node_normd["NorMD scorer<br/>[normd.c]"]
  node_normd_aln["Alignment scorer<br/>[normd_aln.c]"]
  node_normd_aln1["Alignment scorer v1<br/>[normd_aln1.c]"]
  node_normd_range["Range scoring<br/>[normd_range.c]"]
  node_normd_subaln["Subalignment scoring<br/>[normd_subaln.c]"]
  node_normd_sw["Smith-Waterman scoring<br/>[normd_sw.c]"]
  node_pairwise["Pairwise comparison<br/>[showpair.c]"]
  node_weights["Sequence weights<br/>[seqweight.c]"]
end

subgraph group_io["Alignment I/O"]
  node_matrix["Matrix reader<br/>[readmatrix.c]"]
  node_seqreader["Sequence reader<br/>[readseq.c]"]
  node_xmlreader["XML reader<br/>[readxml.c]"]
  node_seqwriter["Sequence writer<br/>[writeseq.c]"]
end

subgraph group_phylo["Tree utilities"]
  node_quicknj["QuickNJ trees<br/>[quicknj.c]"]
  node_quicknj_types["QuickNJ interfaces<br/>[quicknj.h]"]
  node_treecalc["Tree adjustment<br/>[calctree.c]"]
  node_trees["Phylogenetic trees<br/>[trees.c]"]
  node_dayhoff["Dayhoff corrections<br/>[dayhoff.h]"]
end

subgraph group_core["Shared scoring data"]
  node_scoredata["Alignment data model<br/>[score.h]"]
  node_init["Initialization<br/>[init.c]"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_normd
node_normd -->|"reads alignment"| node_seqreader
node_normd -->|"compares pairs"| node_pairwise
node_normd -->|"uses data model"| node_scoredata
node_normd_aln -->|"reads alignment"| node_seqreader
node_normd_aln1 -->|"reads alignment"| node_seqreader
node_normd_aln1 -.->|"writes alignment"| node_seqwriter
node_quicknj -->|"uses interfaces"| node_quicknj_types
node_trees -->|"uses corrections"| node_dayhoff
node_treecalc -->|"uses data model"| node_scoredata
node_init -->|"uses data model"| node_scoredata

click node_normd "https://github.com/bigest-icube/normd/blob/main/src/normd.c"
click node_normd_aln "https://github.com/bigest-icube/normd/blob/main/src/normd_aln.c"
click node_normd_aln1 "https://github.com/bigest-icube/normd/blob/main/src/normd_aln1.c"
click node_normd_range "https://github.com/bigest-icube/normd/blob/main/src/normd_range.c"
click node_normd_subaln "https://github.com/bigest-icube/normd/blob/main/src/normd_subaln.c"
click node_normd_sw "https://github.com/bigest-icube/normd/blob/main/src/normd_sw.c"
click node_pairwise "https://github.com/bigest-icube/normd/blob/main/src/showpair.c"
click node_weights "https://github.com/bigest-icube/normd/blob/main/src/seqweight.c"
click node_matrix "https://github.com/bigest-icube/normd/blob/main/src/readmatrix.c"
click node_seqreader "https://github.com/bigest-icube/normd/blob/main/src/readseq.c"
click node_xmlreader "https://github.com/bigest-icube/normd/blob/main/src/readxml.c"
click node_seqwriter "https://github.com/bigest-icube/normd/blob/main/src/writeseq.c"
click node_quicknj "https://github.com/bigest-icube/normd/blob/main/src/quicknj.c"
click node_quicknj_types "https://github.com/bigest-icube/normd/blob/main/src/quicknj.h"
click node_treecalc "https://github.com/bigest-icube/normd/blob/main/src/calctree.c"
click node_trees "https://github.com/bigest-icube/normd/blob/main/src/trees.c"
click node_dayhoff "https://github.com/bigest-icube/normd/blob/main/src/dayhoff.h"
click node_scoredata "https://github.com/bigest-icube/normd/blob/main/src/score.h"
click node_init "https://github.com/bigest-icube/normd/blob/main/src/init.c"

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_normd,node_normd_aln,node_normd_aln1,node_normd_range,node_normd_subaln,node_normd_sw,node_pairwise,node_weights,node_user toneBlue
class node_matrix,node_seqreader,node_xmlreader,node_seqwriter toneAmber
class node_quicknj,node_quicknj_types,node_treecalc,node_trees,node_dayhoff toneMint
class node_scoredata,node_init toneRose
```

## Components

### NorMD scoring

- [NorMD scorer](https://github.com/bigest-icube/normd/blob/main/src/normd.c): `src/normd.c`
- [Alignment scorer](https://github.com/bigest-icube/normd/blob/main/src/normd_aln.c): `src/normd_aln.c`
- [Alignment scorer v1](https://github.com/bigest-icube/normd/blob/main/src/normd_aln1.c): `src/normd_aln1.c`
- [Range scoring](https://github.com/bigest-icube/normd/blob/main/src/normd_range.c): `src/normd_range.c`
- [Subalignment scoring](https://github.com/bigest-icube/normd/blob/main/src/normd_subaln.c): `src/normd_subaln.c`
- [Smith-Waterman scoring](https://github.com/bigest-icube/normd/blob/main/src/normd_sw.c): `src/normd_sw.c`
- [Pairwise comparison](https://github.com/bigest-icube/normd/blob/main/src/showpair.c): `src/showpair.c`
- [Sequence weights](https://github.com/bigest-icube/normd/blob/main/src/seqweight.c): `src/seqweight.c`

### Alignment I/O

- [Matrix reader](https://github.com/bigest-icube/normd/blob/main/src/readmatrix.c): `src/readmatrix.c`
- [Sequence reader](https://github.com/bigest-icube/normd/blob/main/src/readseq.c): `src/readseq.c`
- [XML reader](https://github.com/bigest-icube/normd/blob/main/src/readxml.c): `src/readxml.c`
- [Sequence writer](https://github.com/bigest-icube/normd/blob/main/src/writeseq.c): `src/writeseq.c`

### Tree utilities

- [QuickNJ trees](https://github.com/bigest-icube/normd/blob/main/src/quicknj.c): `src/quicknj.c`
- [QuickNJ interfaces](https://github.com/bigest-icube/normd/blob/main/src/quicknj.h): `src/quicknj.h`
- [Tree adjustment](https://github.com/bigest-icube/normd/blob/main/src/calctree.c): `src/calctree.c`
- [Phylogenetic trees](https://github.com/bigest-icube/normd/blob/main/src/trees.c): `src/trees.c`
- [Dayhoff corrections](https://github.com/bigest-icube/normd/blob/main/src/dayhoff.h): `src/dayhoff.h`

### Shared scoring data

- [Alignment data model](https://github.com/bigest-icube/normd/blob/main/src/score.h): `src/score.h`
- [Initialization](https://github.com/bigest-icube/normd/blob/main/src/init.c): `src/init.c`

### Other components

- **CLI user**

## Connections

- CLI user → NorMD scorer: runs (evidence: `README.md`)
- NorMD scorer → Sequence reader: reads alignment (evidence: `src/normd.c`)
- NorMD scorer → Pairwise comparison: compares pairs
- NorMD scorer → Alignment data model: uses data model (evidence: `src/normd.c`)
- Alignment scorer → Sequence reader: reads alignment (evidence: `src/normd_aln.c`)
- Alignment scorer v1 → Sequence reader: reads alignment (evidence: `src/normd_aln1.c`)
- Alignment scorer v1 → Sequence writer: writes alignment
- QuickNJ trees → QuickNJ interfaces: uses interfaces (evidence: `src/quicknj.c`)
- Phylogenetic trees → Dayhoff corrections: uses corrections (evidence: `src/trees.c`)
- Tree adjustment → Alignment data model: uses data model (evidence: `src/calctree.c`)
- Initialization → Alignment data model: uses data model (evidence: `src/init.c`)
