This file is indexed.

/usr/lib/python2.7/dist-packages/csb/bio/io/whatif.py is in python-csb 1.2.3+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Simple WhatIf/WhatCheck Summary parser
"""

import re
import os
import shutil

from csb.io import Shell
from csb.io import TempFolder

class WhatCheckParser(object):
    """
    Simple WhatIf/WhatCheck Summary parser
    """

    def __init__(self, binary='DO_WHATCHECK.COM'):
        self.binary = binary
    
    def parse_summary(self, fn):
        """
        @param fn: whatif pdbout.txt file to parse
        @type fn: str

        @return: A dict containing some of the WhatCheck results
        @rtype: a dict
        """
        f_handler = open(os.path.expanduser(fn))
        text = f_handler.read()

        info = dict()
        re_ramachandran = re.compile('Ramachandran\s*Z-score\s*:\s*([0-9.Ee-]+)')
        re_1st = re.compile('1st\s*generation\s*packing\s*quality\s*:\s*([0-9.Ee-]+)')
        re_2nd = re.compile('2nd\s*generation\s*packing\s*quality\s*:\s*([0-9.Ee-]+)')
        re_backbone = re.compile('Backbone\s*conformation\s*Z-score\s*:\s*([0-9.Ee-]+)')
        re_rotamer = re.compile('chi-1\S*chi-2\s*rotamer\s*normality\s*:\s*([0-9.Ee-]+)')
        

        info['rama_z_score'] = float(re_ramachandran.search(text).groups(0)[0])
        info['bb_z_score'] = float(re_backbone.search(text).groups(0)[0])
        info['1st_packing_z_score'] = float(re_1st.search(text).groups(0)[0])
        info['2nd_packing_z_score'] = float(re_2nd.search(text).groups(0)[0])
        info['rotamer_score'] = float(re_rotamer.search(text).groups(0)[0])

        f_handler.close()
        return info

    parse = parse_summary


    def run(self, pdb_file):
        """
        Runs WhatCheck for the given pdbfile and parses the output.
        Will fail if the WhatCheck binary is not in the path.
        
        @param pdb_file: file to parse
        @return: dict of parsed values
        """
        wd = os.getcwd()
        base = os.path.basename(pdb_file)

        with TempFolder() as tmp:
            shutil.copy(os.path.expanduser(pdb_file), tmp.name)
            os.chdir(tmp.name)
            Shell.run('{0} {1}'.format(self.binary,
                                       os.path.join(tmp.name, base)))
            out = self.parse_summary(os.path.join(tmp.name, 'pdbout.txt'))
            os.chdir(wd)

        return out