Skip to main content

Sonata

Python versions supported License Code style

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-learn

The package is installed as sonata-learn 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 shape n_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-learn 0.1.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 sonata-learn 0.1.0
File Size Uploaded Provenance Actions
sonata_learn-0.1.0.tar.gz 25.3 kB Without provenance Details for sonata_learn-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sonata-learn 0.1.0
File Interpreter ABI Platform Actions
sonata_learn-0.1.0-py3-none-any.whl Python 3 none any Details for sonata_learn-0.1.0-py3-none-any.whl

Total release size: 56.7 kB

Release files / sonata_learn-0.1.0.tar.gz

Download URL sonata_learn-0.1.0.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bd3df9b0e075c5f139d869f5827755195280a1afa5d2acac01f5050d0756e7a8
BLAKE2b-256 checksum
How to use checksums
100b8520c06a00e9acb1046fc55ea480321d5fc6004d41877aab263627e312f3
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_learn-0.1.0-py3-none-any.whl

Download URL sonata_learn-0.1.0-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1385c23ba844c647127e66e38bdad25e06e131279de39aec1b31d8f8915a416d
BLAKE2b-256 checksum
How to use checksums
1c00e401b34d533871279a81c5996faae63b05cd63780775b5d8c33ab716182e
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-learn 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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