Skip to main content

NMF solver for gene programs.

Project description

Installation

$ pip install bionmf

Usage

from bionmf import BioNMF       # Import model

model = BioNMF()
nmf = model.fit(                # NMFInfo object, see below for properties
    adata,                      # AnnData object
    rank_range = range(2, 3),
    n_runs = 3,
    cutoff = 0.95
)

adata = model.get_adata()       # Return AnnData object
adata.obsm['X_nmf']             # Stores cell-factors under .obsm['X_nmf']
adata.varm['factors']           # Stores gene-factors under .varm['factors']

genes = model.program_genes()   # Get differential expressed genes per program

model.plot_cophcorr("coph.png") # Cophenetic correlation for each tested rank
model.plot_heatmap("hm.png")    # Heaetmap of gene programs

Documentation

BioNMF(
    random_state,               # Initial random state
    **kwargs                    # Rest of arguments are passed to sklearn.decomposition.NMF
).fit(
    adata,                      # Accepts AnnData and DataFrame (must be cells as rows)
    rank_range,                 # Range of rank values to test
    n_runs,                     # Number of runs (random intializations) for each rank
    cutoff                      # Cophenetic correlation cutoff
)                               # -> returns NMFInfo object

NMFInfo(                        # Properties accessed as nmf.rank, nmf.W, etc.
    rank,                       # Chosen (best) rank
    W,                          # (genes by factors) matrix -> gene programs
    H,                          # (cells by factors) matrix -> program assignment
    connectivity_mat,           # (cells by cells) matrix -> program connectivity
    reconstruction_err,         # RMSE of reconstruction
    cophcorr                    # Cophenetic correlation
)

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

bionmf-0.0.4.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

bionmf-0.0.4-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file bionmf-0.0.4.tar.gz.

File metadata

  • Download URL: bionmf-0.0.4.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for bionmf-0.0.4.tar.gz
Algorithm Hash digest
SHA256 14fb8432e7d4162f00a2bd7613e00baf0b935495ada43f1e728eb1f34217e1ac
MD5 55a2567eaf02946262999a92c9dea69a
BLAKE2b-256 f5a3fb2382e8a42b26d43e1ec519f612cad43546c27588fc2c6a517ec30fdceb

See more details on using hashes here.

File details

Details for the file bionmf-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: bionmf-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for bionmf-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bdd48d4d846dfbcd941d9f982d1d3fbdc2eaab64b54c37baa02d6ab62ec6fbb6
MD5 a75a16b4d3f1eb06159578f5cfe5b2e3
BLAKE2b-256 395aeb6179ab1efaecd08f9c456fdf6780fe47c88cda03c98ba9dc5df8bfd534

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