TabulatepValues: Tabulate, adjust, and sort pathway p-values

View source: R/utils_adjust_and_sort_pValues.R

TabulatepValuesR Documentation

Tabulate, adjust, and sort pathway p-values

Description

Adjust the pathway p-values, then return a data frame of the relevant pathway information, sorted by adjusted significance.

Usage

TabulatepValues(
  pVals_vec,
  genesets_ls,
  adjust = TRUE,
  proc_vec = c("BH", "Bonferroni", "Holm", "Hochberg", "SidakSS", "SidakSD", "BY", "ABH",
    "TSBH"),
  ...
)

Arguments

pVals_vec

A named vector of permutation p-values returned by the PermTestSurv, PermTestReg, or PermTestCateg functions when the analysis performed was AES-PCA. Otherwise, when the analysis was performed with Supervised PCA, a named vector of p-values from the GumbelMixpValues function.

genesets_ls

A list of known gene pathways, trimmed to match the given assay data by the IntersectOmicsPwyCollct function. This pathway list must contain:

  • pathways : A named list of character vectors where each vector contains the names of the genes in that specific pathway.

  • TERMS : A character vector the same length as pathways containing the full pathway descriptions.

  • n_tested : An integer vector the same length as pathways containing the number of genes present in the pathway after trimming. Pathways list trimming is done in the IntersectOmicsPwyCollct function.

adjust

Should you adjust the p-values for multiple comparisons? Defaults to TRUE.

proc_vec

Character vector of procedures. The returned data frame will be sorted in ascending order by the first procedure in this vector, with ties broken by the unadjusted p-value. If only one procedure is selected, then it is necessarily the first procedure. Defaults to "BH" (Benjamini and Hochberg, 1995).

...

Additional arguments to pass to the ControlFDR function.

Details

This is a wrapper function for the ControlFDR function. The number of p-values passed to the pVals_vec argument must equal the number of pathways and set size values in the genesets_ls argument. If you trimmed a pathway from p- value calculation, then pad this missing value with an NA.

Value

A data frame with columns

  • pathways : The names of the pathways in the Omics* object (stored in object@trimPathwayCollection$pathways).

  • n_tested : The number of genes in each pathway after being trimmed to match the assay. Given in the n_tested element of the trimmed pathway collection.

  • terms : The pathway title, as stored in the object@trimPathwayCollection$TERMS object.

  • description : The pathway description, if it is stored in the object@trimPathwayCollection$description object.

  • rawp : The unadjusted p-values of each pathway.

  • ... : Additional columns as specified through the adjustment argument.

The data frame will be sorted in ascending order by the method specified first in the adjustment argument. If adjustpValues = FALSE, then the data frame will be sorted by the raw p-values. If you have the suggested tidyverse package suite loaded, then this data frame will print as a tibble. Otherwise, it will stay a simple data frame.

Examples

  # DO NOT CALL THIS FUNCTION DIRECTLY.
  # Call this function through AESPCA_pVals() or SuperPCA_pVals() instead.

## Not run: 
  ###  Load the Example Data  ###
  data("colonSurv_df")
  data("colon_pathwayCollection")

  ###  Create an OmicsSurv Object  ###
  colon_Omics <- CreateOmics(
    assayData_df = colonSurv_df[, -(2:3)],
    pathwayCollection_ls = colon_pathwayCollection,
    response = colonSurv_df[, 1:3],
    respType = "surv"
  )

  ###  Extract Pathway PCs and Loadings  ###
  colonPCs_ls <- ExtractAESPCs(
    object = colon_Omics,
    parallel = TRUE,
    numCores = 2
  )

  ###  Pathway p-Values  ###
  pVals <- PermTestSurv(
    OmicsSurv = colon_Omics,
    pathwayPCs_ls = colonPCs_ls$PCs,
    parallel = TRUE,
    numCores = 2
  )

  ###  Create Table of p-Values  ###
  trimmed_PC <- getTrimPathwayCollection(colon_Omics)
  TabulatepValues(
    pVals_vec = pVals,
    genesets_ls = trimmed_PC
  )

## End(Not run)


gabrielodom/pathwayPCA documentation built on July 10, 2023, 3:32 a.m.