calculateDistance: Calculate distances for all sample pairs

Description Usage Arguments Value Examples

Description

calculateDistance calculates a distance matrix between samples. The type of distance calculate can be modifier by setting FUN, which expects a function with a matrix input as its first argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
calculateDistance(x, FUN = stats::dist, ...)

## S4 method for signature 'ANY'
calculateDistance(x, FUN = stats::dist, ...)

## S4 method for signature 'SummarizedExperiment'
calculateDistance(
  x,
  FUN = stats::dist,
  exprs_values = "counts",
  transposed = FALSE,
  ...
)

Arguments

x

a SummarizedExperiment object containing a tree.

FUN

a function for distance calculation. The function must expect the input matrix as its first argument. Samples have to be rows and feature columns.

...

other arguments passed onto FUN

exprs_values

a single character value for specifying which assay to use for calculation.

transposed

Logical scalar, is x transposed with cells in rows?

Value

a sample-by-sample distance matrix, suitable for NMDS, etc.

Examples

1
2
3
4
5
6
7
# generate some example data
mat <- matrix(1:60, nrow = 6)
df <- DataFrame(n = c(1:6))
se <- SummarizedExperiment(assays = list(counts = mat),
                           rowData = df)
#
calculateDistance(se)

FelixErnst/SEtup documentation built on Oct. 27, 2020, 11:35 p.m.