# bigest-icube/clustalw architecture

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

## Overview

ClustalW is a command-line and graphical application for multiple sequence alignment. Its principal workflow reads sequence data, performs pairwise comparisons and guide-tree construction, progressively aligns sequences or profiles, and writes an alignment. Sequence weighting, adaptive substitution matrices, and position-specific gap penalties support alignment; the repository also includes tree analysis, motif handling, and secondary-structure prediction. The excerpts establish several calls, but do not expose the full application entry points or all subsystem wiring, so uncertain relationships are omitted or marked unverified.

Main entry points: [`src/malign.c`](https://github.com/bigest-icube/clustalw/blob/main/src/malign.c) (Progressive alignment), [`src/trees.c`](https://github.com/bigest-icube/clustalw/blob/main/src/trees.c) (Guide-tree construction), [`src/xmenu.c`](https://github.com/bigest-icube/clustalw/blob/main/src/xmenu.c) (Graphical interface), [`src/matrices.h`](https://github.com/bigest-icube/clustalw/blob/main/src/matrices.h) (Substitution matrices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input_alignment["Input and alignment"]
  node_sequence_reader["Sequence reader<br/>[readseq.c]"]
  node_alignment_model["Alignment data model<br/>[clustalw.h]"]
  node_pairwise["Pairwise alignment<br/>[pairalign.c]"]
  node_progressive["Progressive alignment<br/>[malign.c]"]
  node_profile_alignment["Profile alignment<br/>[prfalign.c]"]
  node_motifs["Motif support<br/>[motifs.c]"]
end

subgraph group_scoring_tree["Scoring and trees"]
  node_sequence_weights["Sequence weighting<br/>[seqweight.c]"]
  node_gap_scoring["Adaptive gap penalties<br/>[calcgapcoeff.c]"]
  node_substitution_matrices["Substitution matrices<br/>[matrices.h]"]
  node_matrix_reader["Matrix reader<br/>[readmat.c]"]
  node_guide_tree["Guide-tree construction<br/>[trees.c]"]
  node_tree_reader["Tree reader<br/>[readtree.c]"]
  node_bionj["BioNJ trees<br/>[bionj.c]"]
end

subgraph group_interfaces_output["Interfaces and output"]
  node_cli["Command interface<br/>[interface.c]"]
  node_menus["Text menus<br/>[amenu.c]"]
  node_gui["Graphical interface<br/>[xmenu.c]"]
  node_display["Alignment display<br/>[xdisplay.c]"]
  node_alignment_writer["Alignment writer<br/>[writeseq.c]"]
end

subgraph group_prediction_tools["Prediction tools"]
  node_dsc_prediction["DSC prediction<br/>[dsc.c]"]
  node_jnet_prediction["Jnet prediction<br/>[jnet.c]"]
  node_neural_networks["Jnet networks<br/>[net1.c]"]
end

node_user(("User"))

node_user -.->|"runs alignment"| node_cli
node_user -.->|"uses menus"| node_menus
node_user -.->|"uses GUI"| node_gui
node_cli -.->|"reads sequences"| node_sequence_reader
node_menus -->|"starts alignment"| node_progressive
node_sequence_reader -.->|"populates data"| node_alignment_model
node_progressive -->|"builds guide tree"| node_guide_tree
node_progressive -.->|"uses comparisons"| node_pairwise
node_progressive -.->|"aligns profiles"| node_profile_alignment
node_progressive -.->|"uses weights"| node_sequence_weights
node_progressive -.->|"uses gap scores"| node_gap_scoring
node_progressive -->|"uses motifs"| node_motifs
node_pairwise -.->|"scores residues"| node_substitution_matrices
node_matrix_reader -.->|"loads matrices"| node_substitution_matrices
node_guide_tree -->|"loads user matrix"| node_substitution_matrices
node_guide_tree -.->|"uses input tree"| node_tree_reader
node_guide_tree -.->|"offers BioNJ"| node_bionj
node_progressive -.->|"writes alignment"| node_alignment_writer
node_gui -.->|"shows alignment"| node_display
node_gui -->|"saves alignment"| node_alignment_writer
node_dsc_prediction -.->|"uses sequence data"| node_alignment_model
node_jnet_prediction -->|"uses networks"| node_neural_networks

click node_cli "https://github.com/bigest-icube/clustalw/blob/main/src/interface.c"
click node_menus "https://github.com/bigest-icube/clustalw/blob/main/src/amenu.c"
click node_gui "https://github.com/bigest-icube/clustalw/blob/main/src/xmenu.c"
click node_display "https://github.com/bigest-icube/clustalw/blob/main/src/xdisplay.c"
click node_sequence_reader "https://github.com/bigest-icube/clustalw/blob/main/src/readseq.c"
click node_alignment_model "https://github.com/bigest-icube/clustalw/blob/main/src/clustalw.h"
click node_pairwise "https://github.com/bigest-icube/clustalw/blob/main/src/pairalign.c"
click node_progressive "https://github.com/bigest-icube/clustalw/blob/main/src/malign.c"
click node_profile_alignment "https://github.com/bigest-icube/clustalw/blob/main/src/prfalign.c"
click node_sequence_weights "https://github.com/bigest-icube/clustalw/blob/main/src/seqweight.c"
click node_gap_scoring "https://github.com/bigest-icube/clustalw/blob/main/src/calcgapcoeff.c"
click node_substitution_matrices "https://github.com/bigest-icube/clustalw/blob/main/src/matrices.h"
click node_matrix_reader "https://github.com/bigest-icube/clustalw/blob/main/src/readmat.c"
click node_guide_tree "https://github.com/bigest-icube/clustalw/blob/main/src/trees.c"
click node_tree_reader "https://github.com/bigest-icube/clustalw/blob/main/src/readtree.c"
click node_bionj "https://github.com/bigest-icube/clustalw/blob/main/src/bionj.c"
click node_motifs "https://github.com/bigest-icube/clustalw/blob/main/src/motifs.c"
click node_alignment_writer "https://github.com/bigest-icube/clustalw/blob/main/src/writeseq.c"
click node_dsc_prediction "https://github.com/bigest-icube/clustalw/blob/main/src/dsc.c"
click node_jnet_prediction "https://github.com/bigest-icube/clustalw/blob/main/src/jnet.c"
click node_neural_networks "https://github.com/bigest-icube/clustalw/blob/main/src/net1.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_sequence_reader,node_alignment_model,node_pairwise,node_progressive,node_profile_alignment,node_motifs,node_user toneBlue
class node_sequence_weights,node_gap_scoring,node_substitution_matrices,node_matrix_reader,node_guide_tree,node_tree_reader,node_bionj toneAmber
class node_cli,node_menus,node_gui,node_display,node_alignment_writer toneMint
class node_dsc_prediction,node_jnet_prediction,node_neural_networks toneRose
```

## Components

### Input and alignment

- [Sequence reader](https://github.com/bigest-icube/clustalw/blob/main/src/readseq.c): `src/readseq.c`
- [Alignment data model](https://github.com/bigest-icube/clustalw/blob/main/src/clustalw.h): `src/clustalw.h`
- [Pairwise alignment](https://github.com/bigest-icube/clustalw/blob/main/src/pairalign.c): `src/pairalign.c`
- [Progressive alignment](https://github.com/bigest-icube/clustalw/blob/main/src/malign.c): `src/malign.c`
- [Profile alignment](https://github.com/bigest-icube/clustalw/blob/main/src/prfalign.c): `src/prfalign.c`
- [Motif support](https://github.com/bigest-icube/clustalw/blob/main/src/motifs.c): `src/motifs.c`

### Scoring and trees

- [Sequence weighting](https://github.com/bigest-icube/clustalw/blob/main/src/seqweight.c): `src/seqweight.c`
- [Adaptive gap penalties](https://github.com/bigest-icube/clustalw/blob/main/src/calcgapcoeff.c): `src/calcgapcoeff.c`
- [Substitution matrices](https://github.com/bigest-icube/clustalw/blob/main/src/matrices.h): `src/matrices.h`
- [Matrix reader](https://github.com/bigest-icube/clustalw/blob/main/src/readmat.c): `src/readmat.c`
- [Guide-tree construction](https://github.com/bigest-icube/clustalw/blob/main/src/trees.c): `src/trees.c`
- [Tree reader](https://github.com/bigest-icube/clustalw/blob/main/src/readtree.c): `src/readtree.c`
- [BioNJ trees](https://github.com/bigest-icube/clustalw/blob/main/src/bionj.c): `src/bionj.c`

### Interfaces and output

- [Command interface](https://github.com/bigest-icube/clustalw/blob/main/src/interface.c): `src/interface.c`
- [Text menus](https://github.com/bigest-icube/clustalw/blob/main/src/amenu.c): `src/amenu.c`
- [Graphical interface](https://github.com/bigest-icube/clustalw/blob/main/src/xmenu.c): `src/xmenu.c`
- [Alignment display](https://github.com/bigest-icube/clustalw/blob/main/src/xdisplay.c): `src/xdisplay.c`
- [Alignment writer](https://github.com/bigest-icube/clustalw/blob/main/src/writeseq.c): `src/writeseq.c`

### Prediction tools

- [DSC prediction](https://github.com/bigest-icube/clustalw/blob/main/src/dsc.c): `src/dsc.c`
- [Jnet prediction](https://github.com/bigest-icube/clustalw/blob/main/src/jnet.c): `src/jnet.c`
- [Jnet networks](https://github.com/bigest-icube/clustalw/blob/main/src/net1.c): `src/net1.c`

### Other components

- **User**

## Connections

- User → Command interface: runs alignment
- User → Text menus: uses menus
- User → Graphical interface: uses GUI
- Command interface → Sequence reader: reads sequences
- Text menus → Progressive alignment: starts alignment (evidence: `src/amenu.c`)
- Sequence reader → Alignment data model: populates data (evidence: `src/readseq.c`)
- Progressive alignment → Guide-tree construction: builds guide tree (evidence: `src/malign.c`)
- Progressive alignment → Pairwise alignment: uses comparisons
- Progressive alignment → Profile alignment: aligns profiles
- Progressive alignment → Sequence weighting: uses weights
- Progressive alignment → Adaptive gap penalties: uses gap scores
- Progressive alignment → Motif support: uses motifs (evidence: `src/malign.c`)
- Pairwise alignment → Substitution matrices: scores residues
- Matrix reader → Substitution matrices: loads matrices (evidence: `src/readmat.c`)
- Guide-tree construction → Substitution matrices: loads user matrix (evidence: `src/trees.c`)
- Guide-tree construction → Tree reader: uses input tree
- Guide-tree construction → BioNJ trees: offers BioNJ
- Progressive alignment → Alignment writer: writes alignment
- Graphical interface → Alignment display: shows alignment
- Graphical interface → Alignment writer: saves alignment (evidence: `src/xmenu.c`)
- DSC prediction → Alignment data model: uses sequence data (evidence: `src/dsc.c`)
- Jnet prediction → Jnet networks: uses networks (evidence: `src/jnet.c`)
