Skip to main content

PyPI Docs

smftools

A Python tool for automated processing of raw sequencing data derived from single molecule footprinting experiments into zarr and parquet data formats. Experimental data is organized into projects using DuckDB (optional; falls back to a pandas/pyarrow union without it) to facilitate growth of data collections for scientific projects. An additional analysis subpackage provides functionality that can be imported for custom analyses and interactive analysis sessions.

Philosophy

While genomic data structures (SAM/BAM) were built to store read alignment data and basic read metadata along large references, integration of downstream analyses is not feasible using this format alone. Smftools integrates experimental analyses across file formats, linking raw sequencing data files, BAM alignment files, and downstream analyses into modern storage formats such as zarr for arrays and parquet for tables. This enables efficient partitioned data storage, rapid and parallel data operations, hierarchical metadata handling, and seamless integration with machine-learning workflows. Furthermore, functionality is modularized into multiple processing stages, enabling analysis to restart from convenient checkpoints without having to rerun the full workflow. Collections of experiments are managed under smftools projects, which indexes individual experiments and combine them for continuously growing scientific projects.

Installation

SMFtools requires Python 3.11 or newer. The default installation supports smftools experiment full from a basecalled BAM, including the portable pysam BAM backend, preprocessing, spatial analysis, HMM analysis, and plotting:

pip install smftools

# Or install the current development checkout.
git clone https://github.com/jkmckenna/smftools.git
cd smftools
pip install -e .

Install only the optional capabilities a run needs, for example pip install -e ".[ont,project]":

  • ont -> POD5 input and Nanopore signal I/O.
  • umi -> edit-distance-based UMI and barcode processing.
  • genome-io -> pybedtools and pyBigWig genome-format backends.
  • project -> DuckDB catalogs and lazy xarray-backed project reads.
  • analysis -> downstream clustering, UMAP, tensor, graph, and XGBoost analyses.
  • ml-extended -> Captum, Lightning, SHAP, Weights & Biases, and related ML tools.
  • qc -> MultiQC report generation.
  • all -> every optional runtime capability.

Older fine-grained extras remain compatibility aliases. In particular, torch, plotting, and pysam are now redundant because those dependencies are part of the default workflow install, and all_2 is an alias for all.

Canonical contributor installs use dependency groups so test, lint, and docs tools are never installed by a normal runtime install:

python -m pip install -e ".[all]"
python -m pip install --group dev --group docs

See the installation guide for profile details and external command-line requirements.

Command-line interface

smftools exposes two top-level command groups (smftools --help for the full list):

smftools experiment <config_path> -> pipeline stages for a single experiment:

  • raw -> Prepare BAM artifacts and write the ragged raw store.
  • load -> Optionally pre-build the dense zarr cache from raw artifacts.
  • preprocess -> QC, filtering, and read-level preprocessing.
  • spatial -> Spatial signal analysis.
  • hmm -> HMM feature annotation and plotting.
  • full -> Composed workflow: raw, preprocess, spatial, hmm.
  • batch -> Run any single stage across many experiments listed in a CSV/TSV/TXT file.
  • concatenate, export-fastq, plot-current -> supporting utilities.

smftools project <project_dir> -> registering and querying across experiments:

  • init -> Initialize a project directory + registry.
  • add / remove -> Register or deactivate an experiment in the project.
  • list -> List registered experiments and harmonized references.
  • materialize -> Pool a reference across matching experiments into one AnnData.
  • sample-store-list -> List cataloged per-sample-store partitions.
  • export-fastq -> Write one FASTQ per barcode of QC-passed reads, across every registered experiment.

Full documentation for each command and its options is at smftools.readthedocs.io.

Dependencies

The following CLI tools need to be installed and configured before using the informatics (smftools.inform) module of smftools, which is used by the smftools experiment raw CLI command:

  1. Dorado -> Basecalling, alignment, demultiplexing. Required for Nanopore SMF experiments, but not Illumina SMF experiments.
  2. Minimap2 -> Aligner if not using dorado. Support for other aligners could eventually be added if needed.
  3. Modkit -> Extracting read level methylation metrics from the MM/ML tags in BAM files. Only required for direct modification detection SMF protocols.

License

MIT -- see LICENSE.

Release files for smftools 2.16.0

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

Source distribution (sdist)

Source distribution for smftools 2.16.0
File Size Uploaded
smftools-2.16.0.tar.gz 10.2 MB Details

Built distribution (wheel)

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

Total release size: 18.9 MB

Release files / smftools-2.16.0.tar.gz

Download URL smftools-2.16.0.tar.gz
Size 10.2 MB
Tags Source
SHA-256 checksum
How to use checksums
275d2bcead29f6a45d1f3aaf61342032b8055aae4325cad690764b738fccb489
BLAKE2b-256 checksum
How to use checksums
49058e74c56fbd1a01fec68cf3c3cb82f2525734905293c7cc224b112dd0b3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / smftools-2.16.0-py3-none-any.whl

Download URL smftools-2.16.0-py3-none-any.whl
Size 8.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fb84aae2b28ca0fc12022ae625c9d41802b7d8e2c69d511e991ecd05475a27fc
BLAKE2b-256 checksum
How to use checksums
a683884a77a781ad557d7a0e37ed3287d8c539a725759006a53fe3f5d6f5dd56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

2.21.0

2 release files

2.20.0

2 release files

2.19.0

2 release files

2.18.0

2 release files

2.17.0

2 release files

This release

2.16.0 This release

2 release files

0.4.5

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

1 release file

0.1.7

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

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