Calculate Drug Molecule Similarity Derived by Molecular Fingerprints
Source:R/701-calcDrugFPSim.R
calcDrugFPSim.Rd
Calculate Drug Molecule Similarity Derived by Molecular Fingerprints
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: \(\sqrt(a + b)\)
Dice: aka Sorensen, Czekanowski, Hodgkin-Richards - \(c/0.5[(a+c) + (b+c)]\)
Cosine: aka Ochiai, Carbo - \(c/\sqrt((a + c)(b + c))\)
Hamming: aka Manhattan, taxi-cab, city-block distance - \((a + b)\)
Examples
# \donttest{
mols = readMolFromSDF(system.file('compseq/tyrphostin.sdf', package = 'Rcpi'))
#> Error in loadMolecules(normalizePath(sdffile)): The package "rcdk" is required to load molecular structures
fp1 = extractDrugEstate(mols[[1]])
#> Error: object 'mols' not found
fp2 = extractDrugEstate(mols[[2]])
#> Error: object 'mols' not found
calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'tanimoto')
#> Error: object 'fp1' not found
calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'euclidean')
#> Error: object 'fp1' not found
calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'cosine')
#> Error: object 'fp1' not found
calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'dice')
#> Error: object 'fp1' not found
calcDrugFPSim(fp1, fp2, fptype = 'compact', metric = 'hamming')
#> Error: object 'fp1' not found
fp3 = extractDrugEstateComplete(mols[[1]])
#> Error: object 'mols' not found
fp4 = extractDrugEstateComplete(mols[[2]])
#> Error: object 'mols' not found
calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'tanimoto')
#> Error: object 'fp3' not found
calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'euclidean')
#> Error: object 'fp3' not found
calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'cosine')
#> Error: object 'fp3' not found
calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'dice')
#> Error: object 'fp3' not found
calcDrugFPSim(fp3, fp4, fptype = 'complete', metric = 'hamming')# }
#> Error: object 'fp3' not found