sigconfide
sigconfide is a lightweight Python library for estimating mutational signature exposures and selecting the active signatures in a tumor sample. Fitting a mutational profile to a signature panel (e.g. COSMIC) is solved as a quadratic-programming (QP) problem, and the set of relevant signatures is chosen with a stepwise (forward/backward) procedure whose significance is assessed via bootstrap.
Benchmark scripts, example/benchmark data, and comparisons against other refitters (SigProfilerAssignment, MuSiCal) live in the sibling
results_sigconfide/directory at the monorepo root — see the top-level README there for how to run them.
1. Installation
The project requires Python ≥ 3.10. A virtual environment is recommended:
# create and activate a venv
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# install the package in editable mode together with its dependencies
pip install -e .
# optional: plotting / notebook extras (matplotlib, ipykernel)
pip install -e ".[dev]"
Runtime dependencies: numpy, quadprog, pandas, scipy.
Check that the package imports:
python -c "from sigconfide.estimates.selection import hybrid_stepwise_selection; print('OK')"
2. Using the API
hybrid_stepwise_selection takes a mutational profile m (raw counts, one
sample) and a signature panel P (contexts × signatures), and returns the
selected signature subset with their exposures:
import numpy as np
from sigconfide.estimates.selection import hybrid_stepwise_selection
# P: signature panel, shape (n_contexts, n_signatures)
# sig_names: signature names aligned with P's columns, e.g. ['SBS1', 'SBS2', ...]
# m: mutational profile for one sample, shape (n_contexts,) — raw counts are fine,
# sigconfide normalizes internally to a distribution that sums to 1
sel_idx, exposures, errors = hybrid_stepwise_selection(
m, P,
R=100, # number of bootstrap replicates
pre_filter_threshold=0.001 # drop trace signatures up front (speeds things up)
)
for idx, exp in zip(sel_idx, exposures):
print(f"{sig_names[idx]}\t{exp:.3f}")
hybrid_stepwise_selection returns:
sel_idx— indices of the selected signatures in the original panelP,exposures— relative exposures of the selected signatures (sum to 1),errors— reconstruction error (Frobenius norm).
Most important parameters:
R— number of bootstrap replicates (more = more stable, slower),min_support(default0.95) — minimum bootstrap support (fraction of replicates in which a signature's exposure exceedsthreshold) for a signature to be kept/added; this is a stability criterion, not a significance test,pre_filter_threshold(default0.001) — a single fast QP solve prunes trace signatures before the bootstrap loop (~4× fewer signatures, no loss of sensitivity); passNoneto disable it and search from the full panel,mandatory_indices— indices of signatures that are always present (e.g. the ubiquitous SBS1/SBS5) and are never removed,rng— source of the bootstrap draws:None(default) uses the globalnp.random, sonp.random.seedcontrols the result; an int, aSeedSequenceor aGeneratorgives an independent stream that leaves the global state alone.bootstrapSigExposurestakes it too.
For a runnable end-to-end example loading real COSMIC panels and sample data,
see results_sigconfide/examples/run_sbs_example.py in the monorepo root.
Other functions in the package
from sigconfide.estimates.standard import findSigExposures # fit exposures for ALL samples at once (matrix M 96×G)
from sigconfide.estimates.bootstrap import bootstrapSigExposures # bootstrap distribution of exposures for one sample
Batch run (CLI)
python -m sigconfide.cli --samples samples.tsv --signatures signatures.tsv \
--output out_dir [--R 100] [--n-jobs 4]
samples.tsv is contexts × samples, signatures.tsv is contexts × signatures
(first column = context names). The result is out_dir/Assignment_Solution_Activities.txt:
a TSV with samples as rows, signatures as columns and absolute mutation counts
as values (0 = not assigned). Python equivalent:
sigconfide.io.spa_compat.fit_spa_style(...).
3. Repository layout
src/
decompose/qp.py # decomposeQP – QP solver (quadprog)
estimates/
standard.py # findSigExposures
bootstrap.py # bootstrapSigExposures
selection.py # hybrid_stepwise_selection ← main selection function
io/spa_compat.py # fit_spa_style – TSV in / Activities TSV out
cli.py # python -m sigconfide.cli
utils/utils.py # FrobeniusNorm, is_wholenumber, resolve_rng
tests/
docs/ # MkDocs sources; API reference is generated from docstrings
Benchmarks, example/comparison scripts and their input data are not part of
this package — they live in results_sigconfide/ at the monorepo root.
Metadata
Release files for sigconfide 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sigconfide-1.0.0.tar.gz | 21.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sigconfide-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.6 kB
Release files / sigconfide-1.0.0.tar.gz
| Download URL | sigconfide-1.0.0.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96b9c78182352ce1c1d0067cecb6a3add308a9f4643ef12f40353259fab46f8b
|
|
BLAKE2b-256 checksum How to use checksums |
26318523b4e20963c8be851b0d1ea3608ff5a8c5d7104d6b25f2c5ba2d028c7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / sigconfide-1.0.0-py3-none-any.whl
| Download URL | sigconfide-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0d1e2086f8b45acec5d07b0a517c454b07bf88faa1ad06eb669bd6a84dc362f
|
|
BLAKE2b-256 checksum How to use checksums |
e07923021f547f05f6c96c9e119c53627ec59d8103be358fea9f5b7c881eae48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency log