Graph¶
Graph is the pipeline: a set of nodes and the directed edges
between them. Building a graph only describes the pipeline, nothing runs until
execute() (see Execution).
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 Nodes. Execution, run order, input merging, results, is covered in Execution.
Edges¶
add_edge takes one or more (upstream, downstream) tuples and records the
wiring. Rules:
A node may have several incoming edges.
An
InputNodemay only be a source.Both endpoints may be nodes or subgraphs.
Edge order matters when two upstreams collide on a key, see Input merging and key clashes on the Execution page.
g.add_edge((rfdiffusion, proteinmpnn), (mpnn_in, proteinmpnn)) # two edges, one call
Output nodes¶
set_output_node(node) marks which node’s result execute()
returns. A graph may have several outputs; execute() returns one result per output node. See Output nodes.
Reference¶
See the API reference for the full method and parameter reference.