dsh-bio-gem: Building and Delivering GEM (SBML + Model Card) from Bacterial Genome in DSH

Preface

In DeepSeek Harness (DSH), the common path for metabolic modeling is: first annotate the whole genome into protein sequences, then call external pipelines like CarveMe or gapseq to build a GEM, followed by consistency checks, gap-filling, and FBA using COBRApy. These steps are scattered across multiple scripts and environments, making it difficult for an agent to reliably stitch them into a reproducible workflow.

@dsh-bio/dsh-bio-gem (community repository moonbowterfly/dsh-bio-gem) consolidates “Build → Validate → Gap-fill → Report” into a DSH plugin form: it takes a bacterial whole genome (protein FASTA, supporting multiple plasmids/chromosomes; raw .fna files can use an automatic annotation fallback) as input, produces standard SBML and model cards, and fits into the dsh-bio-genie ecosystem, allowing downstream consumption tools for FBA, gene essentiality, and production envelopes to load the models directly. The maintainer is moonbowterfly, and it is categorized as Workflow in the SkillHub directory.

What is this

One-sentence positioning: Genome in, validated SBML out (Genome-scale metabolic model builder for dsh: genome in, validated SBML out).

The plugin is published as the npm package @dsh-bio/dsh-bio-gem (pure ESM, MIT license), with the version shown in current materials being 0.1.19. In addition to gem_build, the README describes 23 other analysis/validation/gap-filling/ledger/benchmark/export tools based on Python cobra; the build side separately depends on CarveMe (and diamond) or optionally WSL2 + gapseq.

Core Functions

Below is a summary of responsibilities as written in the README; interface details not present in the materials are not expanded upon.

Modeling Pipeline

  1. Input: Bacterial whole genome; protein FASTA is the main path. If the input is a raw genome (.fna), the optional dependency pyrodigal is used for an automatic annotation fallback (related to gem_annotate capabilities).
  2. Build (gem_build): The default engine is CarveMe (independent venv, requiring carve.exe and diamond.exe in the same directory); optional engine=gapseq is available via WSL2 bridging, marked as experimental in the README, taking about 30–60 minutes per model, and is not required.
  3. Validation and Gap-filling: Most gem_* tools other than building run in a Python environment with cobra installed.
  4. Deliverables: Standard SBML and a Model Card; runtime models, ledgers, jobs, etc., are stored in ~/.dsh/dsh-bio-gem/ (models/, ledger/, jobs/, etc.).

Division of Labor with dsh-bio-genie

Plugin Responsibility
dsh-bio-gem Make models: Genome → Build → Validate → Gap-fill → Model Card
dsh-bio-genie Use models: FBA, gene essentiality, production envelopes, model management panel, and broader bioinformatics tools

Both can be installed simultaneously; the README states that genie’s agent persona has built-in routing for the GEM capability domain, and requests for “building models / modeling / gap-filling” will be forwarded to the gem_* toolchain.

Hosted Integration (v0.1.11+, when in the same instance as genie)

Gem provides two read-only, loopback-only HTTP endpoints for the genie panel to probe status (gem itself does not register a standalone settings page):

GET /api/dsh-bio-gem/integration/health
GET /api/dsh-bio-gem/integration/v1/status

Requests from non-local sources or with mismatched Origin/Host return 403; the endpoints do not expose tokens or arbitrary commands.

Installation and Activation

Environment Requirements (Summary)

Component Requirement
dsh engine 0.1.x (npx -y @deepseek-ai/dsh --version)
Node.js ≥ 22.19 or ≥ 24 (see engines in the package)
Python 3.10+ with import cobra available (analysis side; if genie is installed, its bootstrap environment can be reused)
CarveMe + diamond Independent venv ~/.dsh/dsh-bio-gem/venv-carveme (only for gem_build carveme path)
WSL2 + gapseq Optional, only for gem_build gapseq engine

Python interpreter detection order (since v0.1.4): GEM_PYTHON → dsh-bio-genie bootstrap environment → CONDA_PREFIX → python in PATH, verifying import cobra for each.

Installing the Plugin

Web installation from npm is recommended (--profile is required):

npx -y @deepseek-ai/dsh plugin --profile web add @dsh-bio/dsh-bio-gem

You can also install from GitHub source or a local directory (commands follow the README):

npx -y @deepseek-ai/dsh plugin --profile web add github:moonbowterfly/dsh-bio-gem

npx -y @deepseek-ai/dsh plugin --profile web add ./dsh-bio-gem

dsh Desktop 0.2.0+ can use the built-in CLI with --profile desktop to install the same package name; a restart of the corresponding dsh profile is required after installation. If you encounter a npm 404, the README suggests waiting a few minutes or adding --registry https://registry.npmjs.org/.

Confirm the plugin is registered (no service startup needed):

npx -y @deepseek-ai/dsh --profile web --dump-config | grep dsh-bio-gem

Without genie installed: Provide your own cobra Python

If @dsh-bio/dsh-bio-genie is already installed, you can skip this; otherwise, the example uses uv to create a venv and set GEM_PYTHON (must be done before starting dsh):

uv venv --python 3.11 "$HOME/.dsh/dsh-bio-gem/venv"
uv pip install --python "$HOME/.dsh/dsh-bio-gem/venv/Scripts/python.exe" cobra pyrodigal
setx GEM_PYTHON "$env:USERPROFILE\.dsh\dsh-bio-gem\venv\Scripts\python.exe"

Preparing the CarveMe Build Engine

The build side uses an independent venv; do not merge it into genie or system Python:

uv venv --python 3.11 "$HOME/.dsh/dsh-bio-gem/venv-carveme"
uv pip install --python "$HOME/.dsh/dsh-bio-gem/venv-carveme/Scripts/python.exe" carveme
curl -L -o diamond.zip https://github.com/bbuchfink/diamond/releases/latest/download/diamond-windows.zip
unzip -o diamond.zip diamond.exe -d "$HOME/.dsh/dsh-bio-gem/venv-carveme/Scripts/"

The README emphasizes: the executable file name is carve, not carveme; if diamond is missing, there might be only a single line of prompt with an exit code of 0 and an empty output directory. When troubleshooting build failures, first ensure diamond.exe is in the same directory as carve.exe.

Typical Usage

Driving Workflows in DSH Chat

After installation and completing the environment setup above, restart the plugin in DSH Web or Desktop to enable it. If dsh-bio-genie is installed simultaneously, you can directly describe requirements in natural language such as “Build a GEM from this genome, validate, gap-fill, and export SBML”; genie will route modeling intents to this plugin’s gem_* toolchain, producing outputs written to directories like ~/.dsh/dsh-bio-gem/models/, which are then loaded by genie’s FBA and other tools.

Without genie installed, you can still complete building and analysis via the same batch of gem_* tools registered by DSH, but you must ensure GEM_PYTHON and the CarveMe venv are ready yourself.

In-repo Smoke and Integration Checks

Maintainers provide detection commands in the source directory that do not depend on the dsh service process (asset directory requires --assets-root or DSH_BIO_GEM_ASSETS; some checks will SKIP if assets are missing):

GEM_PYTHON=<your-cobra-python> node test/smoke.js --skip-build
GEM_PYTHON=<your-cobra-python> node test/smoke.js
node test/integration.js

Status Probing when Co-located with genie

Access via local loopback (example, specific Host depends on your dsh instance):

GET http://127.0.0.1:<port>/api/dsh-bio-gem/integration/health
GET http://127.0.0.1:<port>/api/dsh-bio-gem/integration/v1/status

The BioGenie panel displays five states based on this, such as ready / degraded; the state is only ready or degraded.

Use Cases and Notes

Who it is for: Research or engineering scenarios that need to chain bacterial GEMs from genome to verifiable SBML within DSH agent workflows; and to be used in conjunction with dsh-bio-genie for downstream metabolic analysis.

Permissions and Security: The plugin reads and writes local directories, invokes Python and CarveMe/gapseq subprocesses with the user permissions of the current dsh process. Before installation, you should read the GitHub Source Code and the MIT license to confirm the tool’s behavior complies with your data and regulatory requirements. Integration endpoints are loopback-only, but modeling will still write data to ~/.dsh/dsh-bio-gem/.

Uninstallation: npx -y @deepseek-ai/dsh plugin --profile web remove dsh-bio-gem does not delete the aforementioned runtime directories; manual cleanup is required.

Engine Compatibility: The README records verification of dsh 0.1.x via 0.1.5-rc.2; Desktop 0.2.0+ was tested on 2026-10-01 for tool registration and gem_media_resolve execution. The gapseq path depends on a fixed WSL2/conda topology; switching machines often requires modifying path constants in python/gapseq_wsl.py.

Conclusion

dsh-bio-gem encapsulates GEM construction, validation, gap-filling, and SBML/Model Card delivery as a DSH workflow plugin, connecting with the “model usage” capabilities of dsh-bio-genie. Directory page: SkillHub — moonbowterfly/dsh-bio-gem; Source and installation instructions: github.com/moonbowterfly/dsh-bio-gem.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye