larry._tools

Submodules

Package Contents

Classes

CellFates

IndexSubsets

Container for keep track of subset indices.

Functions

time_occupance([fate_time, return_df])

Parameters:

annotate_fated() → None)

We use this function to denote lineages with cells at d2

count_fate_values(adata[, origin_time, fate_time, ...])

Count fate values.

to_AnnDataset(adata[, use_key, groupby, obs_keys, ...])

fetch_fate_bias_data()

annotate_clone_idx_in_obs(adata[, clonal_matrix_key, ...])

Annotate clonal indices in the adata.obs table from adata.obsm clone matrix.

subset_clonal(adata[, lineage_key])

Parameters:

larry._tools.time_occupance(adata: anndata.AnnData, lineage_key: str = 'clone_idx', exclude_fate: tuple = ('Cell type annotation', ['undiff']), fate_time=[4, 6], time_key: str = 'Time point', return_df=False) Union[pandas.DataFrame, None]
adata

type: anndata.AnnData

lineage_key

type: str

time_key

type: str

time_occupance

type: pandas.DataFrame

class larry._tools.CellFates(adata, time_key='Time point', lineage_key='clone_idx', state_label_key='Annotation')
property fates
property lineage_state_descriptions: pandas.DataFrame
__parse__(kwargs, ignore=['self'])
__setup__(kwargs, ignore=['self'])
subset(subset_time=None)

# subset for lineages with cells at d2 and d6 # cf.subset([2, 6]) # subset for lineages with cells at all time points

_lineage_state_descriptions()
_configure_fates()
temporal_fate_descriptions()
combine_fate_matrices(t_combine: list = [4, 6], normalize=True)

Combine fate matrices across timepoints (e.g., d4 and d6)

clustermap(fate_df)

cf.clustermap(cf.combined)

format_state_for_merge(state_df)
state_to_cell_indexed_fate_bias(state_df)

Transform cell state df to a cell-indexed fate bias df

Can pass: cf.d6_state, cf.d4_state

__call__(subset_time=[2, 6], fate_t=6)
class larry._tools.IndexSubsets(adata, time_key='Time point', lineage_key='clone_idx')

Bases: larry._utils._auto_parse_base_class.AutoParseBase

Container for keep track of subset indices.

property lineage_traced
_configure_time_subset()
_configure_lineage_traced_time_subset()
larry._tools.annotate_fated(adata, lineage_key='clone_idx', time_key='Time point', t0=2, fate_time=[4, 6], key_added='fate_observed', t0_key_added='t0_fated', exclude_fate: tuple = ('Cell type annotation', ['undiff'])) None

We use this function to denote lineages with cells at d2 and one or more cells in [d4, d6]

Updates adata.obs with two columns -> adata.obs[[‘fate_observed’, ‘t0_fated’]]

larry._tools.count_fate_values(adata, origin_time=[2], fate_time=[4, 6], annotation_key='Cell type annotation', time_key='Time point', lineage_key='clone_idx', key_added='fate_counts', return_dfs=False)

Count fate values.

larry._tools.to_AnnDataset(adata: anndata.AnnData, use_key: str = 'X_pca', groupby: str = 'Time point', obs_keys: List[str] = None, attr_names: {'obs': List[str], 'aux': List[str]} = {'obs': [], 'aux': []}, one_hot: List[bool] = False, aux_keys: Union[List[str], NoneType] = None, silent: bool = False, sampling_weight_key: Union[str, NoneType] = None)
larry._tools.fetch_fate_bias_data()
larry._tools.annotate_clone_idx_in_obs(adata, clonal_matrix_key='X_clone', key_added='clone_idx')

Annotate clonal indices in the adata.obs table from adata.obsm clone matrix.

adata

type: anndata.AnnData

clonal_matrix_key

type: str default: “X_clone”

key_added

type: str default: “clone_idx”

None

Updates adata

larry._tools.subset_clonal(adata: anndata.AnnData, lineage_key: str = 'clone_idx')
adata

type: anndata.AnnData

lineage_key

type: str default: “clone_idx”

clonal_adata