getCand | R Documentation |
Generate candidates for different thresholds (t). A candidate consists of a disjoint collection of leaves and internal branches, that collectively cover all leaves in the tree, and represents a specific aggregation pattern along the tree.
getCand(
tree,
t = NULL,
score_data,
node_column,
p_column,
sign_column,
threshold = 0.05,
pct_na = 0.5,
message = FALSE
)
tree |
A |
t |
A vector of threshold values used to search for candidates,
in the range [0, 1]. The default ( |
score_data |
A |
node_column |
The name of the column of |
p_column |
The name of the column of |
sign_column |
The name of the column of |
threshold |
Numeric scalar; any internal node where the value of the p-value column is above this value will not be returned. The default is 0.05. The aim of this threshold is to avoid arbitrarily picking up internal nodes without true signal. |
pct_na |
Numeric scalar. In order for an internal node to be eligible
for selection, more than |
message |
A logical scalar, indicating whether progress messages should be printed to the console. |
A list with two elements: candidate_list
and
score_data
. condidate_list
is a list of candidates obtained
for the different thresholds. score_data
is a data.frame
that includes columns from the input score_data
and additional
columns with q-scores for different thresholds.
Ruizhu Huang
suppressPackageStartupMessages({
library(TreeSummarizedExperiment)
library(ggtree)
})
data(tinyTree)
ggtree(tinyTree, branch.length = "none") +
geom_text2(aes(label = node)) +
geom_hilight(node = 13, fill = "blue", alpha = 0.3) +
geom_hilight(node = 18, fill = "orange", alpha = 0.3)
## Simulate p-values and directions of change for nodes
## (Nodes 1, 2, 3, 4, 5, 13, 14, 18 have a true signal)
set.seed(1)
pv <- runif(19, 0, 1)
pv[c(seq_len(5), 13, 14, 18)] <- runif(8, 0, 0.001)
fc <- sample(c(-1, 1), 19, replace = TRUE)
fc[c(seq_len(3), 13, 14)] <- 1
fc[c(4, 5, 18)] <- -1
df <- data.frame(node = seq_len(19),
pvalue = pv,
logFoldChange = fc)
ll <- getCand(tree = tinyTree, score_data = df,
t = c(0.01, 0.05, 0.1, 0.25, 0.75),
node_column = "node", p_column = "pvalue",
sign_column = "logFoldChange")
## Candidates
ll$candidate_list
## Score table
ll$score_data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.