A graph that has not run
Per-sample fan-out, and every error in one pass. This page is rendered from a real run on every docs build — every value below was computed by the engine, not typed out. The notebook itself is ordinary Python you can download and run.
marimo edit examples/notebooks/03_a_graph_that_has_not_run.py # as a notebook
python examples/notebooks/03_a_graph_that_has_not_run.py # or as a plain script3 — A graph that has not run
A Ligase pipeline is built from the signatures of its steps. The bodies are never called while the graph is assembled, so a pipeline can be wrong in a way you find out about immediately rather than after an overnight run.
samples = lg.samples(str(fixtures / 'reads_*_1.fastq'), organism='test')
samples.ids('reads_ambiguous', 'reads_phred33', 'reads_phred64')calls = {'n': 0}
@lg.step(tool='minimap2')
def align(reads: lg.Reads, ref: lg.Reference) -> lg.Alignment:
calls['n'] += 1
return lg.sh('minimap2 -ax sr {ref} {reads} | samtools sort -o {out}')reference = lg.reference(str(fixtures / 'tiny_bare.fasta'), organism='test')
pipeline = lg.Pipeline(samples.map(lambda s: align(s, reference)))
steps = pipeline.stepsOne branch per sample, none of them run
The graph has 3 step(s) fanned out over
3 samples — reads_ambiguous, reads_phred33, reads_phred64.
And the body’s counter still reads 0. Not “zero because
it failed”: zero because building a graph does not call anything. That
is what makes check cheap enough to run every time.
problems = pipeline.errors()
problems[]The verdict
check() passes — every step’s dimensions line up.