iphasimulator.visualisation.visualiser
PHA visualisation utilities. This module contains helper functions for visualising available PHA monomer units and generated polymers.
It currently uses RDKit to render 2D molecular depictions from SMILES strings.
Functions
|
Load available PHA monomer units from residue_codes.csv. |
|
Convert a SMILES string into an RDKit molecule. |
|
Plot all available PHA monomer units from residue_codes.csv. |
|
Display all available PHA monomer units. |
|
Display one PHA monomer structure from residue_codes.csv. |
|
Load polymer SMILES from polymer_smiles.csv. |
|
Plot all available PHA polymers from polymer_smiles.csv. |
|
Display all available PHA polymers from polymer_smiles.csv. |
|
Display one PHA polymer structure from polymer_smiles.csv. |
Module Contents
- iphasimulator.visualisation.visualiser.load_available_PHA_monomers(residue_codes_csv)
Load available PHA monomer units from residue_codes.csv.
- Parameters:
residue_codes_csv (str or pathlib.Path) – Path to the residue code CSV file.
- Returns:
List of
(PHA_type, smiles)tuples for each available mainchain monomer unit.- Return type:
list[tuple[str, str]]
- iphasimulator.visualisation.visualiser.smiles_to_mol(smiles, name=None)
Convert a SMILES string into an RDKit molecule.
- Parameters:
smiles (str) – SMILES string to convert.
name (str, optional) – Optional molecule name used only for clearer error messages.
- Returns:
RDKit molecule object.
- Return type:
rdkit.Chem.rdchem.Mol
- iphasimulator.visualisation.visualiser.plot_available_PHA_monomers(residue_codes_csv='structure_database/residue_codes.csv', output_file='available_PHA_monomers.png', mols_per_row=4, image_size=(300, 220))
Plot all available PHA monomer units from residue_codes.csv. The function reads the mainchain monomer SMILES for each registered PHA type, converts each SMILES string to an RDKit molecule and writes a grid image to disk.
- Parameters:
residue_codes_csv (str or pathlib.Path, optional) – Path to residue_codes.csv.
output_file (str or pathlib.Path, optional) – Path where the output image should be written.
mols_per_row (int, optional) – Number of structures shown per row.
image_size (tuple[int, int], optional) – Size of each molecule panel in pixels.
- Returns:
Path to the generated image.
- Return type:
pathlib.Path
- iphasimulator.visualisation.visualiser.show_available_PHA_monomers(residue_codes_csv='structure_database/residue_codes.csv', mols_per_row=4)
Display all available PHA monomer units.
- iphasimulator.visualisation.visualiser.show_PHA_monomer(PHA_type, residue_codes_csv='structure_database/residue_codes.csv', image_size=(300, 220))
Display one PHA monomer structure from residue_codes.csv.
- Parameters:
PHA_type (str) – PHA type to display, e.g. “3HB” or “4HB”.
residue_codes_csv (str or pathlib.Path, optional) – Path to residue_codes.csv.
image_size (tuple[int, int], optional) – Size of the rendered molecule image.
- Returns:
Rendered RDKit molecule image.
- Return type:
PIL.Image.Image
- iphasimulator.visualisation.visualiser.load_polymer_smiles(polymer_smiles_csv)
Load polymer SMILES from polymer_smiles.csv.
- Parameters:
polymer_smiles_csv (str or pathlib.Path) – Path to polymer_smiles.csv.
- Returns:
List of
(polymer_name, smiles)tuples.- Return type:
list[tuple[str, str]]
- iphasimulator.visualisation.visualiser.plot_available_PHA_polymers(polymer_smiles_csv='structure_database/polymer_smiles.csv', output_file='available_PHA_polymers.png', mols_per_row=3, image_size=(500, 280))
Plot all available PHA polymers from polymer_smiles.csv.
- iphasimulator.visualisation.visualiser.show_available_PHA_polymers(polymer_smiles_csv='structure_database/polymer_smiles.csv', mols_per_row=3, image_size=(500, 280))
Display all available PHA polymers from polymer_smiles.csv.
- iphasimulator.visualisation.visualiser.show_PHA_polymer(polymer_name, polymer_smiles_csv='structure_database/polymer_smiles.csv', image_size=(900, 300))
Display one PHA polymer structure from polymer_smiles.csv.