Skip to contents

Method-specific implementation used by RunProportionTest when proportion_method = "milo". The function always returns a group-level summary and additionally stores a neighborhood-level result list under neighborhood_results. The group summary uses sample-level cell-type proportions; its p-values are not Milo neighborhood test p-values. Neighborhood results use the Milo test and SpatialFDR as their standardized FDR.

Usage

RunMilo(
  object,
  group.by,
  split.by,
  sample.by,
  comparison = NULL,
  milo_k = 20L,
  milo_d = 30L,
  reduction = NULL,
  backend = c("r", "cpp"),
  n_bootstrap = 500,
  seed = 11,
  verbose = TRUE,
  srt = NULL
)

Arguments

object

A Seurat object.

group.by

Metadata column(s) used to color cells.

split.by

Metadata column that identifies the condition groups to compare. For sample-level methods, if split.by is omitted and sample.by is provided, sample.by is treated as the condition column; a separate biological sample column is still required unless descriptive virtual samples are explicitly enabled.

sample.by

Metadata column identifying biological samples. Required when calling RunMilo() directly. Fully paired sample IDs across two conditions are supported; partially paired comparisons are rejected.

comparison

Optional pairs of condition labels. Each pair is c(group1, group2). obs_log2FD is log2(group1 / group2), matching RunDEtest / Seurat ident.1 vs ident.2: positive values mean the cell type is more abundant in group1. If NULL, all pairwise comparisons are generated in both directions.

milo_k

Number of nearest neighbors used for Milo graph building.

milo_d

Number of dimensions used by Milo.

reduction

Dimensional reduction used for Milo graph construction. If NULL, the default PCA-like reduction is used.

backend

Backend used to compute Milo neighborhoods and tests. "r" calls the upstream miloR implementation. "cpp" uses native scop graph/neighborhood/counting kernels and keeps edgeR for the neighborhood-level quasi-likelihood test.

n_bootstrap

Number of bootstrap iterations used by the group-level summary.

seed

Random seed, including for permutation testing.

verbose

Whether to print the message. Default is TRUE.

srt

Deprecated alias for object; supply exactly one of the two. It will be removed in scop 1.0.0.

Value

A method result bundle used internally by RunProportionTest.