run_SpaCCI {SpaCCI} | R Documentation |
Run SpaCCI Analysis
Description
This function runs the SpaCCI analysis to infer cell-cell interactions based on ligand-receptor pairs at global, regional, or local spatial scales. It integrates gene expression data, cell type proportions, and spatial coordinates with a user-specified ligand-receptor database.
Usage
run_SpaCCI(
gene_spot_expression_dataframe,
spot_cell_proportion_dataframe,
spatial_coordinates_dataframe,
LR_database_list,
specific_LR_pair = NULL,
analysis_scale,
region_spot_IDs = NULL,
local_scale_proportion = 1,
neighborhood_radius = 2.5
)
Arguments
gene_spot_expression_dataframe |
A data frame of gene expression values, where row names are genes and column names are spot IDs. |
spot_cell_proportion_dataframe |
A data frame of cell type proportions, where row names are spot IDs and column names are cell types. |
spatial_coordinates_dataframe |
A data frame containing the spatial coordinates of the spots. The columns should include |
LR_database_list |
A list containing ligand-receptor pairs and additional information, generated by functions using |
specific_LR_pair |
Required if |
analysis_scale |
A string specifying the scale of analysis: |
region_spot_IDs |
Required if |
local_scale_proportion |
Optional. A numeric value ranging from 0 to 1, (0,1] specifying the proportion of spots to use for localized analysis. Default is |
neighborhood_radius |
Optional. A numeric value specifying the radius of the neighborhood for localized analysis. Default is |
Details
The function supports three scales of analysis:
global
Analyzes interactions across the entire dataset.
regional
Analyzes interactions within a specified region of spots. Requires
region_spot_IDs
.local
Analyzes localized hotspot of interactions for specific ligand-receptor pairs on the entire slides. Requires
specific_LR_pair
.
Value
A list containing:
- If
analysis_scale
is"local"
: -
A list containing:
dataframelist
A list of data frames, each representing the inferred interactions for a specific center spot. Each data frame includes information on ligand and receptor cell types, P-values, and adjusted P-values.
RegionIDs_matrix
A list of matrices, each containing the IDs of the spots within the specified radius of each center spot.
- If
analysis_scale
is"regional"
or"global"
: -
A list containing:
pvalue_df
A data frame of inferred interactions within the specified region or globally, including information on ligand and receptor cell types, P-values, and adjusted P-values.
Examples
library(SpaCCI)
library(nnls)
library(FNN)
library(Matrix)
#Load the example data
data(test_data)
gene_spot_df <- test_data$gene_spot_df
cell_prop_df <- test_data$cell_prop_df
spatial_coords_df <- test_data$spatial_coords_df
result <- LR_database(species = "Human",
database_name = "CellChat",
gene_spot_expression_dataframe = gene_spot_df)
# global
result_global <- run_SpaCCI(gene_spot_expression_dataframe = gene_spot_df,
spot_cell_proportion_dataframe = cell_prop_df,
spatial_coordinates_dataframe = spatial_coords_df,
LR_database_list = result,
analysis_scale = "global")
# local
result_local <- run_SpaCCI(gene_spot_expression_dataframe = gene_spot_df,
spot_cell_proportion_dataframe = cell_prop_df,
spatial_coordinates_dataframe = spatial_coords_df,
LR_database_list = result,
specific_LR_pair = "EDN1_EDNRA",
analysis_scale = "local",
local_scale_proportion = 0.1,
neighborhood_radius = 2.5)