smartsexplore.smarts.draw module

Functions for drawing SMARTS and SMARTS-SMARTS relationships in the SMARTSViewer visual language paradigm, see [Schomburg2010]. Uses the SMARTScompareViewer NAOMI tool for this purpose.

smartsexplore.smarts.draw.draw_multiple_smarts(smarts: Iterable[smartsexplore.database.models.SMARTS], viewer_path: str, output_path: str)

Draws multiple SMARTS by parallelizing draw_one_smarts() via tqdm.contrib.concurrent.process_map().

Parameters
  • smarts – An iterable of SMARTS objects to draw.

  • viewer_path – The path to a SMARTScompareViewer binary.

  • output_path – The output path to store the rendered SMARTS SVGs in.

smartsexplore.smarts.draw.draw_multiple_smarts_subset_relations(directed_edges: Iterable[smartsexplore.database.models.DirectedEdge], viewer_path: str, output_path: str)

Draws multiple SMARTS subset relations by parallelizing draw_one_smarts_subset_relation() via tqdm.contrib.concurrent.process_map().

Parameters
  • directed_edges – An iterable of DirectedEdge objects to draw.

  • viewer_path – The path to a SMARTScompareViewer binary.

  • output_path – The output path to store the rendered subset relation SVGs in.

smartsexplore.smarts.draw.draw_one_smarts(smarts: smartsexplore.database.models.SMARTS, viewer_path: str, output_path: str)

Draws one SMARTS as an SVG file to the output path, using SMARTScompareViewer.

Output filename will be {smarts.id}.svg.

Parameters
  • smarts – The SMARTS object to draw.

  • viewer_path – The path to the SMARTScompareViewer binary.

  • output_path – The output path to write the SVG file to.

smartsexplore.smarts.draw.draw_one_smarts_subset_relation(directed_edge: smartsexplore.database.models.DirectedEdge, viewer_path: str, output_path: str)

Draws one DirectedEdge, i.e., a subset relationship from directed_edge.from_smarts to directed_edge.to_smarts, as an SVG file to the output path, using SMARTScompareViewer.

Output filename will be {directed_edge.id}.svg.

Parameters
  • directed_edge – The DirectedEdge object to draw.

  • viewer_path – The path to the SMARTScompareViewer binary.

  • output_path – The output path to write the SVG file to.