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_brca_visium_10x()

Load the example dataset

load_lr_df([human_or_mouse])

Load the provided dataframe with the information on ligands and receptors.

get_expressed_lr_df(interaction_db, ...[, ...])

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#

elements_expr_df_calculate(...)

Calculate the expression of elements, including ligand, receptor, co_and_receptor, AG and AN.

compute_ce_tensor(used_interaction_db, ...)

Calculate CE matrix for measuring the strength of communication between any pairs of cells, according to the edge weighting function.

filter_ce_tensor(ce_tensor, adata, lr_df, ...)

Filter the edge in calculated CE tensor, removing the edges with low specificities.

Computing centralities#

compute_ce_network_eigenvector_centrality(...)

Calculate the eigenvector centrality of each cell in the CE network.

compute_ce_network_degree_centrality(ce_tensor)

Calculate the degree centrality of each cell in the CE network.

Clustering lr pairs#

cluster_lr_based_on_ce(ce_tensor, adata, ...)

Cluster the LR pairs using the CE network.

Selecting parameters#

default_w_visium(adata[, min_cell_distance, ...])

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_tensor(adata[, ...])

Get continuous cell-type information matrix, used as the feature matrix of GNN.

get_one_hot_cell_type_tensor(adata[, ...])

Get categorical cell-type labels and one-hot encoded into a matrix, used as the feature matrix of GNN.

get_gene_expr(adata[, lr_df, complex_db, ...])

Filter out the genes with too low expression levels or too low dispersions.

get_one_case_expr(target_all_expr, ...)

Get a cell_num*1 tensor representing the scaled expression profile of one gene, using as the target of GNN.

adj_normalize(adj, cell_type_tensor[, ...])

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#

mgc_repeat_training(X, adj, target[, ...])

Using cell-type tensor and normalized adjancency matrix as the inputs, repeated training GNN to generate the target gene expression.

get_mgc_result(trained_MGC_model_list, X, adj)

Run the trained MGC model and get the generated expression profile of the target gene.

mgc_training_for_multiple_targets(X, adj, ...)

Using cell-type tensor and normalized adjancency matrix as the inputs, repeated training GNN to generate the expression of multiple target genes.

get_mgc_result_for_multiple_targets(...[, ...])

Run the trained MGC model and get the generated expression profile of target genes.

Model saving and loading#

save_model_list(trained_MGC_model_list, ...)

Save the trained model list in model_save_folder/project_name/target_gene_name_list

load_model_list(X, adj, project_name[, ...])

Load trained model list in model_save_folder/project_name/

Plotting: pl#

Base plotting methods#

feature_plot(feature_mat, adata, ...[, ...])

Plot one feature of each cell at the spatial position.

cell_type_level_network(sr_network, ...[, ...])

Plot the relationship network (CEs or FCEs) between cell-types.

Plots for spatial datasets#

plot_cell_type_proportion(adata, plot_cell_type)

Plot the proportion of one cell-type in each spot.

Plotting CEs#

ce_hotspot_plot(ce_tensor, adata, lr_df, plot_lr)

Plot the centrality of each spot in one LR CE network, representing the hotspot of one LR pair.

ce_cell_type_network_plot(ce_tensor, ...[, ...])

Plot the cell-type-level CE network of a certain LR pair.

lr_umap(lr_df, cell_cci_centrality[, ...])

Display the LR pair in low-dimention space.

lr_clustering_dendrogram(model, lr_df[, ...])

Plot dendrogram plot for the hierarchical clustering model.

lr_cluster_ce_hotspot_plot(lr_df, ...[, ...])

Plot the general CE hotspot of each ligand-receptor group.

Plotting FCEs by interpreting the graph neural network#

lr_rank_in_mgc(trained_MGC_model_list, lr_df)

Analyze the MGC attention value corresponding to each LR pair, and plot the LR pairs serving as the core mediators of FCEs.

fce_cell_type_network_plot(...[, ...])

Display the cell-type-level FCE network of a certain LR pair (or all LR pairs) for a certain target gene.

delta_e_proportion(trained_MGC_model_list, ...)

Plotting the proportion of delta_e in the sum of delta_e and e_0 in each cell-type.

plot_mgc_result(trained_MGC_model_list, ...)

Plot the generated expression profile of the target gene.

Plots for identifying genes dominated by cell–cell communication#

find_genes_linked_to_ce(...[, ...])

Plot the correlation of MGC model results with ground truth, and the results of model only using cell-type with ground truth.

detect_pathway_related_genes(...[, fname, ...])

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#

select_w(adata, w_best[, size, alpha, cmap, ...])

Plot the covering spatial region of ligands derived from one spot.