# Visualizing SMARTS

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

{% embed url="<https://smarts.plus>" %}

**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**&#x20;

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.&#x20;

![](https://538359177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSbA3Zf4EXyGn0UpfW5b%2Fuploads%2FDTgDaRzcvOAz6YOFTDGT%2FScreen%20Shot%202022-03-31%20at%208.06.03%20AM.png?alt=media\&token=47dda185-ae7a-4433-9064-2adf93c03769)

The breakdown of the string:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://globalchem.gitbook.io/globalchem-your-chemical-graph-network/cheminformatics/visualizing-smarts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
