Skip to main content

juzi

Project description

:tangerine: juzi

Various methods for analyzing cell states and types in single-cell sequencing data (experimental).

Installation

pip install juzi

cell states (cs)

Identifying intra-sample programs.

from juzi.cs.nmf import gaussian_nmf, poisson_nmf, fixed_gaussian_nmf, fixed_poisson_nmf

# Vanilla NMF on normalized and log1p counts
W, H, losses = gaussian_nmf(
    data,
    n_factors=8,
    max_iter=100,
    lambda_H=1e-2,
    init="random",
    eps=1e-7
) 

# Poisson NMF on counts
W, H, losses = poisson_nmf(
    data,
    n_factors=8,
    max_iter=100,
    lambda_H=1e-2,
    init="nndsvd",
    eps=1e-7
)

# Vanilla NMF with fixed H
W, losses = fixed_gaussian_nmf(
    data,
    fixed_H=H,
    max_iter=100,
    init="random",
    eps=1e-7,
    silent=False
)

# Poisson NMF with fixed H
W, losses = fixed_poisson_nmf(
    data,
    fixed_H=H,
    max_iter=100,
    init="random",
    eps=1e-7,
    silent=False
)

Identifying consensus (intra-sample) and shared (inter-sample) programs.

from juzi.cs.nmf import factor_consensus, factor_similarity

# Compute a set of clustered consensus factors between NMF runs
HC, HS, labels, correlation = factor_consensus(
    [H1, H2, H3, ...],
    n_clusters=10,
    eps=1e-8,
    method="agglomerative",
    metric="euclidean",
    linkage="ward",
)

# Compute similarity matrix between factors computed across different samples
S, K, ids = factor_similarity(
    [H1, H2, H3, ...],
    distance="cosine",
    top_k=500,
    drop_zeros=True,
    intra_sample=False,
    eps=1e-8
)

Some additional tools for clustering and filtering factors.

from juzi.cs.cluster import eigengap_heuristic, spectral_clustering

# Estimate an optimal number of clusters from a similarity matrix
results = eigengap_heuristic(
    S,
    min_clusters=2,
    max_clusters=10,
    normalize=True,
    eps=1e-8
)

results.plot(show=True)

# Cluster a similarity matrix given an input number of clusters
assignments = spectral_clustering(
    S,
    n_clusters=results.k,
    normalize=True,
    seed=123456,
    eps=1e-8
)

marker genes (mg)

Various marker genes for cell types, subtypes, and pathways.

from juzi.mg import available_sets

# Check available marker gene sets
print(available_sets())

# Load breast cancer gene sets (e.g. PAM50)
from juzi.mg import CancerBreast
markers = CancerBreast()

# Load cancer pathway gene sets (e.g. HIPPO)
from juzi.mg import CancerPathways
markers = CancerPathways()

# Load cell cycle gene sets (e.g. G1S)
from juzi.mg import CellCycle
markers = CellCycle()

# List available sets in a given marker class
markers.info()

# Get all genes from all sets in a flattened list
markers.all()

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

juzi-0.0.7.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

juzi-0.0.7-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file juzi-0.0.7.tar.gz.

File metadata

  • Download URL: juzi-0.0.7.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for juzi-0.0.7.tar.gz
Algorithm Hash digest
SHA256 edfbdd4e4b51a3ea9741967a6e24645a0972f6fb43cf4bb81008378a16990172
MD5 81e656ac964368ad91d4844bea5668dc
BLAKE2b-256 e1c5e72204373a7e0cb96d89c24a679d8a8553310664e0be71f00cd672560780

See more details on using hashes here.

File details

Details for the file juzi-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: juzi-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for juzi-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2c5fe15a1e78f22a8f692823fdeff4681fea48f5d7bf4a47d177c8f389863e59
MD5 7bc597fbca2c46955f4c3cb4cfb20d94
BLAKE2b-256 9123c0ce3c780a969009626507e37dfdeefeb49d57725ce563103bd084385b3c

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