Skip to content
Snippets Groups Projects
Commit d4dcb0b9 authored by Bienchen's avatar Bienchen
Browse files

Deal with 'nan' coordinates.

parent d446530a
Branches
No related tags found
No related merge requests found
......@@ -261,9 +261,23 @@ def _get_sequence(chn, use_auth=False):
return sqe
class _InvalidCoordinateError(RuntimeError):
"""Exception for weird coordinates ina PDB file, used internally to skip
such PDB files."""
def _get_entities(pdb_file, fam_name):
"""Gather data for the mmCIF (target) entities."""
ost_ent = io.LoadPDB(pdb_file)
try:
ost_ent = io.LoadPDB(pdb_file)
except Exception as exc:
if str(exc).startswith("invalid coordinate on line "):
_warn_msg(
f"PDB file '{pdb_file}' containes invalid coordinate(s)."
)
raise _InvalidCoordinateError() from exc
_warn_msg(f"Exception for '{pdb_file}'")
raise
if ost_ent.chain_count != 1:
raise RuntimeError(f"Unexpected oligomer in {pdb_file}")
chn = ost_ent.chains[0]
......@@ -579,11 +593,14 @@ def _main():
print(f"Processing {n_mdls} models.")
tmstmp = s_tmstmp
for f_name in sorted(pdb_files):
_translate2modelcif(
f_name,
opts,
)
n_mdls -= 1
try:
_translate2modelcif(
f_name,
opts,
)
except _InvalidCoordinateError:
continue
# report progress after a bit of time
if timer() - tmstmp > 60:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment