# kojix2/meru architecture

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

- Interactive diagram: https://gitdiagram.com/kojix2/meru
- Repository: https://github.com/kojix2/meru

## Overview

meru is a small Crystal CLI for exploratory k-mer profiling. The documented workflow accepts FASTQ or FASTA input, counts k-mers, and produces a depth histogram, pair/smudge analysis, signals, and summary files. The graph preserves those documented stages and the corresponding source modules, plus configuration and sequence/DNA support. The README documents capabilities and outputs but no source excerpts were provided, so internal call ownership and the precise module-to-module flow cannot be verified; those relationships are shown only as unverified dashed edges.

Main entry points: [`src/meru/cli.cr`](https://github.com/kojix2/meru/blob/main/src/meru/cli.cr) (CLI), [`src/meru/counter.cr`](https://github.com/kojix2/meru/blob/main/src/meru/counter.cr) (K-mer Counter), [`src/meru/sequence.cr`](https://github.com/kojix2/meru/blob/main/src/meru/sequence.cr) (Sequence Input), [`src/meru/histogram.cr`](https://github.com/kojix2/meru/blob/main/src/meru/histogram.cr) (Depth Histogram)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and Configuration"]
  node_cli["CLI<br/>[cli.cr]"]
  node_config["Configuration<br/>[config.cr]"]
  node_meru["Meru Runtime<br/>[meru.cr]"]
end

subgraph group_counting["Input and Counting"]
  node_sequence["Sequence Input<br/>[sequence.cr]"]
  node_dna["DNA Handling<br/>[dna.cr]"]
  node_counter["K-mer Counter<br/>[counter.cr]"]
end

subgraph group_analysis["K-mer Analysis"]
  node_kmer["K-mer Operations<br/>[kmer.cr]"]
  node_histogram["Depth Histogram<br/>[histogram.cr]"]
  node_pairs["Pair Extraction<br/>[pairs.cr]"]
  node_smudge["Smudge Analysis<br/>[smudge.cr]"]
  node_signals["Signals<br/>[signals.cr]"]
end

subgraph group_outputs["Reports and Plots"]
  node_plot["Terminal Plot<br/>[plot.cr]"]
  node_summary["Summary Output<br/>[summary.cr]"]
  node_output_files["Profile Files"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_cli -.->|"accepts reads"| node_sequence
node_sequence -.->|"feeds sequences"| node_counter
node_counter -.->|"profiles counts"| node_histogram
node_counter -.->|"extracts pairs"| node_pairs
node_pairs -.->|"supports analysis"| node_smudge
node_cli -.->|"produces signals"| node_signals
node_histogram -.->|"renders histogram"| node_plot
node_cli -.->|"writes summary"| node_summary
node_histogram -.->|"writes histogram"| node_output_files
node_smudge -.->|"writes smudge data"| node_output_files
node_signals -.->|"writes signals"| node_output_files
node_summary -.->|"writes summary"| node_output_files
node_cli -.->|"uses options"| node_config
node_meru -.->|"exposes CLI"| node_cli
node_sequence -.->|"uses DNA handling"| node_dna
node_counter -.->|"uses k-mer operations"| node_kmer

click node_cli "https://github.com/kojix2/meru/blob/main/src/meru/cli.cr"
click node_config "https://github.com/kojix2/meru/blob/main/src/meru/config.cr"
click node_meru "https://github.com/kojix2/meru/blob/main/src/meru.cr"
click node_sequence "https://github.com/kojix2/meru/blob/main/src/meru/sequence.cr"
click node_dna "https://github.com/kojix2/meru/blob/main/src/meru/dna.cr"
click node_counter "https://github.com/kojix2/meru/blob/main/src/meru/counter.cr"
click node_kmer "https://github.com/kojix2/meru/blob/main/src/meru/kmer.cr"
click node_histogram "https://github.com/kojix2/meru/blob/main/src/meru/histogram.cr"
click node_pairs "https://github.com/kojix2/meru/blob/main/src/meru/pairs.cr"
click node_smudge "https://github.com/kojix2/meru/blob/main/src/meru/smudge.cr"
click node_signals "https://github.com/kojix2/meru/blob/main/src/meru/signals.cr"
click node_plot "https://github.com/kojix2/meru/blob/main/src/meru/plot.cr"
click node_summary "https://github.com/kojix2/meru/blob/main/src/meru/summary.cr"

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_cli,node_config,node_meru,node_user toneBlue
class node_sequence,node_dna,node_counter toneAmber
class node_kmer,node_histogram,node_pairs,node_smudge,node_signals toneMint
class node_plot,node_summary,node_output_files toneRose
```

## Components

### CLI and Configuration

- [CLI](https://github.com/kojix2/meru/blob/main/src/meru/cli.cr): `src/meru/cli.cr`
- [Configuration](https://github.com/kojix2/meru/blob/main/src/meru/config.cr): `src/meru/config.cr`
- [Meru Runtime](https://github.com/kojix2/meru/blob/main/src/meru.cr): `src/meru.cr`

### Input and Counting

- [Sequence Input](https://github.com/kojix2/meru/blob/main/src/meru/sequence.cr): `src/meru/sequence.cr`
- [DNA Handling](https://github.com/kojix2/meru/blob/main/src/meru/dna.cr): `src/meru/dna.cr`
- [K-mer Counter](https://github.com/kojix2/meru/blob/main/src/meru/counter.cr): `src/meru/counter.cr`

### K-mer Analysis

- [K-mer Operations](https://github.com/kojix2/meru/blob/main/src/meru/kmer.cr): `src/meru/kmer.cr`
- [Depth Histogram](https://github.com/kojix2/meru/blob/main/src/meru/histogram.cr): `src/meru/histogram.cr`
- [Pair Extraction](https://github.com/kojix2/meru/blob/main/src/meru/pairs.cr): `src/meru/pairs.cr`
- [Smudge Analysis](https://github.com/kojix2/meru/blob/main/src/meru/smudge.cr): `src/meru/smudge.cr`
- [Signals](https://github.com/kojix2/meru/blob/main/src/meru/signals.cr): `src/meru/signals.cr`

### Reports and Plots

- [Terminal Plot](https://github.com/kojix2/meru/blob/main/src/meru/plot.cr): `src/meru/plot.cr`
- [Summary Output](https://github.com/kojix2/meru/blob/main/src/meru/summary.cr): `src/meru/summary.cr`
- **Profile Files**

### Other components

- **User**

## Connections

- User → CLI: runs (evidence: `README.md`)
- CLI → Sequence Input: accepts reads
- Sequence Input → K-mer Counter: feeds sequences
- K-mer Counter → Depth Histogram: profiles counts
- K-mer Counter → Pair Extraction: extracts pairs
- Pair Extraction → Smudge Analysis: supports analysis
- CLI → Signals: produces signals
- Depth Histogram → Terminal Plot: renders histogram
- CLI → Summary Output: writes summary
- Depth Histogram → Profile Files: writes histogram
- Smudge Analysis → Profile Files: writes smudge data
- Signals → Profile Files: writes signals
- Summary Output → Profile Files: writes summary
- CLI → Configuration: uses options
- Meru Runtime → CLI: exposes CLI
- Sequence Input → DNA Handling: uses DNA handling
- K-mer Counter → K-mer Operations: uses k-mer operations
