melt_tornado: Reshape tornado to long format

Description Usage Arguments Value Note See Also Examples

View source: R/shape_tornado.R

Description

The melt_tornado emulates for the TornadoExperiment class what the melt() function does in the reshape2 package. It converts the data to long format, which is the format of choice in the tidyverse family of packages.

Usage

1
melt_tornado(tornado, assay_name = assayNames(tornado))

Arguments

tornado

A TornadoExperiment object.

assay_name

A character(1): one of the assay names.

Value

A data.frame with prod(dim(tornado)) rows.

Note

For plotting purposes, the prep_tornado() function does a more efficient job than melt_tornado().

See Also

Other tornado utilities: flatten_features(), norm_tornado(), sort_tornado()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Melt a tornado
tor <- dummy_tornado()
# Reshaping to long format
df  <- melt_tornado(tor)

# Building a tornado plot from scratch
require(ggplot2)
ggplot(df, aes(position, feature_nr)) +
  geom_raster(aes(fill = value)) +
  facet_grid(feature_set ~ sample_name)

teunbrand/tornadoplot documentation built on Dec. 23, 2021, 8:48 a.m.