validateInputs: Validate the input objects to a GSEA call.

View source: R/validateInputs.R

validateInputsR Documentation

Validate the input objects to a GSEA call.

Description

Checks to ensure that the values for x, design, and contrast are appropriate for the GSEA methods being used. If they are kosher, then "normalized" versions of these objects are returned in an (aptly) named list, otheerwise an error is thrown.

Usage

validateInputs(
  x,
  design = NULL,
  contrast = NULL,
  methods = NULL,
  xmeta. = NULL,
  require.x.rownames = TRUE,
  ...
)

Arguments

x

The expression object to use

design

A design matrix, if the GSEA method(s) require it

contrast

A contrast vector (if the GSEA method(s) require it)

methods

A character vector of the GSEA methods that these inputs will be used for.

xmeta.

hack for supportin data.frame inputs.

require.x.rownames

Leave this alone, should always be TRUE but have it in this package for dev/testing purposes.

...

other variables that called methods can check if they want

Details

This function is strange in that we both want to verify the objects, and return them in some canonical form, so it is normal for the caller to then use the values for x, design, and contrast that are returned from this call, and not the original values for these objects themselves

I know that the validation/checking logic is a bit painful (and repetitive) here. I will (perhaps) clean that up some day.

Value

A list with "normalized" versions of ⁠$x⁠, ⁠$design⁠, and ⁠$contrast⁠ for downstream use.

Examples

dge.stats <- exampleDgeResult()
ranks <- setNames(dge.stats$t, dge.stats$feature_id)
gdb <- exampleGeneSetDb()
ok <- validateInputs(ranks, gdb, methods = c("cameraPR", "fgsea"))
# need full expressionset & design for romer
null <- failWith(NULL, validateInputs(ranks, gdb, methods = "romer"))

lianos/sparrow documentation built on Nov. 18, 2024, 7:14 a.m.