just_dna_enricher.expression¶
just_dna_enricher.expression ¶
Fill expression_effects.csv from AlphaGenome's Atlas API (0.7, RM194 + RM200).
One row per (variant, gene): which way a variant moves that gene's predicted expression, how many
of the scorer's 371 tissue tracks agree, and how far the variant sits from the gene. A recording
pass, not a check — it is the source of the rows rather than a judge of them, so it writes no
verification record and adds no member to VALID_VERIFICATION_CHECKS, exactly as gwas.py does not.
RNA_SEQ is the only scorer here, and RM200 measured all twenty-two to say so. It is the only
one with a gene axis, the only one whose disagreement across tracks is meaningful rather than flat,
and the only one that attributes its own claim to a gene — which is what
@gene-map-is-another-sources-attribution requires. The rest either restate AVI_SCORE or rank
noise: CAGE's top-5 of 546 tracks carry 2-7% of the effect, running backwards to effect size.
Two ways to name the interval, and the gene filter is mandatory in both. --chrom/--start/--end
wins when given; otherwise the span comes from the MANE lane widened by the model's measured
±512 kb horizon (gene_spans). But gene is required either way, because the server-side gene
filter is not an optimisation: unfiltered, a 32 bp interval answers with 43 MB against grpc's 4 MB
receive limit, and atlas_client.score_interval refuses such a request before sending it.
Distance is recorded because a threshold without it is wrong. Scores 100-500 kb out run about an
order of magnitude lower than scores at the gene, so a flat --min-score silently keeps only the
proximal variants — which is the failure RM194 exists to prevent, not a tuning detail. Distance needs
the gene's span, so the MANE lane is consulted even when the interval was supplied by hand; when it
is absent, distance_to_gene is null and the pass says so rather than substituting an interval edge.
Non-commercial, and the gate runs before the RPC. Atlas Output is commercial_use=False — the
Output Terms say so in their opening sentence — so check_declared_use gates the fetch
(@acquisition-gate-is-not-a-read-gate). With no --use declared that returns a skip, which means a
no-flag run writes nothing and explains why; every documented invocation carries
--use non-commercial for that reason.
ExpressionError ¶
Bases: RuntimeError
This pass could not do its job. The local half — bad input, an unreadable sidecar, a refusal.
ExpressionUnavailable ¶
Bases: ExpressionError
The Atlas did not answer. Retryable, and its own type rather than a bare ExpressionError.
@client-exception-contract: a pass owes its own type too, and translating to an *Unavailable
subclass is what lets a caller tell "the service is down, try later" from "your input is wrong".
gwas.py is exempt from that guard only because its client and its pass share one error type
declared in one module; AtlasError lives in atlas_client, a foreign module, so this pass is
not exempt and does not claim to be.
ExpressionResult
dataclass
¶
ExpressionResult(
rows: list[ExpressionEffectRow] = list(),
gene: str | None = None,
interval: tuple[str, int, int] | None = None,
span: GeneSpan | None = None,
candidates: int = 0,
written: int = 0,
withheld: dict[str, int] = dict(),
warnings: list[str] = list(),
dataset: str | None = None,
skipped: bool = False,
)
What one run did, with every admitted candidate accounted for.
accounts_for_every_candidate ¶
Every admitted candidate was either written or counted under a named reason.
enrich_expression ¶
enrich_expression(
spec_dir: Path,
gene: str,
*,
chrom: str | None = None,
start: int | None = None,
end: int | None = None,
client=None,
mane_cache: Path | None = None,
min_score: float | None = None,
max_rows: int = DEFAULT_MAX_ROWS,
declared_use: str = "unstated",
dataset: str | None = None,
offline: bool = False,
write: bool = True,
) -> ExpressionResult
Query one gene's interval and merge the answers into expression_effects.csv.
Merge-not-clobber on (variant_key, gene): an existing row is authoritative and a re-run
gap-fills. Delete the file to re-derive it, which costs nothing because no authored judgement
lives in it.
Source code in enricher/src/just_dna_enricher/expression.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |