% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/modeling.R
\name{computeCommunProb}
\alias{computeCommunProb}
\title{Compute the communication probability/strength between any interacting cell groups}
\usage{
computeCommunProb(
  object,
  type = c("triMean", "truncatedMean", "thresholdedMean", "median"),
  trim = 0.1,
  LR.use = NULL,
  raw.use = TRUE,
  population.size = FALSE,
  distance.use = TRUE,
  interaction.length = 200,
  scale.distance = 0.01,
  k.min = 10,
  nboot = 100,
  seed.use = 1L,
  Kh = 0.5,
  n = 1
)
}
\arguments{
\item{object}{CellChat object}

\item{type}{methods for computing the average gene expression per cell group. By default = "triMean", producing fewer but stronger interactions;
When setting `type = "truncatedMean"`, a value should be assigned to 'trim',  producing more interactions.}

\item{trim}{the fraction (0 to 0.25) of observations to be trimmed from each end of x before the mean is computed}

\item{LR.use}{a subset of ligand-receptor interactions used in inferring communication network}

\item{raw.use}{whether use the raw data (i.e., `object@data.signaling`) or the projected data (i.e., `object@data.project`).
Set raw.use = FALSE to use the projected data when analyzing single-cell data with shallow sequencing depth because the projected data could help to reduce the dropout effects of signaling genes, in particular for possible zero expression of subunits of ligands/receptors.}

\item{population.size}{whether consider the proportion of cells in each group across all sequenced cells.
Set population.size = FALSE if analyzing sorting-enriched single cells, to remove the potential artifact of population size.
Set population.size = TRUE if analyzing unsorted single-cell transcriptomes, with the reason that abundant cell populations tend to send collectively stronger signals than the rare cell populations.

Parameters for spatial data analysis}

\item{distance.use}{whether use distance constraints to compute communication probability.
distance.use = FALSE will only filter out interactions between spatially distant regions, but not add distance constraints.}

\item{interaction.length}{The maximum interaction/diffusion length of ligands (Unit: microns). This hard threshold is used to filter out the connections between spatially distant regions}

\item{scale.distance}{A scale or normalization factor for the spatial distances. This values can be 1, 0.1, 0.01, 0.001. We choose this values such that the minimum value of the scaled distances is in [1,2].

When comparing communication across different CellChat objects, the same scale factor should be used. For a single CellChat analysis, different scale factors will not affect the ranking of the signaling based on their interaction strength.}

\item{k.min}{the minimum number of interacting cell pairs required for defining adjacent cell groups}

\item{nboot}{threshold of p-values}

\item{seed.use}{set a random seed. By default, set the seed to 1.}

\item{Kh}{parameter in Hill function}

\item{n}{parameter in Hill function}
}
\value{
A CellChat object with updated slot 'net':

object@net$prob is the inferred communication probability (strength) array, where the first, second and third dimensions represent a source, target and ligand-receptor pair, respectively.

USER can access all the inferred cell-cell communications using the function 'subsetCommunication(object)', which returns a data frame.

object@net$pval is the corresponding p-values of each interaction
}
\description{
To further speed up on large-scale datasets, USER can downsample the data using the function 'subset' from Seurat package (e.g., pbmc.small <- subset(pbmc, downsample = 500)), or using the function `sketchData` from CellChat, in particular for the large cell clusters;
}
