subtract_baseline: Subtract baseline

View source: R/6_transform.R

subtract_baselineR Documentation

Subtract baseline

Description

Subtract baseline level within block

Usage

subtract_baseline(
  object,
  subgroupvar,
  subgroupctr = slevels(object, subgroupvar)[1],
  block = NULL,
  assaynames = setdiff(assayNames(object), c("weights", "pepcounts")),
  verbose = TRUE
)

subtract_pairs(
  object,
  subgroupvar = "subgroup",
  subgroupctr = slevels(object, subgroupvar)[1],
  block,
  assaynames = assayNames(object)[1],
  verbose = TRUE
)

subtract_differences(object, block, subgroupvar, verbose = TRUE)

Arguments

object

SummarizedExperiment

subgroupvar

subgroup svar

subgroupctr

control subgroup

block

block svar (within which subtraction is performed)

assaynames

which assays to subtract for

verbose

TRUE/FALSE

Details

subtract_baseline subtracts baseline levels within block, using the medoid baseline sample if multiple exist.

subtract_pairs also subtracts baseline level within block. It cannot handle multiple baseline samples, but has instead been optimized for many blocks

subtract_differences subtracts differences between subsequent levels, again within block

Value

SummarizedExperiment

Examples

# read 
    file <- system.file('extdata/atkin.metabolon.xlsx', package = 'autonomics')
    object0 <- read_metabolon(file)
    pca(object0, plot = TRUE, color = 'Time')

# subtract_baseline: takes medoid of baseline samples if multiple
    object <- subtract_baseline(object0, block = 'Subject', subgroupvar = 'Time')
    pca(object, plot = TRUE, color = 'Time')

# subtract_pairs: optimized for many blocks
    object <- subtract_pairs(object0, block = 'Subject', subgroupvar = 'Time')
    pca(object, plot = TRUE, color = 'Time')

# subtract_differences
    object <- subtract_differences(object0, block = 'Subject', subgroupvar = 'Time')
    values(object) %<>% na_to_zero()
    pca(object, plot = TRUE, color = 'Time')

bhagwataditya/autonomics documentation built on Nov. 1, 2024, 5:47 a.m.