Beispiel #1
0
    def create_or_get_pocket_properties(self):
        self.pocket_props = {
            name: Property.objects.get_or_create(name=name,
                                                 description=desc)[0]
            for name, desc in fpocket_properties_map.items()
        }

        self.rsfpocker = ResidueSet.objects.get_or_create(name="FPocketPocket",
                                                          description="")[0]
import traceback

from Bio.PDB.PDBParser import PDBParser
from tqdm import tqdm

from SNDG import init_log, mkdir
from SNDG.Structure.ChainSplitter import ChainSplitter
from SNDG.Structure.FPocket import FPocket, fpocket_properties_map
from SNDG.Structure.PDBdb import *
from SNDG.Structure.PDBs import PDBs
from SNDG.Structure.QMean import QMean

init_log(rootloglevel=logging.INFO)
_log = logging.getLogger(__name__)

pocket_prop_map = {v: k for k, v in fpocket_properties_map.items()}


def process_chain(pdb_path, code, chain_id, pdb_model, props):
    chain_pdb_path = cs.make_pdb(pdb_path, code, chain_id, overwrite=True)
    qm = QMean.assesment(chain_pdb_path)
    residues_qm = qm["residues"]

    for k, v in residues_qm.items():
        chain, resid, resname = k.split("_")
        r = Residue.select().where(
            Residue.pdb == pdb_model & Residue.chain == chain
            & Residue.resid == int(resid)).first()
        for prop, val in v.items():
            prop_model = props["qr_" + prop]
            if not math.isnan(val):