Skip to main content

A Python toolkit for fitting and analyzing mutational signatures

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonata_tools-0.1.0.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonata_tools-0.1.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file sonata_tools-0.1.0.tar.gz.

File metadata

  • Download URL: sonata_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.4 Linux/6.8.0-117-generic

File hashes

Hashes for sonata_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7cdece1a6a2e83257fdd2f8d0cd19eb22045d16f3024202a12075ef3ff3ff0ac
MD5 7d987c0f76660b7113553774fe82a725
BLAKE2b-256 79370f8868d128464601800ba417ec424692d7785a3dc492c515d71a201079d2

See more details on using hashes here.

File details

Details for the file sonata_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sonata_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.4 Linux/6.8.0-117-generic

File hashes

Hashes for sonata_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6a259abb7a31144d70dbb5863f59fc6757e691fe0230b95b7d35767532068f3
MD5 a8e07f03e5488ab90a9763a6bb14beba
BLAKE2b-256 5b694955030fdc91428b979b06af9176d1b1f4b7475199592356e2000f97658d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page