spicy: Performs spatial tests on spatial cytometry data.

Description Usage Arguments Value Examples

View source: R/spicy.R

Description

Performs spatial tests on spatial cytometry data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
spicy(
  cells,
  condition = NULL,
  subject = NULL,
  covariates = NULL,
  from = NULL,
  to = NULL,
  dist = NULL,
  integrate = TRUE,
  nsim = NULL,
  verbose = TRUE,
  weights = TRUE,
  window = "convex",
  window.length = NULL,
  BPPARAM = BiocParallel::SerialParam(),
  sigma = NULL,
  Rs = NULL,
  minLambda = 0.05,
  fast = TRUE,
  ...
)

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.

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.

...

Other options to pass to bootstrap.

Value

Data frame of p-values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

spicyR documentation built on March 17, 2021, 6:01 p.m.