geomxBatchCorrection: Batch correction for GeoMX data

geomxBatchCorrectionR Documentation

Batch correction for GeoMX data

Description

Batch correction for GeoMX data

Usage

geomxBatchCorrection(
  spe,
  k,
  factors,
  NCGs,
  n_assay = 2,
  batch = NULL,
  batch2 = NULL,
  covariates = NULL,
  design = matrix(1, ncol(spe), 1),
  method = c("RUV4", "Limma", "RUVg"),
  isLog = TRUE
)

Arguments

spe

A Spatial Experiment object.

k

The number of unwanted factors to use. Can be 0. This is required for the RUV4 method.

factors

Column name(s) to indicate the factors of interest. This is required for the RUV4 method.

NCGs

Negative control genes. This is required for the RUV4 method.

n_assay

Integer to indicate the nth count table in the assay(spe) to be used.

batch

A vector indicating batches. This is required for the Limma method.

batch2

A vector indicating the second series of batches. This is specific for the Limma method.

covariates

A matrix or vector of numeric covariates to be adjusted for.

design

A design matrix relating to treatment conditions to be preserved, can be generated using stats::model.matrix function with all biological factors included.

method

Can be either RUV4 or Limma or RUVg, by default is RUV4.

isLog

Logical vector, indicating if the count table is log or not.

Value

A Spatial Experiment object, containing the normalized count and normalization factor. For method RUV4 and RUVg, the W matrices will be saved in the colData of the object.

Note

The normalised count is not intended to be used directly for linear modelling. For linear modelling, it is better to include the batch factors/W matrices in the linear model.

References

Gagnon-Bartsch, J. A., Jacob, L., & Speed, T. P. (2013). Removing unwanted variation from high dimensional data with negative controls. Berkeley: Tech Reports from Dep Stat Univ California, 1-112.

Ritchie, M. E., Phipson, B., Wu, D. I., Hu, Y., Law, C. W., Shi, W., & Smyth, G. K. (2015). limma powers differential expression analyses for RNA-sequencing and microarray studies. Nucleic acids research, 43(7), e47-e47.

Examples

data("dkd_spe_subset")
spe <- findNCGs(dkd_spe_subset, top_n = 100)
spe_ruv <- geomxBatchCorrection(spe,
  k = 3,
  factors = c("disease_status", "region"),
  NCGs = S4Vectors::metadata(spe)$NCGs
)


DavisLaboratory/standR documentation built on March 28, 2024, 4:23 a.m.