Skip to contents

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

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)
#>           node      logFC   logCPM         F       PValue          FDR
#> alias_102  102 -0.6705290 18.47290 230.62639 2.678458e-20 2.437397e-18
#> alias_114  114 -0.6163689 17.74557 135.13694 8.811263e-16 4.009125e-14
#> alias_115  115 -0.6363130 17.40596 123.69769 4.358763e-15 1.322158e-13
#> alias_103  103 -0.7518593 17.17217 111.02252 2.917194e-14 6.636616e-13
#> alias_116  116 -0.7204688 16.78934  80.55771 5.687821e-12 1.035183e-10
#> alias_118  118 -0.6862085 16.51284  70.69389 4.122989e-11 6.253200e-10
#> alias_110  110 -0.8660080 16.18212  63.34200 2.017616e-10 2.622901e-09
#> alias_101  101 -0.1639281 19.93063  60.93639 3.464554e-10 3.940930e-09
#> alias_112  112 -0.8746829 15.41939  46.04094 1.346554e-08 1.361515e-07
#> alias_120  120 -0.8760397 15.82848  36.61330 1.868507e-07 1.619724e-06