nodeResult: Extract table with node-level DA/DS results

View source: R/nodeResult.R

nodeResultR Documentation

Extract table with node-level DA/DS results

Description

Extract a table with the top-ranked nodes from a DA/DS analysis output (generated by runDA or runDS).

Usage

nodeResult(
  object,
  n = 10,
  type = c("DA", "DS"),
  adjust_method = "BH",
  sort_by = "PValue",
  p_value = 1
)

Arguments

object

The output from runDA or runDS.

n

An integer indicating the maximum number of entities to return.

type

Either "DA" (for object from runDA) or "DS" (for object from runDS).

adjust_method

A character string specifying the method used to adjust p-values for multiple testing. See p.adjust for possible values.

sort_by

A character string specifying the sorting method. This will be passed to topTags. Possibilities are "PValue" for p-value, "logFC" for absolute log-fold change or "none" for no sorting.

p_value

A numeric cutoff value for adjusted p-values. This will be passed to topTags. Only entities with adjusted p-values equal or lower than specified are returned.

Value

A data frame with results for all nodes passing the imposed thresholds. The columns logFC, logCPM, PValue, FDR, F (or LR) are from (the output table of) topTags. The node column stores the node number for each entity. Note: FDR is corrected over all features and nodes when the specified type = "DS".

Author(s)

Ruizhu Huang, Charlotte Soneson

Examples

suppressPackageStartupMessages({
    library(TreeSummarizedExperiment)
})

lse <- readRDS(system.file("extdata", "da_sim_100_30_18de.rds",
                           package = "treeclimbR"))
tse <- aggTSE(lse, rowLevel = showNode(tree = rowTree(lse),
                                       only.leaf = FALSE))
dd <- model.matrix( ~ group, data = colData(tse))
out <- runDA(TSE = tse, feature_on_row = TRUE,
             assay = "counts", option = "glmQL",
             design = dd, contrast = NULL,
             normalize = TRUE)

## Top 10 nodes with DA
nodeResult(out, n = 10)


fionarhuang/treeclimbR documentation built on May 19, 2024, 1:18 p.m.