stt.tl submodule
Module contents (Calling by stt.tl.function_name)
- stt.tl._dynamical_analysis.dynamical_iteration(adata, n_states=None, n_states_seq=None, n_iter=10, return_aggr_obj=True, weight_connectivities=0.2, n_components=20, n_neighbors=100, thresh_ms_gene=0, thresh_entropy=0.1, use_spatial=False, spa_weight=0.5, spa_conn_key='spatial', monitor_mode=False, l2=0.1)
Perform dynamical iteration on the given AnnData object. The function updates the attractor states, the tensor, the averaged velocity, and the entropy at each iteration.
Parameters:
- adata: AnnData object
Annotated data matrix.
- n_states: int, optional (default: None)
Number of attractor states.
- n_states_seq: list, optional (default: None)
List of number of attractor states for each iteration.
- n_iter: int, optional (default: 10)
Number of iterations.
- return_aggr_obj: bool, optional (default: False)
Whether to return the aggregated object.
- weight_connectivities: float, optional (default: 0.2)
Weight of connectivities.
- n_components: int, optional (default: 20)
Number of components.
- n_neighbors: int, optional (default: 100)
Number of neighbors.
- thresh_ms_gene: int, optional (default: 0)
Threshold for mean spliced gene expression.
- thresh_entropy: float, optional (default: 0.1)
Threshold for entropy.
- use_spatial: bool, optional (default: False)
Whether to use spatial information.
- spa_weight: float, optional (default: 0.5)
Weight of spatial information.
- spa_conn_key: str, optional (default: ‘spatial’)
Key for spatial connectivities.
- stop_cr: str, optional (default: ‘abs’)
Stopping criterion for iteration.
- monitor_mode: bool, optional (default: False)
Whether to use monitor mode.
- l2: float, optional (default: 0.1)
Regularization parameter in tensor estimation.
Returns:
Default none, but updates the adata.uns with the following keys: da_out: dict
Dictionary of the results of dynamical analysis.
- gene_subset: list
List of selected multi-stable genes.
- entropy: np.ndarray
Array of entropy values.
- speed: np.ndarray
Array of speed values.
- attractor: np.ndarray
Array of attractor states.
- tensor_v_aver: np.ndarray
Array of averaged tensor by attractor membership of cells.
If return_aggr_obj is True, the aggregated object with both spliced and unspliced counts of multi-stable genes is returned.
- stt.tl._construct_landscape.construct_landscape(sc_object, thresh_cal_cov=0.3, scale_axis=1.0, scale_land=1.1, N_grid=100, coord_key='X_umap')
Function to construct the landscape of the multi-stable attractors
- Parameters
sc_object (AnnData object) – Single cell data object
thresh_cal_cov (float) – Threshold to calculate the covariance matrix
scale_axis (float) – Scaling factor for the axis
scale_land (float) – Scaling factor for the landscape
N_grid (int) – Number of grid points for the landscape
coord_key (str) – Key of the coordinates in the sc_object.obsm
- Returns
None, but updates the sc_object.uns with the following keys
land_out (dict) – Dictionary of landscape values and grid points
- stt.tl._pathway_analysis.compute_pathway(adata, adata_aggr, db_name, gene_num=3)
Compute tensor similarities among pathways
- Parameters
adata (AnnData) – Annotated data matrix
adata_aggr (AnnData) – Aggregated data matrix
db_name (str) – Name of the database
gene_num (int) – Minimum number of genes in the pathway overlapped with STT multi-stable genes
- Returns
None, but updates adata.uns with the following
pathway_select (dict) – Selected pathways satisfying the gene_num condition
pathway_embedding (np.ndarray) – UMAP embedding of the pathway similarities
pathway_labels (np.ndarray) – Cluster labels of the pathway embedding