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

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.6706780 18.47290 231.04391 2.567112e-20 2.336072e-18
#> alias_114  114 -0.6164477 17.74557 135.10962 8.813464e-16 4.010126e-14
#> alias_115  115 -0.6363735 17.40596 123.63523 4.384311e-15 1.329908e-13
#> alias_103  103 -0.7519304 17.17217 111.01367 2.912860e-14 6.626757e-13
#> alias_116  116 -0.7205022 16.78934  80.52027 5.717260e-12 1.040541e-10
#> alias_118  118 -0.6862480 16.51284  70.66241 4.142814e-11 6.283268e-10
#> alias_110  110 -0.8660117 16.18212  63.30221 2.032403e-10 2.642123e-09
#> alias_101  101 -0.1640957 19.93063  61.48320 3.054810e-10 3.474847e-09
#> alias_112  112 -0.8746824 15.41939  46.02939 1.349250e-08 1.364241e-07
#> alias_120  120 -0.8760583 15.82848  36.61908 1.863860e-07 1.619594e-06