This file is indexed.

/usr/lib/python2.7/dist-packages/chempy/mol2.py is in pymol 1.7.0.0-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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* copyright Schrodinger LLC.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove this copyright notice.
#F* -------------------------------------------------------------------
#G* Please see the accompanying LICENSE file for further information. 
#H* -------------------------------------------------------------------
#I* Additional authors of this source file include:
#-* 
#-* 
#-*
#Z* -------------------------------------------------------------------

from chempy.models import Indexed
from chempy import Storage,Atom,Bond,feedback

import string

class MOL2(Storage):

    def __init__(self,**kwargs):
        if 'cmd' in kwargs:
            self.cmd = kwargs['cmd']
        else:
            self.cmd = None

    # RTIs
    _fields = { "alt_type"               : "@<TRIPOS>ALT_TYPE\n", 
                "anchor_atom"            : "@<TRIPOS>ANCHOR_ATOM\n", 
                "associated_annotation"  : "@<TRIPOS>ASSOCIATED_ANNOTATION\n", 
                "atom"                   : "@<TRIPOS>ATOM\n", 
                "bond"                   : "@<TRIPOS>BOND\n", 
                "center_of_mass"         : "@<TRIPOS>CENTER_OF_MASS\n", 
                "centroid"               : "@<TRIPOS>CENTROID\n", 
                "comment"                : "@<TRIPOS>COMMENT\n", 
                "crysin"                 : "@<TRIPOS>CRYSIN\n", 
                "dict"                   : "@<TRIPOS>DICT\n", 
                "data_file"              : "@<TRIPOS>DATA_FILE\n", 
                "extension_point"        : "@<TRIPOS>EXTENSION_POINT\n", 
                "ff_pbc"                 : "@<TRIPOS>FF_PBC\n", 
                "ffcon_angle"            : "@<TRIPOS>FFCON_ANGLE\n", 
                "ffcon_dist"             : "@<TRIPOS>FFCON_DIST\n", 
                "ffcon_multi"            : "@<TRIPOS>FFCON_MULTI\n", 
                "ffcon_range"            : "@<TRIPOS>FFCON_RANGE\n", 
                "ffcon_torsion"          : "@<TRIPOS>FFCON_TORSION\n", 
                "line"                   : "@<TRIPOS>LINE\n", 
                "lsplane"                : "@<TRIPOS>LSPLANE\n", 
                "molecule"               : "@<TRIPOS>MOLECULE\n", 
                "normal"                 : "@<TRIPOS>NORMAL\n", 
                "qsar_align_rule"        : "@<TRIPOS>QSAR_ALIGN_RULE\n", 
                "ring_closure"           : "@<TRIPOS>RING_CLOSURE\n", 
                "rotatable_bond"         : "@<TRIPOS>ROTATABLE_BOND\n", 
                "search_dist"            : "@<TRIPOS>SEARCH_DIST\n", 
                "search_options"         : "@<TRIPOS>SEARCH_OPTIONS\n", 
                "set"                    : "@<TRIPOS>SET\n", 
                "substructure"           : "@<TRIPOS>SUBSTRUCTURE\n", 
                "u_feat"                 : "@<TRIPOS>U_FEAT\n", 
                "unity_atom_attr"        : "@<TRIPOS>UNITY_ATOM_ATTR\n", 
                "unity_bond_attr"        : "@<TRIPOS>UNITY_BOND_ATTR\n" }

    _molType = { "small"            : "SMALL\n",
                 "bio"              : "BIOPOLYMER\n",
                 "prot"             : "PROTEIN\n",
                 "nuc"              : "NUCLEIC_ACID\n",
                 "sacc"             : "SACCHARIDE\n" }

    _chargeType = { "none"          : "NO_CHARGES\n",
                    "del"           : "DEL_RE\n",
                    "gast"          : "GASTEIGER\n",
                    "gast_h"        : "GAST_HUCK\n",
                    "huck"          : "HUCKEL\n",
                    "pull"          : "PULLMAN\n",
                    "gauss80"       : "GAUSS80_CHARGES\n",
                    "ampac"         : "AMPAC_CHARGES\n",
                    "mull"          : "MULLIKEN_CHARGES\n",
                    "dict"          : "DICT_ CHARGES\n",
                    "mmff94"        : "MMFF94_CHARGES\n",
                    "user"          : "USER_CHARGES\n" }

    _bondTypes = { 1         : "1",
                   2         : "2",
                   3         : "3",
                   "amide"          : "am",
                   4       : "ar",
                   "dummy"          : "du",
                   "unknown"        : "un",
                   0                : "nc",
                   "not_connected"  : "nc" }
                   

    def fromList(self,molList):
        pass
    
    def toList(self,model,**kwargs):
        molList = []

        if 'state' in kwargs:
            state = kwargs['state']
        else:
            state = None
        if 'selection' in kwargs:
            sel = kwargs['selection']
        else:
            sel = None

        f = MOL2._fields
        c = MOL2._chargeType
        m = MOL2._molType
        n = "\n"
        
        molList.append("# created with PyMOL")
        if model.molecule.comments!='':
            molList.append("# COMMENTS:"+n)
            molList.append("# " + model.molecule.comments)

        # RTI MOLECULE
        molList.append(n+f["molecule"])
        molList.append(model.molecule.title+n)
        subst=feat=sets=0
        molList.append("%d\t%d\t%d\t%d\t%d\n" % (model.nAtom,model.nBond,subst,feat,sets))
        # TODO: Guess this from the user's selection
        mKey="prot"
        ## if self.cmd!=None and state!=None and sel!=None:
        ##     nPoly = self.cmd.count_atoms("poly and (%s and state %s)" % (sel,state))
        ##     nOrg = self.cmd.count_atoms("org and (%s and state %s)" % (sel,state))
        ##     nIno = self.cmd.count_atoms("inorganic and (%s and state %s)" % (sel,state))
        ##     nNuc = self.cmd.count_atoms("(resn DA+DG+DC+DT+A+C+G+U) and (%s and state %s)" (sel,state))
        ##     # not too happy w/this
        ##     # - poly
        ##     if nPoly==0:
        ##         # - nuc
        ##         if nNuc==0:
        ##             # - org
        ##             if nOrg==0:
        ##                 # - ino
        ##                 if nIno==0:
        ##                     # what are you?!
        ##                     # you have no polymer, no organic, no nucleic, no inorganic
        ##                     # default, is wrong, but so are the others
        ##                     mKey = "prot"
        ##                 # ino - all
        ##                 else:
        ##                     mKey = "small"
        ##             # org
        ##             else:
        ##                 mKey = "small"
        ##         # nuc
        ##         else:
        ##             if nIno==0 and nOrg==0:
        ##                 mKey = "nuc"
        ##             else:
        ##                 mKey = "bio"
        ##     # poly
        ##     else:
        ##         mKey="prot"
            
        molList.append(m[mKey])
        # TODO: Guess this
        molList.append(c["user"])

        # RTI ATOM
        molList.append(f["atom"])
        for a in range(len(model.atom)):
            at = model.atom[a]
            molList.append("%d\t%4s\t%.3f\t%.3f\t%.3f\t%2s\t%.3f\n" %
                           (at.index,
                               at.name or at.symbol or "X",
                               at.coord[0],at.coord[1],at.coord[2],
                            at.text_type, at.q))

        # RTI BOND
        molList.append(f["bond"])
        for b in range(len(model.bond)):
            bo = model.bond[b]
            bOrder = MOL2._bondTypes[bo.order]
            molList.append("%d %d %d %s\n" % (b,1+bo.index[0],1+bo.index[1],str(bOrder)))
        molList.append("\n")
        return molList

    def strToFile(self,dat,fname,**params):
        if feedback['io']:
            print ' chempy: writing mol2 to file "%s".' % fname
        fp = open(fname,'w')
        result = fp.writelines(dat)
        fp.close()