Smiles#
SMILES (Simplified Molecular Input Line Entry System) is a notation that allows a users to represent chemical structures in 2D notation. This notation can be used in Horus.

In order to control SMILES from Horus blocks, we use the SmilesAPI, a bridge built for communicating Blocks with the SMILES manager.
SmilesAPI#
SmilesAPI is a library for creating and manipulating molecular structures using SMILES notation in Horus. It is designed to be used within Blocks in order to add molecular structures represented by SMILES notation.
In order to control the SMILES interpreter within a Block action, you need to import the SmilesAPI class and use the desired methods.
from HorusAPI import SmilesAPI
my_smiles = "CCCO"
# Create the structure calling directly the Smiles API
SmilesAPI().addSmiles(my_smiles)
The SMILES actions will be applied in the same manner as Mol* actions, for more information, refer to the Molstar (Mol*) documentation page.
SmilesAPI methods#
The SmilesAPI module
- class SmilesAPI(*args, **kwargs)#
API for interacting with the Smiles Manager inside Horus
- addCSV(csv: str, group: str | None = None) None #
Adds a CSV file to the smiles manager
- Parameters:
csv – The CSV file path to add
- addSmiles(smiles: str, group: str | None = None) None #
Add a smiles string to the smiles manager
- Parameters:
smiles – The smiles string to add
group – The group to add the smiles to
- addSmilesWithData(smiles: list[dict]) None #
Adds a list of full SMILES object to the smiles manager
Each object should be in the following keys:
smi: string -> SMILES as a string
label: string -> Label to display
extraInfo: string -> Extra info to display
group: string -> Group to add the smiles to
props: {key: value, …} -> Properties to add to the molecule (optional)
- reset() None #
Resets the visualizer