PGx phenotypes: pgx phenotype|annotate (PGX-024..028, CLI-034)
CPIC lookups by allele function counts or activity values (duplications N x activity, *5/*0 = 0, total-score fallback), Indeterminate when feasible solutions disagree or an allele is not in the guideline; per-sample simurg.pgx/1 JSON and diplotype_annotations.tsv with PGX-026 metadata lines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01814GKVzZVL3FuF3DeiZXhv
This commit is contained in:
1 parent
ef1a608ee8
commit
0215af9c9c
7 files changed
+338
-1
No files matched your search
@@ -869,6 +869,47 @@ def pgx_star_call_cmd(
|
||||
run_guarded(rep, lambda: run_star_call(o, rep))
|
||||
|
||||
|
||||
def _pgx_phenotype(calls: Path, db: Path, out: Path | None, guideline: str, force: bool, log_json: bool,
|
||||
debug: bool, quiet: bool, name: str) -> None: # fmt: skip
|
||||
from simurg.pipeline.pgx_pheno import PhenoOptions, run_phenotype
|
||||
|
||||
if guideline not in ("cpic", "dpwg"):
|
||||
raise typer.BadParameter("--guideline cpic|dpwg")
|
||||
rep = _reporter(name, out or calls, log_json, debug, quiet)
|
||||
o = PhenoOptions(calls=calls, db=db, out=out, guideline=guideline, force=force)
|
||||
run_guarded(rep, lambda: run_phenotype(o, rep))
|
||||
|
||||
|
||||
@pgx_app.command("phenotype")
|
||||
def pgx_phenotype_cmd(
|
||||
calls: Annotated[Path, typer.Option("--calls", help="Output folder of pgx star-allele call (required).")],
|
||||
db: Annotated[Path, typer.Option("--db", help="PGx DB (required).")],
|
||||
out: Annotated[Path | None, typer.Option("--out", help="Output folder (default: --calls).")] = None,
|
||||
guideline: Annotated[str, typer.Option("--guideline", help="cpic|dpwg")] = "cpic",
|
||||
force: ForceOpt = False,
|
||||
log_json: LogJson = False,
|
||||
debug: Debug = False,
|
||||
quiet: Quiet = False,
|
||||
) -> None:
|
||||
"""Phenotypes from star-allele calls: per-sample PGx JSON and diplotype_annotations.tsv (CLI-034)."""
|
||||
_pgx_phenotype(calls, db, out, guideline, force, log_json, debug, quiet, "pgx phenotype")
|
||||
|
||||
|
||||
@pgx_app.command("annotate", hidden=True)
|
||||
def pgx_annotate_cmd(
|
||||
calls: Annotated[Path, typer.Option("--calls")],
|
||||
db: Annotated[Path, typer.Option("--db")],
|
||||
out: Annotated[Path | None, typer.Option("--out")] = None,
|
||||
guideline: Annotated[str, typer.Option("--guideline")] = "cpic",
|
||||
force: ForceOpt = False,
|
||||
log_json: LogJson = False,
|
||||
debug: Debug = False,
|
||||
quiet: Quiet = False,
|
||||
) -> None:
|
||||
"""Alias of pgx phenotype (CLI-034)."""
|
||||
_pgx_phenotype(calls, db, out, guideline, force, log_json, debug, quiet, "pgx annotate")
|
||||
|
||||
|
||||
@pgx_cn_app.command("train")
|
||||
def pgx_cn_train_cmd(
|
||||
gtcs: Annotated[Path, typer.Option("--gtcs", help="Folder searched recursively for training GTCs (required).")],
|
||||
|
||||
Reference in new issue
Block a user