Skip to content

de_toolkit

de_toolkit (detk) is a suite of command line tools for common operations on count matrices from high-throughput sequencing experiments — summary statistics, filtering, normalization, transformation, differential expression, and gene set enrichment. Tools are implemented in Python, or as thin wrappers around canonical R packages (DESeq2, fgsea, logistf) via a lightweight R bridge — no rpy2 required.

Every tool reads and writes plain delimited text files, making detk easy to drop into any workflow manager (Snakemake, Nextflow, or a shell script). As a side effect of each invocation, detk records machine-readable JSON describing what was run and what it found, and can render everything into a single self-contained HTML report.

# normalize a counts matrix with the DESeq2 method
detk-norm deseq2 counts.csv > norm_counts.csv

# differential expression with a design formula
detk-de deseq2 "counts ~ AgeOfDeath + Status[control]" counts.csv samples.csv > de_results.csv

Head to the Quickstart to see a full workflow, the worked example for a real analysis ending in a live example report, or Concepts for the input file formats every tool shares.

Installation

detk requires Python 3.11 or newer.

pip install de_toolkit

or, with uv:

uv tool install de_toolkit

R dependencies

The de, enrich, and some norm/transform subcommands wrap R packages. You need R plus the following packages on your PATH to use them:

  • DESeq2 — detk-de deseq2, detk-transform rlog, detk-transform vst
  • fgsea — detk-enrich fgsea
  • logistf — detk-de firth

Install from within R:

install.packages(c("BiocManager", "logistf", "jsonlite"))
BiocManager::install(c("DESeq2", "fgsea"))

or with conda/mamba from bioconda:

mamba install -c conda-forge -c bioconda \
    r-base r-jsonlite r-logistf bioconductor-deseq2 bioconductor-fgsea

Verify the R bridge is working with:

$ detk wrapr check
R found: True
R path: /usr/bin/Rscript
jsonlite found: True

Everything else works without R.

Stability

The command line interface is detk's stable, supported surface: subcommand names, arguments, output formats, the module JSON schema (versioned), and the Process Run Crate provenance follow semantic versioning from 1.0 onward. The Python API (de_toolkit.* modules) is usable but not yet a compatibility promise — expect it to evolve.

That promise covers what --help prints, by its structure and its facts, not its wording. Every command's and subcommand's help (that of detk-norm and of detk-norm deseq2, say) has the same sections in the same order:

  1. a description
  2. usage:, one line per way of calling the command
  3. positional arguments:
  4. options:, the command's own
  5. common options:, those every command shares
  6. examples:, at least one command line for every subcommand
  7. exit codes:

Every positional argument and option is listed with a one-line description and its metavar (FILE for a file, DIR a directory, N a number, and so on), and an option with its default and its choices where it has them ((default: stdout), (choices: csv, table)). The structure, these facts and the examples are the promise, and detk's tests check them: every example parses, and runs where test data allows. The wording of the descriptions may improve in any release, so a script or an agent reading help should go by its sections and facts, not its sentences. The exit codes are part of the promise too.

Development

git clone https://github.com/BU-Neuromics/de_toolkit.git
cd de_toolkit
uv sync          # creates .venv with the package + dev tools
uv run pytest    # run the test suite

Contributors without uv can use pip install -e '.[test]' in a virtualenv instead. Tests that need R skip automatically when R is absent.