calcDrugFPSim {Rcpi} | R Documentation

## Calculate Drug Molecule Similarity Derived by Molecular Fingerprints

### Description

Calculate Drug Molecule Similarity Derived by Molecular Fingerprints

### Usage

    calcDrugFPSim(fp1, fp2, fptype = c("compact", "complete"),
      metric = c("tanimoto", "euclidean", "cosine", "dice", "hamming"))

### Arguments

`fp1` | The first molecule's fingerprints, could be extracted by `extractDrugMACCS()`, `extractDrugMACCSComplete()` etc.
`fp2` | The second molecule's fingerprints.
`fptype` | The fingerprint type, must be one of `"compact"` or `"complete"`.
`metric` | The similarity metric, one of `"tanimoto"`, `"euclidean"`, `"cosine"`, `"dice"` and `"hamming"`.

### Details

This function calculate drug molecule fingerprints similarity. Define `a` as the features of object A, `b` is the features of object B, `c` is the number of common features to A and B:

- Tanimoto: aka Jaccard - c/a+b+c

- Euclidean: √(a + b)

- Dice: aka Sorensen, Czekanowski, Hodgkin-Richards - c/0.5[(a+c) + (b+c)]

- Cosine: aka Ochiai, Carbo - c/√((a + c)(b + c))

- Hamming: aka Manhattan, taxi-cab, city-block distance - (a + b)

### Value

The numeric similarity value.

### Author(s)

Nan Xiao <https://nanx.me>

### References

Gasteiger, Johann, and Thomas Engel, eds. Chemoinformatics. Wiley.com, 2006.

### Examples

    mols = readMolFromSDF(system.file('compseq/tyrphostin.sdf', package = 'Rcpi'))

    fp1 = extractDrugEstate(mols[[1]])
    fp2 = extractDrugEstate(mols[[2]])
    calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'tanimoto')
    calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'euclidean')
    calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'cosine')
    calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'dice')
    calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'hamming')

    fp3 = extractDrugEstateComplete(mols[[1]])
    fp4 = extractDrugEstateComplete(mols[[2]])
    calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'tanimoto')
    calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'euclidean')
    calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'cosine')
    calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'dice')
    calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'hamming')

[Package Rcpi version 1.30.0 Index]