determineSignatureDistances {decompTumor2Sig} | R Documentation

## Determine differences between a given signature and a set of target signatures.

### Description

'determineSignatureDistances()' determines all distances (i.e., differences) between a given signature (of type Alexandrov or Shiraishi) and a set of target signatures (of the same type). This can help to compare signatures that have been determined in different ways or from different datasets. Different distance measures can be used (see details below).

### Usage

    determineSignatureDistances(fromSignature, toSignatures,
                                       method="euclidean")

### Arguments

`fromSignature` | (Mandatory) A single signature of the Alexandrov (vector) or Shiraishi type (data frame or matrix).
`toSignatures` | (Mandatory) The list of target signatures for which to compute the distances to `fromSignature`. These target signatures must be of the same type and format as `fromSignature`.
`method` | (Optional) The distance measure to be used. This can be one of the following: `"frobenius"` for Frobenius distance between matrices (only for Shiraishi signatures); `"rss"` for the residual sum of squares (squared error); or any distance measure available for the function `dist` of the `stats` package. Default: `"euclidean"`.

### Details

Distances that can be used are:

`"frobenius"` | Forbenius distance between real-valued matrices
| (or Shiraishi signatures) `A` and `B`:
| `F = sqrt(trace( (A-B) %*% t(A-B) ))`
`"rss"` | Residual sum of squares (i.e., squared error):
| `rss = sum((A-B)^2)`
`"euclidean"` | (see `?dist` for details)
`"maximum"` | (see `?dist` for details)
`"manhattan"` | (see `?dist` for details)
`"canberra"` | (see `?dist` for details)
`"binary"` | (see `?dist` for details)
`"minkowski"` | (see `?dist` for details)

### Value

A signature-named vector containing all distances. This vector has the same order as the target signature list, so it is not sorted according to distance.

### Author(s)

Rosario M. Piro
Politecnico di Milano
Maintainer: Rosario M. Piro
E-Mail: <rmpiro@gmail.com> or <rosariomichael.piro@polimi.it>

### References

http://rmpiro.net/decompTumor2Sig/
Krueger, Piro (2019) decompTumor2Sig: Identification of mutational signatures active in individual tumors. BMC Bioinformatics 20(Suppl 4):152.

### See Also

`decompTumor2Sig`
`mapSignatureSets`

### Examples

    ### get Alexandrov signatures from COSMIC
    signAlexandrov <- readAlexandrovSignatures()

    ### convert them to Shiraishi signatures
    signAlex2Shi <- convertAlexandrov2Shiraishi(signAlexandrov)

    ### define an arbitrary signature just for testing
    ### (similar to signature 1)
    testSig <- matrix(c(0.1,   0, 0.7, 0.1, 0.1,   0,
                        0.3, 0.2, 0.3, 0.2,   0,   0,
                        0.2, 0.1, 0.5, 0.2,   0,   0), nrow=3, byrow=TRUE)

    ### compute distances of the test signature to the converted
    ### Alexandrov signatures from COSMIC
    determineSignatureDistances(testSig, signAlex2Shi, method="frobenius")

[Package decompTumor2Sig version 2.6.0 Index]