Skip to main content

General functions useful to members of Rohit Singh lab.

Project description

To install:

git clone git@github.com:rohitsinghlab/singhlab-main.git
cd singhlab-main
pip install .

To run sceodesic with 10 different random seeds

from singhlab.utils.decorators import run_with_seed
from sceodesic import run_sceo

seeds = [123, 444, 33, 1234, 99, 14, 37]
results = {}

adata = sc.read_h5ad('adata.h5ad')

for seed in seeds:
    run_with_seed(seed)(run_sceo)(adata, num_hvgs=300)
    sceo_embeddings = adata.obsm['sceo_embeddings']
    sceo_programs = adata.varm['sceo_programs]
    results[seed] = (sceo_embeddings, sceo_programs)

To do a bootstrap for some uncertainty quantification:

from singhlab.utils.decorators import bootstrap
import numpy as np

# bootstrap parameters 
num_trials = 100
seed = 42

# the function we want to run our bootstrap on
@bootstrap(num_trials, seed)
def get_mean(data):
    return np.mean(data)
 
# Example data
data = np.array([5, 7, 8, 6, 9, 10, 12, 7, 6, 8])

# automatically applies bootstrap
boot_means = get_mean(data)

# Percentile CI (95%)
lower, upper = np.percentile(boot_means, [2.5, 97.5])

print(f"Bootstrap mean CI: [{lower:.2f}, {upper:.2f}]")

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

singhlab-0.0.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

singhlab-0.0.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file singhlab-0.0.1.tar.gz.

File metadata

  • Download URL: singhlab-0.0.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for singhlab-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0cabd7523f06f71ab03114b8bb75939da29e09f1e3642afb61a95ea325c3c6d3
MD5 7d68dd0ab38939fbcd3fce0ef562a0a3
BLAKE2b-256 1517a63097df39ff86cc59c96cf9c565154c137367ea30a2065181daac9d731e

See more details on using hashes here.

File details

Details for the file singhlab-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: singhlab-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for singhlab-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65b71f244aba4187963a32ab888fa5075d4998432d916891e34bd42620d25aa3
MD5 7a21f81c14d4ed8f656ca8f52990b758
BLAKE2b-256 6191bffdcda6f61271b670f8c35a8b8ee665abcf5a6c4cc880e519f2598d8216

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