Skip to main content

gside

CI Docs PyPI Python

English | 简体中文

gside is a Python library and command-line tool for multi-layer microbial species identification and metagenomic profiling. It wraps established bioinformatics tools behind reproducible, data-driven rules, arbitrates across methods, and returns a single structured result per sample.

The library exposes each identification engine independently. The gside CLI adds database provisioning, layered consensus, batch processing, and an MCP server for agent workflows.

contigs / reads
      │
      ├── marker BLAST ──┐
      ├── ANI (skani) ───┤
      ├── mash ──────────┼── layered arbitration ── species verdict
      ├── sourmash ──────┤
      └── GTDB-Tk ───────┘

Highlights

  • Library first. Import individual engines through gside.api; use the result objects directly in pipelines, notebooks, and tests.
  • Five isolate modes. Marker genes, curated ANI panel, RefSeq mash, sourmash/GTDB, and GTDB-Tk, with L3 > L2 > L1 arbitration. Metagenomic community profiling lives in gmeta (gmeta run, gmeta net build).
  • Assembly QC. CheckM2 completeness/contamination plus GTDB-Tk taxonomy.
  • Machine-friendly. Stable JSON envelopes, structured missing-database errors, --auto-setup, machine-readable database status, and an MCP server.
  • gseek by default. Marker BLAST, read screening, mash, sourmash, and panel/skani run through gseek. GSIDE_ENGINE=legacy|shadow remains available for debugging and parity checks.

Installation

gside requires Python 3.12.

pip install gside

The Python package and the bundled marker database are included. The aligners and reference tools are not Python dependencies; install them with conda, Bioconda, or pixi:

blastn, makeblastdb, minimap2, skani, mash, sourmash,
GTDB-Tk, CheckM2

For a complete development environment:

pixi install
pixi run gside -V

Engine debugging:

GSIDE_ENGINE=legacy gside scan contigs.fna -m marker   # old subprocess path
GSIDE_ENGINE=shadow gside scan contigs.fna -m marker   # run both, return legacy

If tools live outside the active environment, point gside at their directory:

export GSIDE_PIXI_BIN=/path/to/conda/env/bin
gside db status

Python library

The stable import surface is gside.api. Each function returns a typed result object or a list of dictionaries; MethodEnvelope-based results expose to_dict() for JSON serialization.

Marker-gene identification

from gside.api import identify_multigene

result = identify_multigene("contigs.fna", threads=4)
print(result.species, result.confidence)
print(result.to_dict()["detected_markers"])

Custom marker databases

from gside.api import identify_multigene
from gside.marker_db import MarkerDatabase

db = MarkerDatabase.from_path("my-markers")
errors = db.validate()          # [] when valid
result = identify_multigene("contigs.fna", marker_db=db)

Or from the CLI:

gside db validate my-markers
gside scan contigs.fna -m marker --marker-db my-markers

A custom marker database uses the same algorithm as mini; only markers.fasta, marker_rules.yaml, and optional metadata.yaml change. See Custom marker databases.

ANI against the curated panel or RefSeq mash

from gside.api import identify_by_ani

panel = identify_by_ani("contigs.fna", mode="panel", threads=8)
mash = identify_by_ani("contigs.fna", mode="mash_refseq", threads=8)

print(panel.to_dict()["result"]["species"])

mode is "panel" (skani ANI) or "mash_refseq" (mash distance). Pass db_dir= to use a non-default database root.

Sourmash / GTDB-Tk

from gside.api import identify_by_gtdbtk, identify_by_sourmash

sourmash = identify_by_sourmash("contigs.fna").to_dict()
gtdbtk = identify_by_gtdbtk("contigs.fna", threads=8).to_dict()

GTDB-Tk requires a configured GTDBTK_DATA_PATH. Sourmash uses the GTDB gather database from the sourmash tier.

Read screening

from gside.api import screen_reads
from gside.config import SPECIES_DB_DIR

markers = SPECIES_DB_DIR / "D1_marker" / "markers.fasta"
hits = screen_reads(("sample_R1.fq", "sample_R2.fq"), markers, threads=8)

Metagenomic community profiling (kraken2/bracken, sylph) moved to gmeta.

Assembly quality

from gside.api import validate_genome

validation = validate_genome("contigs.fna", "qc/", threads=8)
print(validation.status)

validate_genome writes qc/validation.json and also returns the result.

Result contract

Result family Shape
ANI, sourmash, GTDB-Tk MethodEnvelope with .to_dict()
Marker identification MultiGeneResult.to_dict()
Read screening list[dict] rows
Assembly validation ValidateResult.to_dict()

MethodEnvelope.to_dict() returns:

{
  "analysis_type": "species_identification",
  "method": "panel",
  "database": {"name": "D2_ani", "version": "..."},
  "result": {"species": "...", "confidence": "high"}
}

The CLI JSON contract, including error fields and exit behavior, is documented in JSON Output Contract.

CLI

The CLI uses the same engines and adds database management and layer arbitration.

# Version; no separate "version" subcommand
gside -V
gside --version
gside -V -J              # JSON version object

# One genome (marker mode is bundled and works immediately)
gside scan contigs.fna
gside scan contigs.fna -m marker+sourmash
gside scan contigs.fna -m all --auto-setup

# Isolate reads; paired mates are grouped as one sample
gside scan reads.fq -m marker
gside scan sample_R1.fq sample_R2.fq -m marker

# Assembly quality
gside validate contigs.fna -o qc/

# Batch + streaming table output
gside scan *.fna -m panel+mash_refseq -j 8 -t 4 -o results.tsv

Modes and arbitration

Mode Engine Input Reference
marker (default) blastn FASTA / FASTQ Bundled marker DB
panel skani FASTA Curated panel tier
mash_refseq mash FASTA / FASTQ RefSeq mash tier
sourmash sourmash FASTA / FASTQ GTDB gather tier
gtdbtk GTDB-Tk FASTA External GTDB-Tk data
all all applicable depends all required tiers

-m accepts + combinations such as marker+sourmash; all runs every isolate genome layer.

Arbitration always prefers the higher-confidence layer:

L3  GTDB-Tk                 phylogenetic placement
L2  panel / mash / sourmash comparative genomics (ANI / sketches)
L1  marker                  target-gene presence/absence

Database commands

Human-readable lists use bordered Rich tables; machine formats are stable.

gside db status
gside db list
gside db status -f json
gside db list -f tsv
gside db setup --tier panel
Tier Contents Approx. size
mini Marker rules + sequences (bundled) ~1 MB
panel Curated skani reference panel ~130 MB sketch / ~1 GB genomes
mash RefSeq MinHash sketch ~179 MB
sourmash GTDB gather database ~3.9 GB

gside validate additionally needs CheckM2 (~1.7 GB) and GTDB-Tk (GTDBTK_DATA_PATH, ~57 GB download).

Output and automation

  • gside scan emits one JSON document per sample by default; -f tsv, -f md, and -f csv are available for tables.
  • gside db status/list default to a human table; use -f json|tsv|csv for automation.
  • gside validate writes validation.json and exits non-zero on a failed quality verdict.
  • Structured database errors include suggested_command, missing_tier, and estimated_size.
  • gside mcp (or gside-mcp) starts an MCP stdio server exposing species, meta, and database operations.

Documentation

Development

pixi install
pixi run check          # ruff check/format
pixi run typecheck      # pyright
pixi run pytest         # unit tests
pixi run docs-build     # strict MkDocs build

The test suite covers the CLI, database formatting, layer arbitration, result contracts, and gseek/legacy parity paths. External-tool tests skip when the required binary is absent.

Project layout

src/gside/
  api.py                 public Python facade
  cli.py                 Click CLI
  analysis/              identification engines
  engine/                tool backends and gseek bridge
  db.py                  database tiers/downloads
  mcp.py                 MCP server
docs/                    bilingual English/Chinese documentation
data/db/D1_marker/       bundled marker database
tests/                   unit and parity tests

License and ecosystem

MIT. Part of the indexofire microbial genomics stack:

Project Purpose
gseek Reproducible DNA alignment infrastructure
gside Species identification + metagenomic profiling
gspec Gene screening + phenotype designation
gmlst MLST / cgMLST typing

Metadata

Release files for gside 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gside 0.2.4
File Size Uploaded Provenance Actions
gside-0.2.4.tar.gz 430.6 kB With provenance Details for gside-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gside 0.2.4
File Interpreter ABI Platform Actions
gside-0.2.4-py3-none-any.whl Python 3 none any Details for gside-0.2.4-py3-none-any.whl

Total release size: 679.9 kB

Release files / gside-0.2.4.tar.gz

Download URL gside-0.2.4.tar.gz
Size 430.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fb6d7655f284b0ca1cf0b8cd08967fe0a8b4fe2735f003f9bac5cb6a0e6c0e7f
BLAKE2b-256 checksum
How to use checksums
6b3dbefd78fd7d0aba996986836ae5137ce35b15d5eb3b5e7951ee8cf3b18e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / gside-0.2.4-py3-none-any.whl

Download URL gside-0.2.4-py3-none-any.whl
Size 249.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae3c2902cbff3f6d45b38c5b5c5994d62dd27e5d833cd9761cfd7f460a704a55
BLAKE2b-256 checksum
How to use checksums
e4a69dc1776d31e7c35c91a227eaa64bbfd6fec57bb9bc8e5161f75640bfc806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for gside 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gside-0.2.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page