Layered Design
Architecture Position
gside sits between standard bioinformatics tools and your workflows:
┌─────────────────────────────────────────────────────────┐
│ │
│ gside (this tool) │
│ Species ID engine: marker rules + ANI backends + │
│ arbitration, exposed as one CLI with JSON output │
│ │
├─────────────────────────────────────────────────────────┤
│ │
│ Bioinformatics tools │
│ blastn · skani · mash · sourmash │
│ │
└─────────────────────────────────────────────────────────┘
Internal Structure
gside/
├── src/gside/
│ ├── cli.py CLI entry point (species / meta / db / validate / mcp)
│ ├── config.py Runtime config (data dirs / binary discovery)
│ ├── db.py Database management (status/setup/list)
│ ├── engine/ Alignment backends used by the analysis layer
│ │ ├── _env.py Binary discovery + checked subprocess execution
│ │ ├── hits.py Unified Hit dataclass (BLAST tabular)
│ │ └── backends/
│ │ ├── blast.py blastn (marker layer)
│ │ ├── skani.py ANI search (panel layer)
│ │ └── kmer.py mash + sourmash backends
│ └── analysis/
│ ├── multigene_identifier.py L1 target gene combination
│ ├── ani_identifier.py L2 ANI (panel/mash_refseq)
│ ├── sourmash_identifier.py L2 sourmash gather
│ ├── gtdbtk_identifier.py L3 GTDB-Tk placement
│ ├── taxonomic_validator.py CheckM2 + GTDB-Tk QC (`gside validate`)
│ ├── _envelope.py Shared result-dict envelope
│ └── _thresholds.py Shared ANI confidence cutoffs
├── data/
│ └── db/ Per-scheme directories (one folder per method)
│ ├── D1_marker/ marker rules + fasta + BLAST db (tracked in git)
│ ├── D2_ani/ skani sketch + genomes (gitignored) + manifests/ (tracked recipe)
│ ├── D3_mash/ mash sketch (gitignored)
│ ├── D4_sourmash/ GTDB reps k=31 + lineages (via db setup)
└── tests/
Request flow
gside scan files...
- Parse
-m(single,a+b, orall) and infer FASTA/FASTQ per input. - Validate mode/context/input — mismatches exit 2 before any tool runs.
- Dispatch each mode: marker → blastn (FASTA) or minimap2 read screening (FASTQ); panel → skani; mash_refseq → mash; sourmash → gather; gtdbtk →
- Collect per-method payloads; a failure becomes
methods.<mode>.error(with structured missing-database fields) and does not stop the others. - Arbitrate for isolate runs (L3 > L2 > L1, then high > medium > low);
- Render JSON / TSV / CSV / MD to stdout or
-o.
gside validate contigs.fna -o dir
- Resolve CheckM2 (
CHECKM2DB) and GTDB-Tk (GTDBTK_DATA_PATH) databases. - Run CheckM2 (completeness/contamination) and GTDB-Tk (classification), recording per-tool status instead of crashing on missing tools.
- Write
dir/validation.jsonwith genome, parameters, software versions, quality verdict, taxonomy, errors and a UTC timestamp; exit 0 only when both tools ran.
Design Principles
| Principle | Implementation |
|---|---|
| Rules as data | 48 species rules in YAML; new species without code changes |
| Backends injected per method | The analysis layer picks blastn / skani / mash / sourmash directly |
| JSON contract | All output in one unified JSON format on stdout |
| Graceful degradation | Missing database/binary returns clear error, never crashes |
| Independent operation | Standalone install and use, no external service required |