Description Usage Arguments Value See Also Examples
View source: R/shape_tornado.R
Summarise a TornadoExperiment
at every bin position for every sample by
calculating a statistic over all features in a set. The defaults measure
the mean, standard deviation and number of features.
1 2 3 4 5 | flatten_features(
tornado,
assay_name = assayNames(tornado),
measure = list(mean = colMeans2, sd = colSds, n = nrow)
)
|
tornado |
A TornadoExperiment object. |
assay_name |
A |
measure |
A named
As one might infer from the mentioned example functions, the
|
A long format data.frame
with columns named after the measure
argument, as well as position
, feature_set
and elements from
colData(x)
.
Other tornado utilities:
melt_tornado()
,
norm_tornado()
,
sort_tornado()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Summarise features
tor <- dummy_tornado()
df <- flatten_features(tor)
# Estimate standard error of the mean
df$se <- sqrt(df$sd^2 / df$n)
# Plotting the result
require(ggplot2)
ggplot(df, aes(position, fill = feature_set)) +
geom_ribbon(aes(ymin = mean - se, ymax = mean + se), alpha = 0.3) +
geom_line(aes(y = mean, colour = feature_set)) +
facet_wrap(~ sample_name)
# Calculating alternative metrics
require(matrixStats)
measure <- list(median = matrixStats::colMedians,
mad = matrixStats::colMads,
n = nrow)
df <- flatten_features(tor, measure = measure)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.