"""Predict a supported source-specific pair without fitting or scoring.""" import argparse import hashlib import json from pathlib import Path import numpy as np from opal import load_model parser = argparse.ArgumentParser() parser.add_argument("--model-dir", type=Path, default=Path(__file__).resolve().parent) args = parser.parse_args() root = args.model_dir.resolve() assert hashlib.sha256((root / "manifest.json").read_bytes()).hexdigest() == "c3a1287c438f698acc3521c5a3c0495c040e426eb07e443d3b315cce087b3f81" model = load_model(root) a, b, context = 'Adagrasib@0.005uM:5d', 'Capecitabine@0.5uM:5d', 'CVCL_0320' result = model.predict(a, b, context=context) reverse = model.predict(b, a, context=context) assert np.all(np.isfinite(result["effect"])) assert result["genes"].tolist() == model.manifest["gene_order"] np.testing.assert_allclose(result["effect"], reverse["effect"], rtol=0, atol=1e-10) print(json.dumps({"targets": [a, b], "context": context, "output_genes": len(result["genes"]), "scale": result.get("units", result.get("scale")), "first_five_effects": result["effect"][:5].tolist()}))