File: PYMOL-2013.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (50 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'''
new feature: cartoon_gap_cutoff

Not very sophisticated test, just check if images with and without
setting differ.
'''

from pymol import cmd, CmdException, testing, stored

@testing.requires_version('1.8.1.0')
class TestPYMOL2013(testing.PyMOLTestCase):

    def test(self):
        cmd.set('cartoon_gap_cutoff', 0) # default varies by version

        self.ambientOnly()

        cmd.viewport(150, 150)
        cmd.load(self.datafile('1oky-frag.pdb'))
        cmd.cartoon('dash')
        cmd.show_as('cartoon')
        cmd.orient()

        # no gaps
        img_nogaps = self.get_imagearray()

        # gap of length 0
        cmd.unbond('96/C', '97/N')
        img_gap = self.get_imagearray()
        self.assertFalse((img_gap == img_nogaps).all())

        # close gap with setting, should match first image (special case)
        cmd.set('cartoon_gap_cutoff', 1) # exact cutoff
        img_gap = self.get_imagearray()
        self.assertTrue((img_gap == img_nogaps).all())

        # gap of length 1
        cmd.remove('92/')
        img_gap = self.get_imagearray()
        cmd.set('cartoon_gap_cutoff', 2) # exact cutoff
        img_nogaps = self.get_imagearray()
        self.assertFalse((img_gap == img_nogaps).all())

        # gap of length 3
        cmd.remove('102-104/')
        cmd.cartoon('auto') # default
        img_gap = self.get_imagearray()
        cmd.set('cartoon_gap_cutoff', 10) # arbitrary larger cutoff
        img_nogaps = self.get_imagearray()
        self.assertFalse((img_gap == img_nogaps).all())