# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import sys
sys.path.insert(0, "../")
import pyErrorPred
import numpy as np

# +
# Get filenames of original pdb and predictions
predname = '/projects/ml/for/docking/output_pdbs/longxing_HEEH_14976_000000014_0001_0001.npz'
pdbname  = '/projects/ml/for/docking/pdbs/longxing_HEEH_14976_000000014_0001_0001.pdb'

# Load prediction
pred = np.load(predname)

# Get inter and intra interaction masks
# Returns interface map, chainA map, and chainB map
imap, [map1, map2] = pyErrorPred.get_interaction_map(pdbname)

# +
# Good for analyzing monomer
global_lddt    = np.mean(pyErrorPred.get_lddt(pred["estogram"], pred["mask"]))

# Good for analyzing binder + target
interface_lddt = np.mean(pyErrorPred.get_lddt(pred["estogram"], np.multiply(imap, pred["mask"])))
chainA_lddt    = np.mean(pyErrorPred.get_lddt(pred["estogram"], np.multiply(map1, pred["mask"])))
chainB_lddt    = np.mean(pyErrorPred.get_lddt(pred["estogram"], np.multiply(map2, pred["mask"])))

# Best metric for binder + target (with chainA as binder of course)
score          = interface_lddt+chainA_lddt

StarcoderdataJupyterScriptsDedupFiltered