| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| import sys | |
| ROOT_DIR = Path(__file__).resolve().parents[1] | |
| if str(ROOT_DIR) not in sys.path: | |
| sys.path.insert(0, str(ROOT_DIR)) | |
| import pandas as pd | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(description="Rescore docking batch with interface proxy") | |
| parser.add_argument("--input", required=True) | |
| parser.add_argument("--output", required=True) | |
| parser.add_argument("--interface-weight", type=float, default=1.0) | |
| args = parser.parse_args() | |
| df = pd.read_csv(args.input) | |
| if "interface_contact_proxy" not in df.columns: | |
| df["interface_contact_proxy"] = (-df["docking_score"]).clip(lower=0) / 10.0 | |
| df["final_score"] = df["docking_score"] - args.interface_weight * df["interface_contact_proxy"] | |
| out = Path(args.output) | |
| out.parent.mkdir(parents=True, exist_ok=True) | |
| df.to_csv(out, index=False) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |