smoother.visualization
Visualization functions for smoother.models.deconv
Functions
|
Plot the deconvolution results. |
|
Apply centre log ratio transform (clr) to transform proportions to the real space. |
|
Apply isometric log ratio transformation (ilr) to transform proportions to the real space. |
|
Leiden clustering on the input features. |
|
Helper function to get the cost matrix for aligning two clusterings. |
|
Align the clusterings in clu_list to the reference clustering. |
|
Plot clusters. |
|
Cluster the cell-type proportions and visualize the results. |
Module Contents
- smoother.visualization.plot_celltype_props(p_inf, coords, cell_type_names=None, n_col=4, figsize=None)
Plot the deconvolution results.
- Parameters:
p_inf – n_spots x n_groups. The inferred cell-type proportions.
coords – n_spots x 2. The coordinates of the spots.
cell_type_names – list of str. The names of the cell types.
n_col – int. The number of columns in the figure.
figsize – tuple. The size of the figure.
- smoother.visualization.clr_stable(props, epsilon=1e-08)
Apply centre log ratio transform (clr) to transform proportions to the real space.
- Parameters:
props – n_spots x n_groups. Rowsum equals to 1 or 0. If 0, the transformed vector will also be the zero vector.
- smoother.visualization.ilr_stable(props, epsilon=1e-08)
Apply isometric log ratio transformation (ilr) to transform proportions to the real space.
- smoother.visualization.cluster_features(features, transform='pca', n_neighbors=15, res=1) pandas.Series
Leiden clustering on the input features.
- smoother.visualization._get_cost_matrix(clu1, clu2)
Helper function to get the cost matrix for aligning two clusterings.
- smoother.visualization.align_clusters(clu_list, ref_ind=None)
Align the clusterings in clu_list to the reference clustering.
- Parameters:
clu_list – list of clustering result.
ref_ind – int. The index of the reference clustering. If None, use the clustering with the largest number of clusters.
- smoother.visualization.plot_spatial_clusters(clu_aligned_list, coords, names=None, n_col=4)
Plot clusters.
- Parameters:
clu_aligned_list – list of aligned clusterings.
coords – n_spots x 2. Coordinates of the spots.
names – list of str. Names of the deconvolution model.
n_col – int. Number of columns in the plot.
- smoother.visualization.cluster_and_plot_celltype_props(p_inf_list, coords, names=None, n_col=4, transform='pca', n_neighbors=15, res=1, return_clu=False)
Cluster the cell-type proportions and visualize the results.
- Parameters:
p_inf_list – list of cell-type proportions.
coords – n_spots x 2. Coordinates of the spots.
names – list of str. Names of the deconvolution model.
transform – str. Transformation to apply to the cell-type proportions. ‘pca’, ‘clr’, ‘ilr’.
n_neighbors – int. Number of neighbors to use for clustering.
res – float. Resolution for leiden clustering.
return_clu – bool. Whether to return the clustering results.