contrast_names_to_sedesign: Convert contrast names to sedesign object

contrast_names_to_sedesignR Documentation

Convert contrast names to sedesign object

Description

Convert contrast names to sedesign object

Usage

contrast_names_to_sedesign(
  contrast_names,
  factor_sep = "_",
  contrast_sep = "-",
  ...
)

Arguments

contrast_names

character vector of contrast names where factors are separated by factor_sep and contrasts are separated by contrast_sep.

factor_sep, contrast_sep

character strings used as delimiters between factors and contrasts, respectively.

...

additional arguments are ignored.

Details

This function is a convenience function intended only to convert a vector of contrast names into sedesign format for use in other functions. It assumes only one sample replicate per group for this purpose.

One utility of this function is to convert two-way contrast names into a contrast matrix, to test whether the contrast defined is equivalent for the two names.

Value

sedesign object, or if the input contrast_names contain mixed number of factors per contrast, the output is split into a list of sedesign objects based upon the number of factors.

Examples

contrast_names_3fac <- c(
   "(CellA_Treated-CellA_Control)-(CellB_Treated-CellB_Control)",
   "(CellA_Treated-CellB_Treated)-(CellA_Control-CellB_Control)")
contrast_names_to_sedesign(contrast_names_3fac)

contrast_names_3way <- c(
   paste0("((CellA_Treated_Mut-CellB_Treated_Mut)-",
      "(CellA_Control_Mut-CellB_Control_Mut))-",
      "((CellA_Treated_WT-CellB_Treated_WT)-",
      "(CellA_Control_WT-CellB_Control_WT))"),
   paste0("((CellA_Treated_Mut-CellA_Control_Mut)-",
      "(CellB_Treated_Mut-CellB_Control_Mut))-",
      "((CellA_Treated_WT-CellA_Control_WT)-",
      "(CellB_Treated_WT-CellB_Control_WT))"))
contrast_names_to_sedesign(contrast_names_3way)


jmw86069/jamses documentation built on May 31, 2024, 1:36 p.m.