Skip to content

Commit f64e032

Browse files
committed
Test for ccp4_ncont
1 parent a325809 commit f64e032

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

scripts/ccp4_ncont.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
AUTHOR
2424
Gerhard Reitmayr and Dalia Daujotyte, 2009.
2525
'''
26-
from __future__ import print_function
26+
from pathlib import Path
2727
from pymol import cmd
2828
import re
2929

@@ -83,3 +83,21 @@ def ccp4_ncont(contactsfile, selName1="source", selName2="target"):
8383
cmd.select(selName2 + "_atom", atomSel)
8484

8585
cmd.extend("ccp4_ncont", ccp4_ncont)
86+
87+
88+
def test_ccp4_ncont():
89+
datadir = Path(__file__).parents[1] / "files_for_examples"
90+
cmd.reinitialize()
91+
cmd.fab("PCQAFSISGKQKGFEDSRGTL", "m1", chain="A", resi=80)
92+
cmd.fnab("GCTGAC", "m2", dbl_helix=False)
93+
cmd.remove("hydro")
94+
cmd.alter("m2", "chain = 'C'")
95+
cmd.alter("m2", "resv += 407")
96+
cmd.alter("m2 & name O1P", "name = 'OP1'")
97+
cmd.alter("m2 & name O2P", "name = 'OP2'")
98+
cmd.alter("m2 & name O3P", "name = 'OP3'")
99+
ccp4_ncont(f"{datadir}/2c7r.ncont", selName1="sel1", selName2="sel2")
100+
assert cmd.count_atoms("sel1_res") == 23
101+
assert cmd.count_atoms("sel1_atom") == 5
102+
assert cmd.count_atoms("sel2_res") == 104
103+
assert cmd.count_atoms("sel2_atom") == 16

0 commit comments

Comments
 (0)