The param_to_json Python module

Representation of a HADDOCK parameter file as a Python object.

This library allows to create, load, modify and write HADDOCK parameter files in JSON format.

Several functions are made available and are based on a common structure HADDOCKParam that needs to be initialized prior to doing anything.

class param_to_json.HADDOCKParamError(message)

Exception class related to any error within the HADDOCKParam class

class param_to_json.HADDOCKParamFormatError(message, param=None)

Exception class related to any format error within the HADDOCKParam class

class param_to_json.HADDOCKParam(verbose=True)

Top-level class representing a complete HADDOCK parameter file.

Parameters:verbose (bool) – Get validation details and warnings
check_status()

Check if a HADDOCKParam is loaded and valid

get(param)

Get value of a parameter using its name

Parameters:param – Name of the parameter
load(input, skip_validation=False)

Load the parameter file in a HADDOCKParam object

Parameters:
  • input (str, file) – JSON file path or file-object
  • skip_validation (bool) – Flag to skip or not the validation step
set(param, value)

Get value of a parameter using its name

Parameters:param – Name of the parameter
validate(init=False)

Validation of parameter file format and keys

Param:bool init: Indicate if validation occurs upon loading file
Returns:True/False
Return type:bool
Raise:HADDOCKParamFormatError