API reference

Graph

class biocomposer.Graph

Bases: object

add_decision_node(score_fn: str, conditions: list, modifier_tool) DecisionNode
add_edge(*edges)

Wire nodes together. Each edge is a 2-tuple (upstream_node, downstream_node).

add_gather_node(tool_name: str, split_key: str, gpu: str = None, args_override: str = None, entrypoint_override: str = None) GatherNode

Scatter an upstream collection (the upstream output key split_key) over a cardinality-one inner tool, running it once per item and gathering the per-item outputs into a dict-of-lists.

add_input_node(**kwargs) InputNode
add_node(tool_name: str, gpu: str = None, args_override: str = None, entrypoint_override: str = None) Node
execute()
set_llm(provider: str, model: str, api_key: str)
set_output_node(node: Node = None)

Nodes

class biocomposer.Node(tool_name: str, inNodes: list = None, args_override: str = None, entrypoint_override: str = None)

Bases: object

get_node_input()
install()
run(inputs: dict) dict
class biocomposer.InputNode

Bases: object

set_input(**kwargs)
class biocomposer.GatherNode(tool_name: str, split_key: str, inNodes: list = None, args_override: str = None, entrypoint_override: str = None)

Bases: Node

Run a cardinality-one tool once per item of an upstream collection, gathering outputs into a dict-of-lists. split_key names the upstream output key holding the collection. Partitioning is done by the edge connector (see _execute_gather_node).

static gather(results: list) dict

list-of-dicts -> dict-of-lists, so downstream sees parallel lists.

run_one(mapped_inputs: dict) dict

One scattered item; Node.run gives each its own numbered output_dir.

class biocomposer.DecisionNode(score_fn: str, inNodes: list = None, conditions: list = None, modifier_tool_name: str = None, graphConnectorHelper=None)

Bases: Node

check_all_conditions(score)
extract_score(scorer_output: dict)
run(inputs: dict) dict
class biocomposer.OutputNode

Bases: object

collect(data: dict)

Conditions

class biocomposer.Condition(comparator: str, a)

Bases: object

check(x) bool