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
                                # Stores cell-factors under .obsm['X_nmf']
                                # Stores gene-factors under .varm['factors']

genes = model.program_genes()   # Get differential expressed genes per program
model.plot_cophcorr("cc.html")  # Cophenetic correlation for each tested rank

Documentation

BioNMF(
    random_state,               # Initial random state
    **kwargs                    # Arguments for 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
)

References

Brunet JP, Tamayo P, Golub TR, Mesirov JP. Metagenes and molecular pattern discovery using matrix factorization. Proc Natl Acad Sci U S A. 2004 Mar 23;101(12):4164-9. doi: 10.1073/pnas.0308531101. Epub 2004 Mar 11. PMID: 15016911; PMCID: PMC384712.

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.5.tar.gz (20.5 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.5-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bionmf-0.0.5.tar.gz
  • Upload date:
  • Size: 20.5 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.5.tar.gz
Algorithm Hash digest
SHA256 db6411a989aee54b3d30eaf2cb1dc5615bca5e2124ff4443613d6e71e2b60bfe
MD5 4e2746c15df21366d0d5d7572e099db0
BLAKE2b-256 1ad69ba5fca5a071497ca9fc295b06996c04be5dd984d69f13bf058389efc0cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bionmf-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f0c482e825b6bc55b4590b81ddf2f33205da9679b66f8844546bc88cd887c02c
MD5 d3d97720b22eaee1582705b617922578
BLAKE2b-256 15291cbe99b2e759f9406e7fafdfe67bec77d9e12a7495ebbde29b0e8dfa599b

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