API#
Import HoloNet as
import HoloNet as hn
Preprocessing: pp#
Import spatial transcriptomic data into AnnData.
Extract and filter the ligand-receptor pair dataframe
Load the example dataset |
|
|
Load the provided dataframe with the information on ligands and receptors. |
|
Filter the dataframe with pairwise ligand and receptor gene, requiring ligand and receptor genes to be expressed in a certain percentage of cells (or spots). |
Tools: tl#
Some tool functions.
Constructing multi-view CE network#
Calculate the expression of elements, including ligand, receptor, co_and_receptor, AG and AN. |
|
|
Calculate CE matrix for measuring the strength of communication between any pairs of cells, according to the edge weighting function. |
|
Filter the edge in calculated CE tensor, removing the edges with low specificities. |
Computing centralities#
Calculate the eigenvector centrality of each cell in the CE network. |
|
|
Calculate the degree centrality of each cell in the CE network. |
Clustering lr pairs#
|
Cluster the LR pairs using the CE network. |
Selecting parameters#
|
Calculate a recommended value for the distance parameter in the edge weighting function. |
Predicting: pr#
Preparing the inputs of the graph neural network#
|
Get continuous cell-type information matrix, used as the feature matrix of GNN. |
|
Get categorical cell-type labels and one-hot encoded into a matrix, used as the feature matrix of GNN. |
|
Filter out the genes with too low expression levels or too low dispersions. |
|
Get a cell_num*1 tensor representing the scaled expression profile of one gene, using as the target of GNN. |
|
Process the relationship among cells (such as multi-view CE network or spatial proximity matrix) to form the normalized adjancency matrix as the input of GNN. |
Training the graph neural network#
|
Using cell-type tensor and normalized adjancency matrix as the inputs, repeated training GNN to generate the target gene expression. |
|
Run the trained MGC model and get the generated expression profile of the target gene. |
|
Using cell-type tensor and normalized adjancency matrix as the inputs, repeated training GNN to generate the expression of multiple target genes. |
|
Run the trained MGC model and get the generated expression profile of target genes. |
Model saving and loading#
|
Save the trained model list in model_save_folder/project_name/target_gene_name_list |
|
Load trained model list in model_save_folder/project_name/ |
Plotting: pl#
Base plotting methods#
|
Plot one feature of each cell at the spatial position. |
|
Plot the relationship network (CEs or FCEs) between cell-types. |
Plots for spatial datasets#
|
Plot the proportion of one cell-type in each spot. |
Plotting CEs#
|
Plot the centrality of each spot in one LR CE network, representing the hotspot of one LR pair. |
|
Plot the cell-type-level CE network of a certain LR pair. |
|
Display the LR pair in low-dimention space. |
|
Plot dendrogram plot for the hierarchical clustering model. |
|
Plot the general CE hotspot of each ligand-receptor group. |
Plotting FCEs by interpreting the graph neural network#
|
Analyze the MGC attention value corresponding to each LR pair, and plot the LR pairs serving as the core mediators of FCEs. |
|
Display the cell-type-level FCE network of a certain LR pair (or all LR pairs) for a certain target gene. |
|
Plotting the proportion of delta_e in the sum of delta_e and e_0 in each cell-type. |
|
Plot the generated expression profile of the target gene. |
Plots for identifying genes dominated by cell–cell communication#
|
Plot the correlation of MGC model results with ground truth, and the results of model only using cell-type with ground truth. |
|
Plotting Heatmaps for specific pathway related genes, and which ligand receptors affect these genes, and these FCEs come from which cell types. |
Plots for selecting parameters#
|
Plot the covering spatial region of ligands derived from one spot. |