Visualizing SMARTS

This mainly comes from the REST service provided by the SMARTS plus group at the University of Hamburg:

Imports

from global_chem_extensions import GlobalChemExtensions

cheminformatics = GlobalChemExtensions().cheminformatics()

Visualize the SMILES

molecule = cheminformatics.visualize_smarts(
'[#6]-[#7]1-[#6](-[#6]=[#6]-[#6]-1=[#8])=[#8]'
)

molecule

Algorithm

The code is pretty simple using the base url and passing in the SMARTs string:

 self.base_url = "https://smarts.plus/smartsview/download_rest?"
 self.url = self.base_url + f"smarts={self.smarts_pattern}"

To run the code:

from global_chem_extensions import GlobalChemExtensions

molecule = GlobalChemExtensions.visualize_smarts(
'[#6]-[#7]1-[#6](-[#6]=[#6]-[#6]-1=[#8])=[#8]'
)

molecule

From here we can analyze different parts of the SMARTs string and test different things out.

The breakdown of the string:

Last updated