Skip to content

just_dna_compiler.compiler.positional

just_dna_compiler.compiler.positional

Positional tables: the resolution fill for rows keyed by position, the joinability check, and the placement count.

positional_placement

positional_placement(
    rows_by_csv: dict[str, list[Any]],
) -> tuple[int, int]

(rows, placed) across the three positional table kinds — the counts the manifest publishes.

The structured half of _check_positional_joinability, which reports the same facts as prose per table (S31). Public because the number is what a catalog wants: until 0.6 the only record of how much of a PGx table joins to a VCF was UNJOINABLE_PHRASE inside manifest.compilation.warnings, and a downstream registry substring-matched it. Anything a consumer can only learn from a warning string is an unversioned interface (RM44).

Call it after _apply_positional_resolution, so placed counts what the artifact actually carries rather than what the author typed — the fill is where an rsid-authored PGx module gets its coordinates, and before it the answer is the pre-RM43 one.

A module carrying no positional table returns (0, 0), which is a real answer and distinct from the None the manifest holds for a compile that never counted; see Compilation.positional_rows.

Source code in compiler/src/just_dna_compiler/compiler/positional.py
def positional_placement(rows_by_csv: dict[str, list[Any]]) -> tuple[int, int]:
    """`(rows, placed)` across the three positional table kinds — the counts the manifest publishes.

    The structured half of `_check_positional_joinability`, which reports the same facts as prose per
    table (S31). Public because the number is what a catalog wants: until 0.6 the only record of how
    much of a PGx table joins to a VCF was `UNJOINABLE_PHRASE` inside `manifest.compilation.warnings`,
    and a downstream registry substring-matched it. Anything a consumer can only learn from a warning
    string is an unversioned interface (RM44).

    **Call it after `_apply_positional_resolution`**, so `placed` counts what the artifact actually
    carries rather than what the author typed — the fill is where an rsid-authored PGx module gets its
    coordinates, and before it the answer is the pre-RM43 one.

    A module carrying no positional table returns `(0, 0)`, which is a real answer and distinct from
    the `None` the manifest holds for a compile that never counted; see `Compilation.positional_rows`.
    """
    rows = [row for csv_name, _model in _POSITIONAL_TABLE_KINDS for row in rows_by_csv.get(csv_name) or []]
    placed = [row for row in rows if row.chrom is not None and row.start is not None]
    return len(rows), len(placed)