feat(schema): 2.1 types, fragments, and JSON Schemas

Add the term, equation, value, and misconception registries
(src/model/course/glossary.rs) and the new optional fields on objectives,
targets, lectures, readings, bank options, and policy. Load registry
entries from objective files, glossary.yaml, and course.yaml, with one
definition site per id as for every other registry. Port every edit in
docs/design/2.1/build_schemas.py into the hand-written schema builders,
add glossary.schema.json, and test the generated schemas against the
targets; the only differences are two 2.0 spellings the code already had.

The 2.0 example fragments load and validate unchanged. The 2.1 example
bank gains `status: draft`, which every coursebank item requires.
tests/docs.rs skips docs/design/, which holds design records rather than
guide pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
alexmandClaude committed 2026-11-16 11:55:18 -05:00
1 parent 15175f64fd
commit 51a2fd235f
47 files changed
+10568 -55

No files matched your search

@@ -0,0 +1,129 @@
# objectives/lo-alignment-recurrence.yaml (coursebank 2.1)
#
# One objective, its targets, and the glossary entries its targets are the first to need. The terms, equation,
# value, and misconceptions defined here are course-wide: any later target lists them by id, and nothing redefines them.
# Fields marked student-facing render on the lecture page; `authoring` and `notes_private` never do.
learning_objectives:
lo-alignment-recurrence:
text: 'Use the dynamic-programming recurrence to produce an optimal alignment, and predict how the result moves when the scoring changes.'
description: >-
Two short sequences already have more alignments than anyone could score one at a time. The recurrence finds the
best one anyway, by scoring every pair of prefixes once and reusing those scores ({eq-global-recurrence}). This
objective is the method the rest of the unit builds on: database search in the next lecture is this table with
most of its cells skipped.
unit: u1
level_ceiling: 4
prerequisites: [lo-alignment-scoring]
tags: [alignment, algorithms]
learning_targets:
t-align-fill-matrix:
text: 'Given a match, mismatch, and gap scheme and two short sequences, determine the optimal global alignment score by filling the matrix from the recurrence, and read the alignment off the traceback.'
objective: lo-alignment-recurrence
level_ceiling: 3
prerequisites: [t-align-matrix-terms]
tags: [alignment, algorithms]
explanation: >-
Each cell holds the best score for aligning the two prefixes that end there, and it is the best of three
offers: the diagonal neighbour plus the score of pairing the two letters, or either other neighbour minus the
{term-gap-penalty}. The first row and column are all gaps. The bottom-right cell is the optimal score, and
following each cell back to the neighbour that won it gives the alignment ({term-traceback}).
terms: [term-alignment-matrix, term-gap-penalty, term-substitution-score, term-traceback]
equations: [eq-global-recurrence]
values: [val-alignment-count-100]
misconceptions: [mis-only-matches-count]
authoring:
ceiling_item: 'Supply a 3 by 3 matrix with all but the last cell filled and ask for the last cell and the traceback it starts.'
supplied: ['the scoring scheme', 'the two sequences', 'all but one or two cells of the matrix']
constraints: ['keep each sequence to four letters or fewer, or supply a partly filled matrix: a full 5 by 5 fill runs past the two-minute budget']
number_work: 'one addition and a three-way comparison per cell, a few seconds each'
examples: ['the two short globin fragments in the lecture worked example']
t-align-gap-penalty-effect:
text: 'Predict how raising the gap penalty changes the optimal path through the matrix.'
objective: lo-alignment-recurrence
level_ceiling: 3
prerequisites: [t-align-fill-matrix]
tags: [alignment]
explanation: >-
A larger {term-gap-penalty} makes every horizontal or vertical step cost more, so the diagonal wins more cells
and the optimal path uses fewer gaps, accepting mismatches it would have avoided before.
terms: [term-gap-penalty]
equations: [eq-global-recurrence]
authoring:
ceiling_item: 'Show the optimal path under d = 1 and ask which path wins under d = 4.'
supplied: ['the two sequences', 'the optimal path under the lower penalty']
relation_form: direction
t-align-local-vs-global-diagnose:
text: 'Given two sequences that share one conserved region, and the global and local optimal alignments of them, determine which alignment answers whether the region is shared and which assumption the other one violates.'
objective: lo-alignment-recurrence
level_ceiling: 4
prerequisites: [t-align-fill-matrix]
tags: [alignment]
explanation: >-
Global alignment assumes the sequences are related end to end, so it pays for every unrelated flank and can bury a
shared region under gap and mismatch costs. Local alignment drops that assumption: any cell may restart at zero,
so the best region is found wherever it sits.
terms: [term-global-alignment, term-local-alignment]
equations: [eq-global-recurrence]
misconceptions: [mis-local-is-trimmed-global]
authoring:
ceiling_item: 'Give both alignments and their scores, and ask which supports the claim that the region is shared and why the other misleads.'
supplied: ['both sequences', 'both optimal alignments with their scores']
relation_form: misuse
terms:
term-traceback:
term: traceback
definition: 'Following each cell of a filled alignment matrix back to the neighbour that gave it its score, from the last cell to the first, to read off the alignment.'
term-global-alignment:
term: global alignment
definition: 'An alignment of two sequences from end to end, every letter of both included.'
term-local-alignment:
term: local alignment
definition: 'The best-scoring alignment of any part of one sequence with any part of the other.'
equations:
eq-global-recurrence:
name: the global alignment recurrence
tex: 'F(i,j) = \max\begin{cases} F(i-1,j-1) + s(x_i, y_j) \\ F(i-1,j) - d \\ F(i,j-1) - d \end{cases}'
says: >-
The best score for the first i letters of one sequence against the first j of the other is the best of three
moves into that cell: pair the two last letters, or put a gap against one of them.
symbols:
- { symbol: 'F(i,j)', meaning: 'the best score for aligning the first i letters of x with the first j letters of y' }
- { symbol: 's(x_i, y_j)', term: term-substitution-score }
- { symbol: 'd', term: term-gap-penalty }
implications:
- { form: direction, statement: 'Raising {term-gap-penalty} makes the diagonal win more cells, so optimal alignments use fewer gaps.' }
- { form: held_fixed, statement: 'Two optimal scores can be compared only under the same scoring scheme; the scheme sets the scale.' }
- { form: misuse, statement: 'A high global score does not show that any one region is shared: unrelated flanks lower it and a strong region can hide in it.' }
assumes:
- 'Each gap position costs the same, whatever its neighbours.'
- 'A column''s score depends only on the two letters in it.'
- 'Both sequences are related from end to end.'
fails_when:
- 'Gaps come in long runs, which a linear penalty charges too much for; an affine penalty fits better.'
- 'The sequences share only a region, which global alignment can bury; local alignment finds it.'
recall: true
source: { ref: durbin1998biological, locator: 'ch. 2' }
values:
val-alignment-count-100:
name: number of global alignments of two 100-letter sequences
value: 1.0e+59
say: 'about 10^{59}'
exact: 9.05e+58
source: { ref: durbin1998biological, locator: 'ch. 2' }
conflicts: ['10\^\{?100\}?\s*alignments']
recall: false
misconceptions:
mis-local-is-trimmed-global:
belief: 'A local alignment is the global alignment with its unmatched ends trimmed off.'
correction: 'Local alignment changes the recurrence: any cell can restart at zero, so its best region can sit where the global path never passes.'
error_type: misconception
evidence:
- { kind: instructor, detail: 'Asked in office hours most terms.' }