Install
Install the package and a reference genome, and check that a file scores.
Before you begin, you need Python 3.9 or newer, a C toolchain, about 3 GB of disk for a reference genome; about 10 minutes.
Install the package
pip install --pre sigma2
sigma2 data genome hg19
sigma2 info
The package, a reference genome, and a check. The --pre flag is required for the current release.
Check the requirements
| Requirement | Detail |
|---|---|
| Python | 3.9 or newer. numpy 2 is supported. |
| Platform | Linux x86_64 and aarch64, macOS arm64, Windows x64. On Windows the package reads FASTA and VCF files with its own readers, with identical results; the reference FASTA must be plain text there, which the genome sigma2 data genome installs is. |
| C toolchain | One dependency compiles at install: build-essential on Debian and Ubuntu, base-devel on Arch, the Xcode command line tools on macOS, the Microsoft C++ Build Tools on Windows. |
| scikit-learn | 1.4 up to, not including, 1.8. The signature classifiers are pickles pinned to that range. |
| Disk | The classifiers and reference tables ship with the package. A reference genome is about 3 GB per build. |
Scoring a file downloads nothing beyond the reference genome, once. The environment every example on these pages assumes is stated on Example files and environment.
Download a reference genome
The trinucleotide context of each mutation comes from a FASTA. Either download a build into the data directory:
sigma2 data genome hg19
sigma2 data genome hg38
or point a run at a FASTA you already have:
sg2.run(
input="calls.vcf",
ref_genome="/data/ref/GRCh37.fa",
tumor_type="breast",
seq_type="msk",
soi="SBS3",
)
| Parameter | Description | Default |
|---|---|---|
| inputpath, list of paths, folder or DataFrame | The mutations: a MAF path, a VCF path, a list of VCF paths, a folder of VCFs, a CSV, or a DataFrame of SBS-96 counts. | Required |
| ref_genomestr or path | The build of the coordinates (hg19, hg38, GRCh37, GRCh38) or a FASTA path; unused for a matrix input. | 'hg19' |
| tumor_typestr | A tumor type of the vocabulary, in any case (the package lists 39 names; msi and pole among them are signature sets, not tumor types); it sets the signature set, the reference spectra and the classifier. | Required |
| seq_typestr | The platform (msk, fo, op, seqcap, tcga_mc3, wgs); "auto" chooses by SNV burden and reports the choice. | 'auto' |
| soistr or CompositeSignature | The signature of interest: a COSMIC name, a composite preset (APOBEC, SBS7, SBS10, SBS17, CLOCK), an alias (UV, POLE), or HRD. | Required |
ref_genome accepts "hg19", "hg38", the aliases GRCh37 and GRCh38, or a path. A matrix of SBS-96 counts needs no genome.
Find the data directory
Downloaded data and your own models live in one place: $SIGMA2_DATA_DIR if set, else the per-user application directory (~/.local/share/sigma2 on Linux). sigma2 info prints it.
<data dir>/
reference/hg19_genome.fa sigma2 data genome
repeat_bed_files/ sigma2 data fetch (below)
sysdata/models/ the package's classifiers, seeded on first use, and yours
sysdata/hrd/ HRD models you train
sysdata/add/ Add objects saved without a path
sysdata/custom.h5 reference tables set with sg2.set
cache/ indices
When the directory is not writable, classifiers are read from the package itself. Training, saving an Add object and the caches need a writable directory.
Optional: panel simulation and microsatellite counts
Panel simulation, needed to train a classifier, uses pybedtools and the bedtools binary on PATH:
pip install --pre 'sigma2[panel]'
Microsatellite indel counts, which Detect MMRD or POLE and the indel features of HRD compute from a VCF or MAF, read six repeat-locus BED files (about 835 MB):
sigma2 data fetch --all
sigma2 data list
The files are hosted in the SigMA2 repository, which is private while the manuscript is in preparation: the download works only for a GitHub account the maintainers have given access, logged in with gh auth login or through a token in SIGMA2_GITHUB_TOKEN (or GITHUB_TOKEN). Without access the fetch returns a 404 and names the way to ask for it; the same six files are in the public SigMA (R) repository, and the next section downloads them from there. Runs do not stop without the files: predict_mmrd_ppd() scores every tumor as if it had no microsatellite indels and an HRD run skips its MMRD/POLE step, both without a message at the default verbosity, so check for the nmsi_ins and nmsi_del columns, and in an HRD run for MMRD_category. Signature classifiers need none of this.
Optional: get the repeat-locus files from the SigMA (R) repository
The six files are the ones SigMA v1 ships, and the public SigMA (R) repository on GitHub holds them with the checksums the package's registry records. Without access to the SigMA2 repository, download them from there to the paths the package reads, and check them:
for f in merged_bed_10to13 merged_bed_1_14to16 merged_bed_2to3 \
merged_bed_4_XtoY merged_bed_5_17to_22 merged_bed_6to9; do
curl -sSL --create-dirs \
-o "$(sigma2 data path repeat_bed_files-$f.bed)" \
"https://media.githubusercontent.com/media/parklab/SigMA/master/inst/extdata/repeat_bed_files/$f.bed"
done
sigma2 data verify
OK repeat_bed_files-merged_bed_10to13.bed
OK repeat_bed_files-merged_bed_1_14to16.bed
OK repeat_bed_files-merged_bed_2to3.bed
OK repeat_bed_files-merged_bed_4_XtoY.bed
OK repeat_bed_files-merged_bed_5_17to_22.bed
OK repeat_bed_files-merged_bed_6to9.bed
data release: expected 2026.2, installed 2026.2 [up to date]
sigma2 data fetch --all then finds the six files in place and downloads nothing.
Check the install
import sigma2 as sg2
sg2.describe()
describe is called with its defaults. All parameters of describe
describe() prints every installed classifier as one table per tumor type, rows classifiers and columns platforms, each cell its status, with the tumor type's SNV floor in the heading. On a console without the glyphs (Windows' default console) it prints * for released, o for weak and ^ for experimental. The same list as data: classifiers.cards() (after from sigma2 import classifiers).
sigma2 info
sigma2 data list
sigma2 0.0.16-alpha.20
package : .../site-packages/sigma2/__init__.py
data dir : /home/you/.local/share/sigma2
installed : 835 MB
free : 36.5 GB
data release: expected 2026.2, installed 2026.2 [up to date]
data assets : 6/6 present
classifiers : 92 legacy (SigMA v1)
Upgrade
pip install --pre --upgrade sigma2
A release can replace a classifier. The package records replaced weights in retired.json, and sg2.models.migrate() moves a store that still holds an old copy. Your own models are not touched.