Generate HTML-based Volcano Plot
Usage
plotVolcanoHTML(data, FC, p.value, cutoff, fc.cutoff, main, x.lab, ...)
# S3 method for class 'data.frame'
plotVolcanoHTML(
data,
FC,
p.value,
cutoff = 0.05/nrow(data),
fc.cutoff = 1,
main = NULL,
x.lab = NULL,
labels,
...
)
# S3 method for class 'stat_table'
plotVolcanoHTML(
data,
FC,
p.value,
cutoff = 0.05/nrow(data$stat.table),
fc.cutoff = 1,
main = NULL,
x.lab = NULL,
tbl,
...
)Arguments
- data
A data frame containing log2-transformed fold-changes and corresponding p-values. An optional third column containing, e.g. "Target" Names, can be passed if specified by the
labels =parameter.- FC
An unquoted string identifying the column in
datacontaining a vectorlog2()-transformed fold-changes.- p.value
An unquoted string identifying the column in
datacontaining a vector of p-values.- cutoff
Horizontal statistical significance cutoff for coloring points. Defaults to Bonferroni corrected significance at
alpha = 0.05in "p-value" linear space[0, 1].- fc.cutoff
Placement for the cutoff for coloring points along the fold-change x-axis. Defaults to doubling in fold-change (
1).- main
Character. Main title for the plot. See
ggtitle()forggplot2style graphics.- x.lab
Character. Optional string for the x-axis. Otherwise one is automatically generated (default).
- ...
Additional arguments passed to
plotly::plotly().- labels
An unquoted string identifying the column in
datacontaining point labels, typically "Target" or "Analyte" names.- tbl
A
tibbleobject containing analyte target annotation information. This is usually the result of a call togetAnalyteInfo().
Methods (by class)
plotVolcanoHTML(data.frame): Plot method for objects of classdata.frame.plotVolcanoHTML(stat_table): Plot method for objects of classstat_table(SomaLogic internal).
See also
Other volcano:
plotVolcano()
Examples
# Dummy up a fake table with minimal variables
adat <- SomaDataIO::example_data
seqs <- SomaDataIO::getAnalytes(adat)
target_map <- SomaDataIO::getTargetNames(SomaDataIO::getAnalyteInfo(adat))
df <- withr::with_seed(101, {
fc1 <- sort(runif(500, -2.5, 0)) # Z-scores as dummy fold-changes
fc2 <- sort(runif(500, 0, 2.5)) # Z-scores as dummy fold-changes
p1 <- pnorm(fc1) # p-values for neg. scores
p2 <- pnorm(fc2, lower.tail = FALSE) # p-values for pos. scores
p <- jitter(c(p1, p2), amount = 0.1) # add noise
p[p < 0] <- runif(sum(p < 0), 1e-05, 1e-02) # floor p > 0 after jitter
seq_vec <- sample(seqs, length(p)) # random seqIds
data.frame(
AptName = seq_vec,
t_stat = runif(50, 10, 20),
log2_fc = c(fc1, fc2),
p_value = p,
target = unlist(target_map)[seq_vec] # map random target names
)
})
# S3 `data.frame` method
# No TargetNames -> `NA`
plotVolcanoHTML(df, log2_fc, p_value, cutoff = 0.1, fc.cutoff = 0.5)
# Add TargetNames via `labels=`
plotVolcanoHTML(df, log2_fc, p_value, cutoff = 0.1, fc.cutoff = 0.5, labels = target)
