validate_sedesign: Validate SEDesign object contents

validate_sedesignR Documentation

Validate SEDesign object contents

Description

Validate SEDesign object contents

Usage

validate_sedesign(
  object,
  min_reps = 1,
  samples = NULL,
  groups = NULL,
  contrasts = NULL,
  verbose = FALSE,
  ...
)

Arguments

object

SEDesign object

min_reps

integer indicating the minimum required replicate samples per design group to be used during analysis. Any design groups with fewer replicates will be removed from the design matrix, and subsequently will be removed from the contrasts matrix.

samples, groups, contrasts

character vectors used to subset the samples, groups, or contrasts.

verbose

logical indicating whether to print verbose output, where verbose=TRUE will print messages at the end of operations, and verbose=2 will also print messages during operations.

...

additional arguments are ignored.

Details

This function validates and enforces constraints on SEDesign objects:

  • samples must match rownames(design)

  • colnames(design) must match rownames(contrasts)

If samples does not exist, and rownames(design) does exist, then samples will be defined as rownames(design).

If design and samples are provided, but rownames(design) is empty, it must be the same length as samples. then rownames(design) will be defined as samples.

Value

SEDesign object after validation updates have been applied.

See Also

Other jam experiment design: check_sedesign(), contrast2comp(), contrast_colors_by_group(), contrast_names_to_sedesign(), contrasts_to_factors(), contrasts_to_venn_setlists(), draw_oneway_contrast(), draw_twoway_contrast(), filter_contrast_names(), groups_to_sedesign(), plot_sedesign(), sedesign_to_factors()

Examples

factors2 <- rep(c("one", "two", "three", "four"), each=3)
factors2 <- factor(factors2,
   levels=unique(factors2))
names(factors2) <- paste0("sample", seq_along(factors2))
factors2

mm2 <- model.matrix(~0 + factors2)
rownames(mm2) <- names(factors2)
colnames(mm2) <- levels(factors2);
mm2

icontrastnames <- c("two-one",
   "four-three",
   "(four-three)-(two-one)");
icon <- c(-1, 1, 0, 0,
   0, 0, -1, 1,
   1, -1, -1, 1)
icontrasts2 <- matrix(icon,
   ncol=3,
   dimnames=list(levels(factors2),
      icontrastnames))
icontrasts2

condes2 <- new("SEDesign",
   design=mm2,
   contrasts=icontrasts2)
condes2

# now subset samples
validate_sedesign(condes2,
   samples=paste0("sample", 2:12))

# now subset enough samples to remove one group
validate_sedesign(condes2,
   samples=paste0("sample", 4:12))

validate_sedesign(condes2, groups=c("one", "two"))

condes2[, c("one", "two")]


jmw86069/jamses documentation built on Nov. 4, 2024, 9:25 p.m.