Hotspot IO API

The hotspots.hs_io module was created to facilitate easy reading and writing of Fragment Hotspot Map results.

There are multiple components to a hotspots.result.Result including, the protein, interaction grids and buriedness grid. It is therefore tedious to manually read/write using the various class readers/writers. The Hotspots I/O organises this for the user and can handle single hotspots.result.Result or lists of hotspots.result.Result.

The main classes of the hotspots.io module are:

  • hotspots.io.HotspotWriter

  • hotspots.io.HotspotReader

class hotspots.hs_io.HotspotReader(path, read_superstar=False, read_weighted=False, read_buriedness=True)[source]

A class to organise the reading of a hotspots.result.Result

Parameters

path (str) – path to the result directory (can be .zip directory)

read(identifier=None)[source]

creates a single or list of hotspots.result.Result instance(s)

Parameters

identifier (str) – for directories containing multiple Fragment Hotspot Map results,

identifier is the subdirectory for which a hotspots.result.Result is requried

Returns

hotspots.result.Result a Fragment Hotspot Map result

>>> from hotspots.hs_io import HotspotReader
>>> path = "<path_to_results_directory>"
>>> with HotspotReader(path) as reader:
>>>    reader.read()
class hotspots.hs_io.HotspotWriter(path, grid_extension='.grd', zip_results=True, settings=None)[source]

A class to handle the writing of a :class`hotspots.result.Result`. Additionally, creation of the PyMol visualisation scripts are handled here.

Parameters
  • path (str) – path to output directory

  • visualisation (str) – “pymol” or “ngl” currently only PyMOL available

  • grid_extension (str) – “.grd”, “.ccp4” and “.acnt” supported

  • zip_results (bool) – If True, the result directory will be compressed. (recommended)

  • settings (hotspots.hs_io.HotspotWriter.Settings) – settings

class Settings[source]

A class to hold the hotspots.hs_io.HotspotWriter settings

compress(delete_directory: bool = True) → None[source]

compresses the output directory created for this hotspots.HotspotResults instance, and removes the directory by default. The zipped file can be loaded directly into a new hotspots.HotspotResults instance using the from_zip_dir() function

Parameters

delete_directory (bool) – remove the out directory once it has been zipped

write(hr)[source]

writes the Fragment Hotspot Maps result to the output directory and create the pymol visualisation file

Parameters

hr (hotspots.result.Result) – a Fragment Hotspot Maps result or list of results

>>> from hotspots.calculation import Runner
>>> from hotspots.hs_io import HotspotWriter
>>> r = Runner
>>> result = r.from_pdb("1hcl")
>>> out_dir = <path_to_out>
>>> with HotspotWriter(out_dir) as w:
>>>     w.write(result)