calculateJSD {mia} | R Documentation

## Calculate the Jensen-Shannon Divergence

### Description

This function calculates the Jensen-Shannon Divergence (JSD) in a `SummarizedExperiment` object.

### Usage

    ## S4 method for signature 'ANY'
    calculateJSD(x, ...)

    ## S4 method for signature 'SummarizedExperiment'
    calculateJSD(
      x,
      abund_values = exprs_values,
      exprs_values = "counts",
      transposed = FALSE,
      ...
    )

    runJSD(x, BPPARAM = SerialParam(), chunkSize = nrow(x))

### Arguments

`x` | a numeric matrix or a `SummarizedExperiment`.
`...` | optional arguments not used.
`abund_values` | a single `character` value for specifying which assay to use for calculation.
`exprs_values` | a single `character` value for specifying which assay to use for calculation. (Please use `abund_values` instead. At some point `exprs_values` will be disabled.)
`transposed` | Logical scalar, is x transposed with cells in rows?
`BPPARAM` | A `BiocParallelParam` object specifying whether the JSD calculation should be parallelized.
`chunkSize` | an integer scalar, defining the size of data send to the individual worker. Only has an effect, if `BPPARAM` defines more than one worker. (default: `chunkSize = nrow(x)`)

### Value

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

### Author(s)

Susan Holmes susan@stat.stanford.edu. Adapted for phyloseq by Paul J. McMurdie. Adapted for mia by Felix G.M. Ernst

### References

Jensen-Shannon Divergence and Hilbert space embedding. Bent Fuglede and Flemming Topsoe University of Copenhagen, Department of Mathematics http://www.math.ku.dk/~topsoe/ISIT2004JSD.pdf

### See Also

http://en.wikipedia.org/wiki/Jensen-Shannon_divergence

### Examples

    data(enterotype)
    library(scater)

    jsd <- calculateJSD(enterotype)
    class(jsd)
    head(jsd)

    enterotype <- runMDS(enterotype, FUN = calculateJSD, name = "JSD",
                         exprs_values = "counts")
    head(reducedDim(enterotype))
    head(attr(reducedDim(enterotype),"eig"))
    attr(reducedDim(enterotype),"GOF")

[Package mia version 1.2.7 Index]