mapSignatureSets: Map one signature set to another.

View source: R/mapSignatureSets.R

mapSignatureSetsR Documentation

Map one signature set to another.

Description

'mapSignatureSets()' determines a mapping from one set of signatures to another. Both Alexandrov and Shiraishi signatures can be handled, but both sets must be of the same type. The mapping can either be a unique (one-to-one) mapping or identify best matches while allowing multiple signatures to be mapped to the same target signature if it is the best match for more than one signature. Different distance measures can be used (see details below).

Usage

mapSignatureSets(fromSignatures, toSignatures, method="euclidean",
unique=FALSE)

Arguments

fromSignatures

(Mandatory) A set (list) of signatures of the Alexandrov (vector) or Shiraishi type (data frame or matrix), that has to be mapped to the signatures of a second set (toSignatures).

toSignatures

(Mandatory) The set (list) of signatures to which the set of fromSignatures has to be mapped.

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".

unique

(Optional) If set to FALSE (default), then for each signature of fromSignatures the best match (minimum distance) from toSignatures is selected. The selected signatures need not be unique, i.e., one signature of toSignatures may be the best match for multiple signatures of fromSignatures. If set to TRUE, i.e., if a unique (one-to-one) mapping is required, an iterative approach is performed: in each step, the best matching pair from fromSignatures and toSignatures is mapped and then removed from the list of signatures that remain to be mapped, such that they cannot be selected again.

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 vector having as elements the mapped signatures of toSignatures, and as names the signatures of fromSignatures with which they have been associated.

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
determineSignatureDistances

Examples


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

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

### define a small set of arbitrary signatures just for testing
### (similar to signatures 1, 5 and 13, respectively)
test1 <- 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)

test2 <- matrix(c( 0.1,  0.1,  0.3,  0.1,  0.3,  0.1,
                   0.3,  0.25, 0.2,  0.25, 0,    0,
                   0.3,  0.2,  0.2,  0.3,  0,    0   ), nrow=3, byrow=TRUE)

test3 <- matrix(c( 0.1,  0.7,  0.2,  0,    0,    0,
                   0,    0,    0,    1.0,  0,    0,
                   0.5,  0.1,  0,    0.4,  0,    0   ), nrow=3, byrow=TRUE)

fromSig <- list(sig1=test1, sig2=test2, sig3=test3)

### compute distances of the test signature to the converted
### Alexandrov signatures from COSMIC
mapSignatureSets(fromSig, signAlex2Shi, method="frobenius", unique=TRUE)


rmpiro/decompTumor2Sig documentation built on May 15, 2022, 3:27 a.m.