Skip to content

First Pipeline: Select Rows in Two Stages

This tutorial requires only caddforge-core. It uses six invented rows and generic core stages; no scientific plugin, GPU, or external engine is required.

Save scores.csv, pipeline.yaml, and run_pipeline.py in one writable directory. Run commands there so the registry and generated run directories stay together.

caddforge pipeline run --config pipeline.yaml

The first stage sorts scores in ascending order and retains one row per ligand. The second receives best_per_ligand.filtered_table, then keeps the best two rows globally. Input CSV paths for built-in stages resolve relative to the pipeline YAML.

Use the printed pipeline ID:

caddforge pipeline status <pipeline-id>
caddforge pipeline show-artifacts <pipeline-id>

Inspect the printed artifact paths. best_per_ligand.csv contains a2, b1, and c1; shortlist.csv contains c1 followed by a2. The toy scores have no physical units and no scientific meaning.

The equivalent Python execution is:

from caddforge.pipeline.executor import run_pipeline

result = run_pipeline("pipeline.yaml", emit=print)
print(result.pipeline_job.id)
print(result.artifacts["shortlist.filtered_table"].primary_path())
python run_pipeline.py

Both commands create new runs. Stable stage IDs and artifact names connect the stages without guessing output directories. Group-wise selection preserves ligand coverage; selecting two rows globally in the first stage would answer a different question. Continue with artifact contracts, scatter and reduction, and advanced templates.