Tool nodes¶
A tool node wraps one tool from the registry and runs it once per execution.
align = g.add_node("clustalo")
Creating a tool node¶
When a tool node is created, biocomposer resolves the tool from the registry and prepares its container image, so the tool is ready to run. The tool’s manifest declares its typed inputs and outputs, which biocomposer uses to connect the node to its neighbors. See Tools and the registry for the manifest format.
Running a tool node¶
During execute(), a tool node receives its inputs from
upstream, runs the tool in an isolated container, and returns a dictionary mapping
each declared output name to the path it produced: a directory path for
type = "dir" outputs, a file path otherwise. Results are saved under
results/, and repeated runs do not overwrite each other.
Cardinality determines composition¶
A tool input declared cardinality = "one" consumes exactly one item per run. If
an upstream produces a collection and the next tool’s input is one, you wrap
that tool in a gather node so it runs once per item, the single most
common structural decision when building a pipeline. cardinality = "many" means
the tool accepts a list directly and no gather node is needed.
Overriding the command¶
By default a node runs the manifest’s entrypoint with its argument template. Two overrides change that.
Different binary, for images that expose several programs:
g.add_node("trimal", entrypoint_override="readal")
Different argument template, to change flags or argument order:
g.add_node("colabfold",
args_override="--num-recycle 0 {fasta} {output_dir}")
Both, common when invoking a non-default binary:
g.add_node("trimal",
entrypoint_override="readal",
args_override="-in {alignment} -out {trimmed} -fasta")
Overrides replace the corresponding manifest field for that node only; everything else (image, typed I/O) is unchanged.
Reference¶
See the API reference for the full method and parameter reference.