spicy: Performs spatial tests on spatial cytometry data.

View source: R/spicy.R

SpicyResults-classR Documentation

Performs spatial tests on spatial cytometry data.

Description

Performs spatial tests on spatial cytometry data.

Usage

spicy(
  cells,
  condition = NULL,
  subject = NULL,
  covariates = NULL,
  from = NULL,
  to = NULL,
  dist = NULL,
  integrate = TRUE,
  nsim = NULL,
  verbose = TRUE,
  weights = TRUE,
  weightsByPair = FALSE,
  weightFactor = 1,
  window = "convex",
  window.length = NULL,
  BPPARAM = BiocParallel::SerialParam(),
  sigma = NULL,
  Rs = NULL,
  minLambda = 0.05,
  fast = TRUE,
  edgeCorrect = TRUE,
  includeZeroCells = FALSE,
  imageID = "imageID",
  cellType = "cellType",
  spatialCoords = c("x", "y"),
  ...
)

Arguments

cells

A SegmentedCells or data frame that contains at least the variables x and y, giving the location coordinates of each cell, and cellType.

condition

Vector of conditions to be tested corresponding to each image if cells is a data frame.

subject

Vector of subject IDs corresponding to each image if cells is a data frame.

covariates

Vector of covariate names that should be included in the mixed effects model as fixed effects.

from

vector of cell types which you would like to compare to the to vector

to

vector of cell types which you would like to compare to the from vector

dist

The distance at which the statistic is obtained.

integrate

Should the statistic be the integral from 0 to dist, or the value of the L curve at dist.

nsim

Number of simulations to perform. If empty, the p-value from lmerTest is used.

verbose

logical indicating whether to output messages.

weights

logical indicating whether to include weights based on cell counts.

weightsByPair

logical indicating whether weights should be calculated for each cell type pair.

weightFactor

numeric that controls the convexity of the weight function.

window

Should the window around the regions be 'square', 'convex' or 'concave'.

window.length

A tuning parameter for controlling the level of concavity when estimating concave windows.

BPPARAM

A BiocParallelParam object.

sigma

A numeric variable used for scaling when fitting inhomogeneous L-curves.

Rs

A vector of the radii that the measures of association should be calculated.

minLambda

Minimum value for density for scaling when fitting inhomogeneous L-curves.

fast

A logical describing whether to use a fast approximation of the inhomogeneous L-curves.

edgeCorrect

A logical indicating whether to perform edge correction.

includeZeroCells

A logical indicating whether to include cells with zero counts in the pairwise association calculation.

imageID

The image ID if using SingleCellExperiment.

cellType

The cell type if using SingleCellExperiment.

spatialCoords

The spatial coordinates if using a SingleCellExperiment.

...

Other options to pass to bootstrap.

Value

Data frame of p-values.

Examples

data("diabetesData")

# Test with random effect for patient on only one pairwise combination of cell types.
spicy(diabetesData, condition = "stage", subject = "case", 
      from = "Tc", to = "Th")

# Test all pairwise combination of cell types without random effect of patient.
#spicyTest <- spicy(diabetesData, condition = "stage", subject = "case")

# Test all pairwise combination of cell types with random effect of patient.
#spicy(diabetesData, condition = "condition", subject = "subject")

# Test all pairwise combination of cell types with random effect of patient using 
# a bootstrap to calculate significance.
#spicy(diabetesData, condition = "stage", subject = "case", nsim = 10000)


ellispatrick/spicyR documentation built on Nov. 22, 2022, 10:45 p.m.