Create Binary Simplex (Ended Line) Plot#
plot_binary shows cell similarity in a binary simplex (1-simplex, ended line). The closer a dot, a cell, is to one vertex, the more similar the cell is to the cell cluster(s) the vertex represents. We recommend that users select the top marker genes for each terminal and only use them as the features for calculating the similarity.
import CytoSimplex as csx
import scanpy as sc
adata = sc.read(filename='test.h5ad',
backup_url="https://figshare.com/ndownloader/files/41034857")
vertices = {"OS": "Osteoblast_1",
"RE": "Reticular_1"}
selected_genes = csx.select_top_features(adata, cluster_var="cluster", vertices=vertices, n_top=30)
csx.plot_binary(adata, cluster_var="cluster", vertices=vertices, features=selected_genes)
Although a binary simplex is supposed to be in 1D, we expanded the plot into 2D introducing random jittering in the second axis. This way, the dots are not overlapped and the density of the dots can be observed with an additional histogram curve.