API#

coloc module#

Focused on differential co-localization

OvsE_coloc_test

Observed vs Expected log2 ratios filtered by p-value obtained from comparing them against a background distribution

OvsE_coloc_test_adjPval

Observed vs Expected log2 ratios filtered by adjusted p-value from a per-pair background distribution.

cellCatContained

Check if a cell group (niche/type/category) is contained in a cell type pair

colocNW

(Differential) co-localization network

compute_sc_spatial_knn_coloc_matrix

Compute a kNN-based co-localization probability matrix between cell type pairs.

compute_sc_spatial_radius_coloc_matrix

Compute a radius-based co-localization probability matrix between cell type pairs.

diffColoc_test

Differential co-localization test with table of scores and p-values as output

getColocProbs

Vectorized calculation of cell type pair co-localization probabilities per sample (sum across spots of probabilities of each cell type pair being in the same spot)

reshapeColoc

Transforms matrix obtained with getColocProbs into a matrix of CT pairs x samples CTcoloc=previously obtained colocalisation matrix from getColocprobs complete=list with repeated values (ct1_x_ct2 and ct2_x_ct1)

spatialCTPlot

Plot cell types in spatial data (MERFISH / visium slices)

spatialNichePlot

Plot niches in spatial data (MERFISH / visium slices)

spatialSingleCTPlot

Plot a single cell type proportions in spatial data (MERFISH / visium slices)

comm module#

Focused on differential communication

calculate_LR_CT_pair_scores_dir

Get cell communication scores per cell type pair per LR pair by summing that LR pair scores for that cell type pair.

catNW

(Differential) communication network

cellCatContained

Check if a cell group (niche/type/category) is contained in a cell type pair

diffCcommStats

Differential cell communication per LR category (eg: biological process)

getDiffComm

get the differential communication scores for a specific LR category

lr_ctPairScores_perCat_dir

Calculate cell communication scores per ligand category from a database

plotDiffCcommStatsHM

Plot heatmap of differential cell communication statistics

unique

get unique elements in array without re-sorting

tl module#

Helpful tools

PIC_BGdoubletsOEratios

Generate distribution of O/E ratios for colocalization probabilities of cell type pairs in randomly generated doublets (background dist) for tests in PIC-seq data

PIC_BGdoubletsOEratios_parallel

Generate one set of O/E ratios for cell type pair co-localization probabilities from randomly paired single cells.

assign_properties

Assign properties to network g to visualize with gravis interactive networks

cellCatContained

Generate boolean element indicating whether the specified element (cell pair) is contained in a list (category)

cells_niche_colors

Make dataframe of cell types with their corresponding niches and colors

compute_network_stats

Compute standard centrality statistics for a (signed) NetworkX graph.

downsample_class

Reduce the number of elements belonging to target_class by a given factor.

getColocFilter

Get filtering object indicating which cell pairs are differentially co-localized

getExpectedColocProbsFromSCs

Compute the expected co-localization probability of each cell type pair by multiplying cell type proportions derived from single-cell (singlets) data.

get_PIC_BG_OEratios_DF

Generate nreps sets of O/E ratios for cell type pair co-localization probabilities by running PIC_BGdoubletsOEratios_parallel() in parallel.

get_pairCatDFdir

Get dataframe of cell pair to niche pair correspondence

get_spatial_radius_BG_OEratios_DF

Optimized version of get_spatial_radius_BG_OEratios_DF using sparse matrix multiplication.

get_spot_ct_props

Get cell type proportions per spot by summing the probabilities of cells of the same kind in each spot

plot_top_stats

Bar plots of the top nodes by betweenness, PageRank, and signed degree centrality.

processCTKRoutput

Remove suffixes '|L' , '|R' and '|TF' from cell - cell communication (CrossTalkeR) tables

pval_filtered_HMdf

Get dataframe for scores heatmap from dataframe obtained from diffColoc_test()

unique

get unique elements in array without re-sorting

niche_stats module#

Tools to test and visualize the internal cohesion of each niche relative to its cross-niche connections

community_edge_stats

Per-community positive/negative edge count and weight statistics.

community_edge_stats_df

Flat DataFrame version of community_edge_stats().

community_edge_weight_distributions

Raw edge weight lists per community, split by location and sign.

community_signed_weight_distributions

Combine positive and negative weights into a single signed distribution.

pairwise_ranksums_int_ext

Wilcoxon rank-sum test comparing internal vs external edge weight distributions for each community, with multiple-testing correction.

plot_internal_external_boxplots

Box plots of signed edge weights (internal vs external) per community.

sankey_plot module#

Biological process specific sankey plots

plot_custom_sankey

Flat 2D Sankey diagram of ligand-receptor interactions from pyCrossTalkeR results.