Sonata
Sonata is a Python toolkit for fitting and analyzing mutational signatures. It fits signatures and exposures in AnnData objects and provides analysis and plotting APIs for signature workflows.
Installation
pip install sonata-tools
The package is installed as sonata-tools and imported as sonata.
Quickstart
import sonata as so
model = so.models.NMF(n_signatures=6)
model.fit(adata)
so.pl.barplot(model.asignatures)
so.pl.stacked_barplot(model.exposures)
so.tl.reduce_dimension(
model.adata,
basis="exposures",
method="umap",
)
so.pl.embedding(model.adata, basis="umap")
Data Format
Sonata expects mutation counts in an AnnData object:
adata.X: count matrix with shapen_samples x n_mutation_types.adata.obs: optional sample annotations.adata.var: optional mutation-type annotations.
After fitting, the model stores learned signatures in model.asignatures and
sample exposures in model.adata.obsm["exposures"].
Documentation
For a complete workflow covering data preparation, NMF, visualization, fixed signatures, Cornet, and simple model selection, see the Markdown tutorial. A runnable notebook with the same analysis and figure-generation code is available at docs/tutorial.ipynb.
Models
Sonata currently exposes three algorithms:
so.models.NMF: NMF with the generalized Kullback-Leibler divergence.so.models.MvNMF: minimum-volume NMF.so.models.Cornet: correlated NMF with joint sample and signature embeddings.
License
MIT
Metadata
Release files for sonata-tools 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| sonata_tools-0.1.0.tar.gz | 25.3 kB | Without provenance | Details for sonata_tools-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sonata_tools-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sonata_tools-0.1.0-py3-none-any.whl |
Total release size: 56.7 kB
Release files / sonata_tools-0.1.0.tar.gz
| Download URL | sonata_tools-0.1.0.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cdece1a6a2e83257fdd2f8d0cd19eb22045d16f3024202a12075ef3ff3ff0ac
|
|
BLAKE2b-256 checksum How to use checksums |
79370f8868d128464601800ba417ec424692d7785a3dc492c515d71a201079d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.4 Linux/6.8.0-117-generic
|
Release files / sonata_tools-0.1.0-py3-none-any.whl
| Download URL | sonata_tools-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6a259abb7a31144d70dbb5863f59fc6757e691fe0230b95b7d35767532068f3
|
|
BLAKE2b-256 checksum How to use checksums |
5b694955030fdc91428b979b06af9176d1b1f4b7475199592356e2000f97658d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.4 Linux/6.8.0-117-generic
|
Security for sonata-tools 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.