FragmentationModelResult

FragmentationResult class.

Base class to set fragmentation results. implements the drawing methods of the solutions.

class FragmentationResult(molecule: Mol, subgroups: dict, subgroups_atoms_indexes: dict)[source]

Bases: object

Fragmentation result class.

This class is used to store the fragmentation results and provide methods to visualize them.

Parameters:
  • molecule (Chem.rdchem.Mol) – Molecule to fragment.

  • subgroups (dict) – Dictionary with the subgroups and the number of times they appear in the molecule.

  • subgroups_atoms_indexes (dict) – Dictionary with the subgroups and the atoms indexes that belong to each subgroup.

molecule

Molecule to fragment.

Type:

Chem.rdchem.Mol

subgroups

Dictionary with the subgroups and the number of times they appear in the molecule.

Type:

dict

subgroups_atoms

Dictionary with the subgroups and the atoms indexes that belong to each subgroup.

Type:

dict

get_solution_svg(title: str = '', width: float = 400, height: float = 200, title_font_size: float = 12, legend_font_size: float = 12, font: str = 'Helvetica') str[source]

Create a SVG figure string of the fragmentation result.

Parameters:
  • title (str, optional) – Graph title, by default “”

  • width (int, optional) – Graph width, by default 400

  • height (int, optional) – Graph height, by default 200

  • title_font_size (int, optional) – Font size of graph’s title, by default 12

  • legend_font_size (int, optional) – Legend font size, by default 12

  • font (str, optional) – Text font, by default “Helvetica”

Returns:

SVG string.

Return type:

str

draw(title: str = '', width: float = 400, height: float = 200, title_font_size: float = 12, legend_font_size: float = 12, font: str = 'Helvetica')[source]

Create a IPython SVG object of the fragmentation result.

This function is meant to be used in Jupyter notebooks to directly obtain the visual SVG figure on the notebook. It requires the IPython library to be installed.

Parameters:
  • title (str, optional) – Graph title, by default “”

  • width (int, optional) – Graph width, by default 400

  • height (int, optional) – Graph height, by default 200

  • title_font_size (int, optional) – Font size of graph’s title, by default 12

  • legend_font_size (int, optional) – Legend font size, by default 12

  • font (str, optional) – Text font, by default “Helvetica”

Returns:

SVG object of the fragmentation result.

Return type:

IPython.display.SVG

Raises:

ImportError – IPython is not installed.