sort_tornado: Reorder features

Description Usage Arguments Value See Also Examples

View source: R/shape_tornado.R

Description

The sort_tornado() function reorders the features of a TornadoExperiment object based on the weighted sum across all bins.

Usage

1
2
3
4
5
6
7
8
9
sort_tornado(
  tornado,
  assay_name = assayNames(tornado),
  bin_subset = NULL,
  bin_weights = NULL,
  sample_subset = NULL,
  decreasing = TRUE,
  ...
)

Arguments

tornado

A TornadoExperiment object.

assay_name

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

bin_subset, bin_weights

Define either bin_subset or bin_weights (or neither), but not both. bin_subset should be a logical or numeric vector with subsetting indices for the number of bins. bin_weights should be a numeric vector of weights, the same length as there are bins. If both bin_subset and bin_weights are NULL (default), the weights are constructed with the density function of the Laplace distribution wherein the location is centred at the middle of the bins and the scale parameter is 10% of the number of bins.

sample_subset

A character, logical or integer vector for subsetting the samples.

decreasing

A logical(1): sort from high to low (TRUE) or from low to high (FALSE)?

...

Not currently in use.

Value

The tornado dataset with the features reordered.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# A tornado that isn't sorted
tor <- dummy_tornado()[c(2,1,4,3),]

# Sorting based on a particular sample
x <- sort_tornado(tor, sample_subset = "dummy_ctrl")

# Sorting based on a subset of bins
x <- sort_tornado(tor, bin_subset = 21:30)

# Sorting with custom weights
nbin <- nbin(tor)
w <- dnorm(seq_len(nbin), mean = (nbin + 1)/2, sd = 5)
x <- sort_tornado(tor, bin_weights = w)

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