larry._utils

Submodules

Package Contents

Classes

AutoParseBase

Helper class that provides a standard way to create an ABC using

ABCParse

Helper class that provides a standard way to create an ABC using

MultifatedLineagePredictionResults

LineageClassification

Sort ground truth lineages based on their types.

TaskTwoEvalCallback

Helper class that provides a standard way to create an ABC using

Functions

sparse_var(E[, axis])

calculate variance across the specified axis of a sparse matrix.

sparse_rowwise_multiply(E, a)

multiply each row of sparse matrix by a scalar

mean_center(E[, column_means])

mean-center columns of a sparse matrix

normalize_variance(E[, column_stdevs])

variance-normalize columns of a sparse matrix

sparse_zscore(E[, gene_mean, gene_stdev])

z-score normalize each column of a sparse matrix

fetch_data(→ torch.Tensor)

Fetch data as torch.Tensor using an index for adata.

mk_multifate_cmap()

Attributes

LARRY_in_vitro_cmap

class larry._utils.AutoParseBase

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

property _init_params
property _call_params
property _parse_params
property _collected_params
__call__()
__init_kwargs__()
_inspect(func)
_collect_literal_kwargs(kwargs_val)
__hide__(key)
__collect__(key, val)
__parse__(kwargs: dict, ignore: list = ['self'], private: list = ['ignore', 'private', 'public'], public: list = [], kwargs_key: str = 'kwargs')

Pass locals() or some other collection of kwargs to kwargs to save them as attributes of the subclass.

kwargs

typically locals() type: dict

ignore

type: list default: [“self”]

private

type: list default: [“ignore”, “private”, “public”]

public

type: list default: []

kwargs_key

type: str default: “kwargs”

  1. assumes all are public unless denoted in private

  2. If a public list is provided, all kwargs are shifted to private unless denoted in public.

larry._utils.sparse_var(E, axis=0)

calculate variance across the specified axis of a sparse matrix.

larry._utils.sparse_rowwise_multiply(E, a)

multiply each row of sparse matrix by a scalar

larry._utils.mean_center(E, column_means=None)

mean-center columns of a sparse matrix

larry._utils.normalize_variance(E, column_stdevs=None)

variance-normalize columns of a sparse matrix

larry._utils.sparse_zscore(E, gene_mean=None, gene_stdev=None)

z-score normalize each column of a sparse matrix

larry._utils.fetch_data(adata: anndata.AnnData, idx: pandas.Index, n_sim: int = 1, use_key: str = 'X_pca') torch.Tensor

Fetch data as torch.Tensor using an index for adata.

adata

type: anndata.AnnData

idx

type: pd.Index

n_sim:

type: int default: 1

use_key:

type: str default: “X_pca”

X_data

type: torch.Tensor

class larry._utils.ABCParse(*args, **kwargs)

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

property _STORED: List
_BUILT = False
__build__() None
__set__(key: str, val: Any, public: List = [], private: List = []) None
__set_existing__(key: str, val: Any) None
__parse__(kwargs: Dict, public: List = [], private: List = [], ignore: List = [])
__update__(kwargs: dict, public: List = [], private: List = []) None
larry._utils.LARRY_in_vitro_cmap
larry._utils.mk_multifate_cmap()
class larry._utils.MultifatedLineagePredictionResults(threshold=0.3)

Bases: larry._utils._abc_parse.ABCParse

_target_label(row)
_predicted_label(predicted)
_compose_target_pred_df(idx, predicted, target)
_compute_error(target_pred_df)
__call__(F_obs_impure, F_hat)
class larry._utils.LineageClassification(F_obs: pandas.DataFrame)

Bases: larry._utils._abc_parse.ABCParse

Sort ground truth lineages based on their types.

property homogeneity
property impure_idx_mask
property pure_idx_mask
property n_impure
property n_pure
property F_obs_pure
property F_obs_impure
class larry._utils.TaskTwoEvalCallback(model, UMAP_model=None, t=torch.Tensor([2, 4, 6]), device=autodevice.AutoDevice(), N=2000, use_key='X_scaled', PR_threshold=0.3)

Bases: lightning.Callback, larry._utils._abc_parse.ABCParse

Helper class that provides a standard way to create an ABC using inheritance.

property _TESTING
property t
property fate_df
property t0_idx
property F_obs
property labels
property F_hat
property F_obs_pred
property LOGPATH
_plot_fate_bias_clustermap()
on_fit_end(trainer, pl_module, *args, **kwargs)