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
Release history Release notifications | RSS feed
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.2.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
singhlab-0.0.2-py3-none-any.whl
(11.7 kB
view details)
File details
Details for the file singhlab-0.0.2.tar.gz.
File metadata
- Download URL: singhlab-0.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed610e6292e39f0c0dbf98a81b1eeb037e91dd5eaaec869de840480ada9d6afd
|
|
| MD5 |
65fe143c18e775c2948fe966e679121f
|
|
| BLAKE2b-256 |
d137597b6198ef776531a5fc9454e9841c5edaa7b39f1eba44a0dbc089443883
|
File details
Details for the file singhlab-0.0.2-py3-none-any.whl.
File metadata
- Download URL: singhlab-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a204a326178e7c0658640fca46d463b65e04c1e574400d3f128bc1b0aa5584b8
|
|
| MD5 |
c1db7541c33b12a9bc6c040a86fc7b70
|
|
| BLAKE2b-256 |
e37b6b0c6cd354bb82825e5f889e2d864faafe78961fa43b6e5d7316b1e53014
|