featuremap.core_transition_states
Created on Wed Nov 1 13:52:14 2023
Functions
|
Density estimation for data points specified by X with kernel density estimation. |
|
Plot the density of the embedding space. |
|
Identify the core state and transition state in the embedding space. |
|
Identify the core state and transition state in the embedding space. |
|
Collect the nodes of transition states given the start and end state. |
|
Construct the minimum spanning tree over the tree points. |
|
Compute the pseudotime along the ridge path. |
|
Plot the bifurcation states in the embedding space. |
|
Plot the bifurcation states in the embedding space. |
|
Plot the path states in the embedding space. |
|
Plot the density vs pseudotime. |
|
Compute the betweenness centrality of the cell network. |
|
Compute the curvature of the embedding space. |
|
Given the core and transition states defined by the density, curvature and betweenness centrality, |
|
Compute the cluster state labels based on the percentage of core_states and transition_states for each cluster. |
|
|
|
|
|
|
|
Compute the silhouette score for one node using a shortest path distance matrix. |
|
|
|
Module Contents
- featuremap.core_transition_states.kernel_density_estimate(data, X, bw=0.5, min_radius=5, output_onlylogp=False)[source]
Density estimation for data points specified by X with kernel density estimation.
- Parameters:
data (array of shape (n_samples, n_features)) – 2D array including data points. Input to density estimation.
X (array) – 2D array including multiple data points. Input to density estimation.
output_onlylogp (bool) – If true, returns logp, else returns p, g, h, msu.
- Returns:
p – 1D array. Unnormalized probability density. The probability density is not normalized due to numerical stability. Exact log probability
- Return type:
array
- featuremap.core_transition_states.plot_density(adata: anndata.AnnData, emb='featmap')[source]
Plot the density of the embedding space.
- Parameters:
adata (AnnData) – Annotated data matrix.
emb (str) – The embedding space to plot the density.
- featuremap.core_transition_states.compute_density(adata: anndata.AnnData, emb='featmap', cluster_key='leiden', density_key='density', quantile_core=0.5, quantile_trans=0.2)[source]
Identify the core state and transition state in the embedding space.
- featuremap.core_transition_states.compute_density_0(adata: anndata.AnnData, emb='featmap', cluster_key='leiden', density_key='density', quantile_core=0.5, quantile_trans=0.2)[source]
Identify the core state and transition state in the embedding space.
- featuremap.core_transition_states.nodes_of_transition_states(adata, start_state, end_state, clusters)[source]
Collect the nodes of transition states given the start and end state.
- Parameters:
- Returns:
path_nodes (np.array) – The nodes of the path from start to end state.
path_points_nn (np.array) – The points of the path from start to end state.
end_bridge_points (np.array) – The points of the end bridge.
core_points (np.array) – The points of the core states.
transition_points (np.array) – The points of the transition states.
- featuremap.core_transition_states.mst_subgraph(adata, tree_points, emb='X_featmap')[source]
Construct the minimum spanning tree over the tree points.
- Parameters:
adata
tree_points (np.array) – Points included in the induced subgraph
- Returns:
mst_subg – minimum spanning_tree over tree_points (anchors).
- Return type:
igraph
- featuremap.core_transition_states.ridge_pseudotime(adata, root, plot='featmap')[source]
Compute the pseudotime along the ridge path.
- featuremap.core_transition_states.bifurcation_plot(adata, core_states, transition_states_1, transition_states_2)[source]
Plot the bifurcation states in the embedding space.
- featuremap.core_transition_states.bifurcation_plot_1(adata, core_states, transition_states_1, transition_states_2, transition_states_3)[source]
Plot the bifurcation states in the embedding space.
- featuremap.core_transition_states.path_plot(adata, core_states, transition_states)[source]
Plot the path states in the embedding space.
- featuremap.core_transition_states.plot_density_pseudotime(filtered_data, pseudotime='feat_pseudotime', clusters='clusters', density='density')[source]
Plot the density vs pseudotime.
- featuremap.core_transition_states.compute_betweenness_centrality(adata, emb_featuremap, quantile_trans=0.8, quantile_core=0.2)[source]
Compute the betweenness centrality of the cell network.
- featuremap.core_transition_states.compute_curvature(adata, emb_featuremap, quantile_core=0.2, quantile_trans=0.8)[source]
Compute the curvature of the embedding space.
k = ||d T / d s||
- featuremap.core_transition_states.plot_core_transition_states(adata)[source]
Given the core and transition states defined by the density, curvature and betweenness centrality, union the core and transition states and plot the core and transition states in the embedding space.
- Parameters:
adata (AnnData) – Annotated data matrix.
- featuremap.core_transition_states.compute_cluster_state_labels(adata)[source]
Compute the cluster state labels based on the percentage of core_states and transition_states for each cluster.
- Parameters:
adata (AnnData) – Annotated data matrix.
- featuremap.core_transition_states.silhouette_score_one_point(distances, labels, point_index)[source]
Compute the silhouette score for one node using a shortest path distance matrix.
Parameters: - distances: 2D list or ndarray of shape (n_nodes, n_nodes), shortest path distances between nodes - labels: list or ndarray of shape (n_nodes,) - point_index: int, index of the node for which to compute the silhouette score
Returns: - silhouette score for the given node