BioSimSpace.Gateway.Node

class BioSimSpace.Gateway.Node(description, name=None)

A class for interfacing with BioSimSpace nodes.

Nodes are used to collect and validate user input, document the intentions of the workflow component, track and report errors, and validate output. Once written, a node can be run from within Jupyter, from the command-line, or plugged into a workflow engine, such as Knime.

Example

A generic energy minimisation node:

>>> import BioSimSpace as BSS
>>> node = BSS.Gateway.Node("Perform energy minimisation")
>>> node.addAuthor(name="Lester Hedges", email="lester.hedges@bristol.ac.uk", affiliation="University of Bristol")
>>> node.setLicence("GPLv3")
>>> node.addInput("files", BSS.Gateway.FileSet(help="A set of molecular input files."))
>>> node.addInput("steps", BSS.Gateway.Integer(help="The number of minimisation steps.", minimum=0, maximum=100000, default=10000))
>>> node.addOutput("minimised", BSS.Gateway.FileSet(help="The minimised molecular system."))
>>> node.showControls()
>>> system = BSS.IO.readMolecules(node.getInput("files"))
>>> protocol = BSS.Protocol.Minimisation(steps=node.getInput("steps"))
>>> process = BSS.MD.run(system, protocol)
>>> node.setOutput("minimised", BSS.IO.saveMolecules("minimised", process.getSystem(block=True), system.fileFormat()))
>>> node.validate()
__init__(description, name=None)

Constructor.

Parameters
  • description (str) – A description of the node.

  • name (str) – The name of the node.

Methods

__del__()

Destructor.

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(description[, name])

Constructor.

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

Create and return a new object.

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_addInputCommandLine(name, input)

Add an input requirement for the command-line.

_addInputJupyter(name, input[, reset])

Add an input requirement for Jupyter.

_addInputKnime(name, input)

Add an input requirement for Knime.

_create_help_string(input)

Create a nicely formatted argparse help string.

_generate_description()

Generate a formatted output section for the argparse help description.

_validateInput()

Validate the parsed inputs.

addAuthor([name, email, affiliation])

Add an author for the node.

addError(error)

Add an error message.

addInput(name, input)

Add an input requirement.

addOutput(name, output)

Add an output requirement.

getAuthors()

Return the list of authors.

getInput(name)

Get the value of the named input.

getInputs()

Get all of the input requirements.

getLicense()

Return the license.

setLicense(license)

Set the license for the node.

setOutput(name, value)

Set the value of an output.

showControls()

Show the Jupyter widget GUI to allow the user to enter input.

validate([file_prefix])

Whether the output requirements are satisfied.

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

_is_knime

_is_notebook