Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Compute the 166bit MACCS (Molecular ACCess System) key
ResourceFunction["MACCSKeys"][molecule] returns the MACCS key for the Molecule molecule. 

ResourceFunction["MACCSKeys"][smiles] returns the MACCS key for a molecule specified by the SMILES string smiles. 
The function can take either a SMILES string or a Molecule as input. By default it returns a SparseArray containing the 166 bits:
In[1]:= 

Out[1]= 

In[2]:= 

Out[2]= 

MACCSKeys is a Listable function:
In[3]:= 

Out[3]= 

Option values include "SparseArray", "OnBits", "MoleculePlot", "Function" and "SMARTS". The default setting of "SparseArray" returns the 166bit vector:
In[4]:= 

Out[4]= 

The "OnBits" setting returns a list of the active (nonzero) bits in the MACCS key. These are 1indexed (as is conventional in the Wolfram Language):
In[5]:= 

Out[5]= 

The "MoleculePlot" setting returns an association whose keys are the active bits and whose values are the MoleculePlots corresponding to the MoleculePattern that was matched for that key. Here we take the first three, for brevity:
In[6]:= 

Out[6]= 

The "Function" setting returns an association whose values are pure functions responsible for generating each key:
In[7]:= 

Out[7]= 

The "SMARTS" setting returns an association whose values are the SMARTS specification for the pattern; note that not all MACCS keys can be defined as SMARTS patterns (these return a “?”) and some MACCS keys require finding a certain number of matches above some threshold, so the SMARTS specification alone is not always a complete description of the key:
In[8]:= 

Out[8]= 

Compare the structural similarity of six common statin drugs using the JaccardDissimilarity of the MACCS keys (one minus this is equivalent to the Tanimoto similarity):
In[9]:= 

Out[10]= 

Empirically, less than 3% of randomly selected molecules have a MACCS Tanimoto similarity above 0.6. Use this as a threshold to visualize which molecules are similar to one another:
In[11]:= 

Out[11]= 

The same caveats as with the RDKit implementation apply here—specifically the isotope flag (key 1) is undefined and the public MACCS keys have been “reverse engineered”.
In[12]:= 

Out[12]= 

The mean Tanimoto similarity score for randomly selected molecules is approximately 0.35:
In[13]:= 

Out[13]= 

Only about 3% of randomly chosen molecules will have a Tanimoto similarity score above 0.6:
In[14]:= 

Out[14]= 

This work is licensed under a Creative Commons Attribution 4.0 International License