API

crosschat.CrossChatH module

class crosschat.CrossChatH.CrossChatH(adata, species='human', user_comm_ids=None)

Bases: object

Cluster_LRs(LR_ls)

Cluster specific ligand-receptor pairs

Params

LR_ls is the list of ligand-receptor pairs to be clustered

Returns

clustering of ligand-receptor pairs

Cluster_pathways(nclusters=3)

Cluster active CCC pathways

Params

nclusters is the desired number of clusters of pathways

Returns

visualiztion of active CCC pathways after clustering

Detect_active_pathways()

Detect active CCC pathways

Returns

active pathways involved in CCC

Detect_specific_LRs(topN=20)

Detect specific ligands and receptors

Params

topN is the desired number of specific ligand-receptor pairs

Returns

list of specific ligand-receptor pairs

Draw_CCC(pathway, CCC_threshold=0.4, save=None)

Draw CCC between hierarchical clusters

Params

pathway is the pathway to visualize

Params

CCC_threshold is the threshold of CCC strengths to be visualized

Returns

visualization of hierarchical CCC

Draw_CCC_LR(ligand, receptor, CCC_threshold=0.4)

Draw_CCC_LR draws the CCC between a pair of ligand and receptor between ligand clustering and receptor clustering

Params

ligand/receptor is a list of ligands/receptors

Params

CCC_threshold is the threshold of CCC, interactions with strength below it are filtered

Returns

visualization of CCC

Draw_annotations_umap()

Draw umap of cell type annotations

Returns

multiscale umap

Draw_multiscale_umap(cluster_input='allgenes', spatial=False, save=None)

Draw umap of hierarchical clustering

Params

cluster_input is the input user wants to use for drawing umap. It can be “allgenes”,”L”,”R”, or “userinput”

Returns

multiscale umap

Multsicale_clustering(cluster_by='allgenes', k=15)

Runs multiscale clustering on cells based on either allgenes, or ligands, or receptors

Params

cluster_by is the genes that user want to use to cluster, either “allgenes” or “lr”

Params

k: value of k in knn

Returns

CrossChatH object after multiscale clustering

Multsicale_clustering_spatial(cluster_by='allgenes', k=15, w=0.5)

Runs multiscale clustering on spatial data based on either allgenes, or ligands, or receptors

Params

cluster_by is the genes that user want to use to cluster, either “allgenes” or “lr”

Params

k is value of k in knn

Params

w is the weight

Returns

CrossChatH object after multiscale clustering

jaccard_dist(comm_ids, celltype_annotations, save=False)
prepare_adata(normalize=False, scale=False, input='allgenes')

Prepares the CrossChatH object

Params

normalize is True if data needs to be normalized

Params

scale is True if data needs to be scaled

Params

input is allgenes if use all genes

Returns

the CrossChatH object

select_partitions(max_nvi=0.1, window_size=15, basin_radius=15, lr='L')

Select the desired hierarchical clustering

Params

lr is “L” (ligand) or “R” (receptor)

Returns

CrossChatH object after selecting partitions

crosschat.CrossChatT module

class crosschat.CrossChatT.CrossChatT(adata, species='human')

Bases: object

Binarization(threshold=0)

Binarizes the input gene expression matrix

Params

threshold is the cutoff percentage to throw out the cells with lowest gene expression according to the threshold

Returns

the CrossChatT object after binarization

Detect_trees(type='l', remove_cells_prop=0.9, support_size_threshold=30, inclusive_threshold=0.9, disjoint_threshold=0.95, tree_size=4, tree_scales=3)

Detect trees involved in CCC in scRNA-seq data.

Params

type is either “l” (ligand) or “r” (receptor)

Params

remove_cells_prop keeps genes that are present in more than the proportion of cells

Params

support_size_threshold keeps genes that are present in more than support_size_threshold cells

Params

tree_size is the threshold of number of nodes in the tree

Params

tree_scales is the number of levels in the tree

Returns

the CrossChatT object with detected trees

Detect_trees_S(spatial_range=300, type='l', remove_cells_prop=0.9, support_size_threshold=30, inclusive_threshold=0.9, disjoint_threshold=0.95, tree_size=4, tree_scales=3)

Detect trees involved in CCC in spatial data.

Params

type is either “l” (ligand) or “r” (receptor)

Params

remove_cells_prop keeps genes that are present in more than the proportion of cells

Params

support_size_threshold keeps genes that are present in more than support_size_threshold cells

Params

tree_size is the threshold of number of nodes in the tree

Params

tree_scales is the number of levels in the tree

Returns

the CrossChatT object with detected trees

Draw_CCC_between_MMT(lr_tree_inds)

Visualize CCC detected between trees

Params

lr_tree_inds is the index of ligand/receptor trees

Returns

the visualization of CCC between detected trees

Draw_MMT(type='l', tree_inds=None, nodesize=20)

Visualize detected trees

Params

type is either “l” or “r”

Params

tree_inds is the index of tree in all detected trees

Returns

the visualization of detected trees

Draw_MMT_lr_union(tree_inds=None)

Visualize detected trees with lr_union as input

Params

tree_inds is the index of tree in all detected trees

Returns

the visualization of detected trees

Draw_annotations_umap()

Draw umap of cell type annotations

Returns

multiscale umap

Draw_big_tree(type='l', tree_inds=None)

Draw union of trees

Params

type is the type of ligands or receptors

Params

tree_inds is the list of indices for the set of trees user is interested in

Returns

the visualization of frequency of ligand/receptor occurrence in ligands/receptors trees

find_interacting_trees(num_ligand_trees=10, num_receptor_trees=10, num_interation_threshold=1)

Obtain the pairs of interacting trees

Params

num_ligand_trees is the number of top detected ligand trees that user is interested

Params

num_receptor_trees is the number of top detected receptor trees that user is interested

Params

number_interaction_threshold is the threshold of CCC strength

Returns

the list of interacting trees

plot_lr_frequency(type='l')

Plot frequency of ligand/receptor occurrence in ligands/receptors trees

Params

type is the type of ligands or receptors

Returns

the visualization of frequency of ligand/receptor occurrence in ligands/receptors trees

prepare_adata(normalize=False, scale=False, input='allgenes')

Prepares the CrossChatT object.

Params

normalize is True if data needs to be normalized

Params

scale is True if data needs to be scaled

Params

input is allgenes if use all genes

Returns

the CrossChatH object