Load Data

RNA-seq data

Expression matrix was obtained from: https://cells.ucsc.edu/autism/exprMatrix.tsv.gz
Values are 10x UMI counts from cellranger, log2-transformed

Metadata was obtained from: https://cells.ucsc.edu/autism/meta.tsv

Ligand-Receptor pairs

Data Preprocessing

LR pairs

Remove bidirectionality in the list of ligand-receptor pairs. That is, remove repeated interactions where both interactions are the same but in different order:

From this list:

Ligand Receptor
Protein A Protein B
Protein B Protein A

We will have:

Ligand Receptor
Protein A Protein B

Generate a dictionary with function info for each LR pairs. Keys are LIGAND_NAME^RECEPTOR_NAME and values are the function in the annotation column in the dataframe containing ligand-receptor pairs.

Convert interactions from ensembl to symbol

RNA-seq

Organize data to create tensor

First, generate a dictionary indicating what condition is associated to each sample

Generate list of RNA-seq data containing all contexts (samples)

Tensor-cell2cell Analysis

Build 4D-Communication Tensor

how='inner' is used to keep only cell types and genes that are across all contexts.

complex_sep='&' is used to specify that the list of ligand-receptor pairs contains protein complexes and that subunits are separated by '&'. If the list does not have complexes, use complex_sep=None instead.

Generate a list containing metadata for each tensor order/dimension - Later used for coloring factor plots

Run Analysis

Elbow analysis for selecting the number of factors to use

Perform tensor factorization

Plot factor loadings

Top-5 LR pairs

Export Loadings

Downstream Analyses

Boxplots to compare group of samples

Generate factor-specific networks

Generate matrix of cell-cell pairs by factors

Select cell-cell pairs with high potential of interaction

Visualize networks of factors with significant differences between groups

 Clustermaps

Cluster cell-cell pairs by their potential across factors

Cluster LR pairs by their importance across factors

Cluster samples by their importance across factors

Evaluate Clinical Scores in each cluster

GSEA

Pathways of both ligand and receptor

Adjust P-values across all factors (GSEA only adjusts within factor)

Enriched LR pairs

Depleted LR pairs

Visualization

DataFrame

Dot Plot