edit: For direct access to the underlying fingerprint functions behind FeatureExtraction
for molecules, see the Molecule Fingerprints paclet in the new paclet repository.
Molecule fingerprints are being integrated with the Wolfram Language through the FeatureExtraction
framework, starting in version 12.3. You can obtain a set of molecule fingerprints using FeatureExtract
mols = Import["https://pastebin.com/raw/687NTfND", "SMILES"];
fprints = FeatureExtract[mols, "MoleculeTopologicalFeatures"];
Counts[Flatten[fprints]]
(* <|0 -> 2170194, 1 -> 172718|> *)
The fingerprint types available are "AtomPairs"
, "MoleculeTopologicalFeatures"
(also known as RDKit fingerprints, which can be described as Daylight-like), and "MoleculeExtendedConnectivity"
(aka circular fingerprints or ECFP).
This means you can use these fingerprints directly in the built-in supervised and unsupervised machine learning applications like FindClusters
or FeatureSpacePlot
.
FeatureSpacePlot[mols,
FeatureExtractor -> "MoleculeExtendedConnectivity",
LabelingFunction ->
Function[mol,
Placed[Dynamic[MoleculePlot[mol, ImageSize -> Small]], Tooltip]]]
Note the dynamic in the labeling function, which is nice because then the function doesn't typeset 1100 molecules before rendering the featurespace plot.
More named feature extractors will be added in the near future. There are functions in the "Chemistry`"
context fingerprint for generating fingerprints, some of which may change in the future. The functions I don't expect to change include
AtomPairFingerprint
ExtendedConnectivityFingerprint
TopologicalFingerprint
MACCSKeyFingerprint
These will be documented either through the function repository interface or paclet-level documentation. These can be called on a single molecule or a list of molecules. They return NumericArray
by default but can take the option "OutputType" to change that. When called with no arguments (or just options) they return a
MoleculeFingerprintFunction` that can be used elsewhere. For example you can make an FCFP fingerprinter using
ExtendedConnectivityFingerprint[
"OutputType" -> "CountVector", "UseFeatures" -> True, "Radius" -> 4
]
I will make a cloud notebook demonstrating the functions more fully and link it here shortly.
Chemistry`MACCSKeysFingerprint[ Import["https://pastebin.com/raw/687NTfND", "SMILES"]]
to get the MACCS keys for these molecules in V13. $\endgroup$