Skip to content
Snippets Groups Projects
Unverified Commit 2427d5b2 authored by Xavier Robin's avatar Xavier Robin
Browse files

fix: remove H with selection rather than Molck

This makes the ligand scoring script more independent of an up-to-date
compound library, which is a strong requirement of Molck.
This was a problem for the April 2023 Modeling Championship where the
script was run with an out of date library and the element of an atom of
the ligand was silently changed, preventing the symmetry correction to
find isomorphisms and resulting in the absence of scores.
parent f1a4ada3
No related branches found
Tags 2.0.0-rc
No related merge requests found
......@@ -60,8 +60,6 @@ import ost
from ost import conop
from ost import io
from ost.mol.alg import ligand_scoring
from ost.mol.alg import Molck, MolckSettings
def _ParseArgs():
......@@ -234,8 +232,6 @@ def _LoadStructure(structure_path, format="auto", fault_tolerant=False):
f"{structure_path}.")
format = ext[-1].lower()
# increase loglevel, as we would pollute the info log with weird stuff
ost.PushVerbosityLevel(ost.LogLevel.Error)
# Load the structure
if format in ["mmcif", "cif"]:
entity, seqres = io.LoadMMCIF(structure_path, seqres=True,
......@@ -250,22 +246,11 @@ def _LoadStructure(structure_path, format="auto", fault_tolerant=False):
raise Exception(f"Unknown/ unsupported file extension found for "
f"file {structure_path}.")
# Molck it
molck_settings = MolckSettings(rm_unk_atoms=True,
rm_non_std=False,
rm_hyd_atoms=True,
rm_oxt_atoms=False,
rm_zero_occ_atoms=False,
colored=False,
map_nonstd_res=False,
assign_elem=True)
# Cleanup a copy of the structures
Molck(entity, conop.GetDefaultLib(), molck_settings)
# restore old loglevel and return
ost.PopVerbosityLevel()
entity.SetName(structure_path)
return entity
# Remove hydrogens
cleaned_entity = ost.mol.CreateEntityFromView(entity.Select("ele != H"),
include_exlusive_atoms=False)
cleaned_entity.SetName(structure_path)
return cleaned_entity
def _LoadLigands(ligands):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment