Skip to content

Commit

Permalink
Load from bcif.gz; add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed May 20, 2024
1 parent 2607fff commit 5ba5767
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions layer3/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3693,6 +3693,7 @@ ExecutiveLoadPrepareArgs(PyMOLGlobals * G,
case cLoadTypeSDF2Str:
case cLoadTypeXYZStr:
case cLoadTypeDXStr:
case cLoadTypeBCIFStr:
if (!content) {
return pymol::Error("content is nullptr");
}
Expand All @@ -3715,6 +3716,7 @@ ExecutiveLoadPrepareArgs(PyMOLGlobals * G,
case cLoadTypeSDF2:
case cLoadTypeXYZ:
case cLoadTypeDXMap:
case cLoadTypeBCIF:
if (content) {
fname_null_ok = true;
break;
Expand Down
3 changes: 2 additions & 1 deletion modules/pymol/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def _reverse_lookup(cls, number):
loadable.map : loadable.mapstr,
loadable.dx : loadable.dxstr,
loadable.xyz : loadable.xyzstr,
loadable.sdf2 : loadable.sdf2str}
loadable.sdf2 : loadable.sdf2str,
loadable.bcif : loadable.bcifstr}

sanitize_alpha_list_re = re.compile(r"[^a-zA-Z0-9_\'\"\.\-\[\]\,]+")
nt_hidden_path_re = re.compile(r"\$[\/\\]")
Expand Down
3 changes: 3 additions & 0 deletions modules/pymol/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def filename_to_format(filename):
format = 'cif'
elif ext in ('bcif',):
format = 'bcif'
elif ext in ('bcifgz',):
format = 'bcif'
zipped = 'gz'
elif re.match(r'pdb\d+$', ext):
format = 'pdb'
elif re.match(r'xyz_\d+$', ext):
Expand Down
Binary file added testing/data/115d.bcif.gz
Binary file not shown.
8 changes: 8 additions & 0 deletions testing/tests/api/test_importing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pymol import cmd
from pymol import test_utils


@test_utils.requires_version("3.0")
def test_bcif():
cmd.load(test_utils.datafile("115d.bcif.gz"))
assert cmd.count_atoms() == 407

0 comments on commit 5ba5767

Please sign in to comment.