Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.56 KB

graph.rst

File metadata and controls

54 lines (37 loc) · 1.56 KB

Graph

:class:`~biocomposer.Graph` is the pipeline: a set of nodes and the directed edges between them. Building a graph only describes the pipeline, nothing runs until :func:`~biocomposer.Graph.execute` (see :doc:`execute`).

from biocomposer import Graph

g = Graph()
a = g.add_input_node(sequences="/vol/inputs/family.fasta")
b = g.add_node("clustalo")
g.add_edge((a, b))
g.set_output_node(b)

Graphs are defined using nodes (bioinformatics tools) and edges (auto-generated mapper functions) that enable data flow between nodes. There are 6 types of nodes, covered in :doc:`nodes/index`. Execution, run order, input merging, results, is covered in :doc:`execute`.

Edges

add_edge takes one or more (upstream, downstream) tuples and records the wiring. Rules:

  • A node may have several incoming edges.
  • An :class:`~biocomposer.InputNode` may only be a source.
  • Both endpoints may be nodes or :doc:`subgraphs <nodes/subgraph>`.

Edge order matters when two upstreams collide on a key, see :ref:`merge-order` on the :doc:`execute` page.

g.add_edge((rfdiffusion, proteinmpnn), (mpnn_in, proteinmpnn))  # two edges, one call

Output nodes

set_output_node(node) marks which node's result :func:`~biocomposer.Graph.execute` returns. A graph may have several outputs; execute() returns one result per output node. See :doc:`nodes/output`.

.. toctree::
   :hidden:

   nodes/index
   execute

Reference

See the :doc:`api` for the full method and parameter reference.