diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/debian/changelog mgltools-molkit-1.5.7/debian/changelog --- mgltools-molkit-1.5.7~rc1+cvs.20140424/debian/changelog 2014-04-24 15:42:26.000000000 +0000 +++ mgltools-molkit-1.5.7/debian/changelog 2016-07-08 15:55:29.000000000 +0000 @@ -1,3 +1,10 @@ +mgltools-molkit (1.5.7-1) unstable; urgency=medium + + * New upstream version (Closes: #767144,#783547, + lp:#821299,lp:1386091,lp:#1386163,lp:#1492762) + + -- Steffen Moeller Fri, 08 Jul 2016 17:55:29 +0200 + mgltools-molkit (1.5.7~rc1+cvs.20140424-1) unstable; urgency=medium * New upstream version. diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/debian/control mgltools-molkit-1.5.7/debian/control --- mgltools-molkit-1.5.7~rc1+cvs.20140424/debian/control 2013-06-01 16:12:00.000000000 +0000 +++ mgltools-molkit-1.5.7/debian/control 2016-07-08 15:55:29.000000000 +0000 @@ -1,21 +1,31 @@ Source: mgltools-molkit -Section: non-free/science -Priority: optional Maintainer: Debian Med Packaging Team -XS-Autobuild: yes Uploaders: Steffen Moeller , - Sargis Dallakyan , - Andreas Tille , - Thorsten Alteholz -Build-Depends: debhelper (>= 8), python-all (>= 2.6), python-numpy, swig -Standards-Version: 3.9.4 -Vcs-Browser: http://svn.debian.org/wsvn/debian-med/trunk/packages/mgltools/molkit/trunk/ -Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/mgltools/molkit/trunk/ + Sargis Dallakyan , + Andreas Tille , + Thorsten Alteholz +Section: non-free/science +XS-Autobuild: yes +Priority: optional +Build-Depends: debhelper (>= 9), + python-all, + python-numpy, + swig, + dh-python +Standards-Version: 3.9.8 +Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/mgltools/molkit/trunk/ +Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/mgltools/molkit/trunk/ Homepage: http://mgltools.scripps.edu/ Package: mgltools-molkit Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, mgltools-pybabel, mgltools-dejavu, mgltools-bhtree, mgltools-sff, python-numpy +Depends: ${misc:Depends}, + ${python:Depends}, + mgltools-pybabel, + mgltools-dejavu, + mgltools-bhtree, + mgltools-sff, + python-numpy Recommends: mgltools-cmolkit Suggests: pdb2pqr Description: Python classes to read and manipulate molecules diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/amberPrmTop.py mgltools-molkit-1.5.7/MolKit/amberPrmTop.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/amberPrmTop.py 2007-07-24 17:30:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/amberPrmTop.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################ # # Author: Ruth HUEY, Michel F. SANNER @@ -8,16 +6,17 @@ # ############################################################################# -# $Header: /opt/cvs/python/packages/share1.5/MolKit/amberPrmTop.py,v 1.32 2007/07/24 17:30:40 vareille Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/amberPrmTop.py,v 1.32.10.1 2016/02/12 01:12:48 annao Exp $ # -# $Id: amberPrmTop.py,v 1.32 2007/07/24 17:30:40 vareille Exp $ +# $Id: amberPrmTop.py,v 1.32.10.1 2016/02/12 01:12:48 annao Exp $ # #from MolKit.molecule import Atom, AtomSet, Bond from sff.amber import AmberParm -import numpy.oldnumeric as Numeric, types +import numpy +import types from math import pi, sqrt, ceil, fabs from string import split, strip, join from os.path import basename @@ -1067,7 +1066,7 @@ def getICO(self, ntypes): ct = 1 - icoArray = Numeric.zeros((ntypes, ntypes), 'i') + icoArray = numpy.zeros((ntypes, ntypes), 'i') for i in range(1, ntypes+1): for j in range(1, i+1): icoArray[i-1,j-1]=ct diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/APBSParameters.py mgltools-molkit-1.5.7/MolKit/APBSParameters.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/APBSParameters.py 2009-09-23 01:34:50.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/APBSParameters.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,9 +1,7 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/APBSParameters.py,v 1.24 2009/09/23 01:34:50 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/APBSParameters.py,v 1.24.6.1 2016/02/12 01:12:48 annao Exp $ # -# $Id: APBSParameters.py,v 1.24 2009/09/23 01:34:50 sanner Exp $ +# $Id: APBSParameters.py,v 1.24.6.1 2016/02/12 01:12:48 annao Exp $ # import os, types diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/bondSelector.py mgltools-molkit-1.5.7/MolKit/bondSelector.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/bondSelector.py 2013-09-23 19:39:16.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/bondSelector.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################# # # Authors: Ruth Huey, William M. Lindstrom @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/bondSelector.py,v 1.28 2013/09/23 19:39:16 rhuey Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/bondSelector.py,v 1.26.2.1 2016/02/12 01:12:48 annao Exp $ # -# $Id: bondSelector.py,v 1.28 2013/09/23 19:39:16 rhuey Exp $ +# $Id: bondSelector.py,v 1.26.2.1 2016/02/12 01:12:48 annao Exp $ # # # @@ -26,7 +24,8 @@ from PyBabel.bo import BondOrder from PyBabel.aromatic import Aromatic from PyBabel.atomTypes import AtomHybridization -import math, numpy.oldnumeric as Numeric +import math +import numpy class BondSelector: @@ -364,15 +363,6 @@ ct = 1 for ring in rf.rings: blist = ring['bonds'] - len_blist = len(blist) - ring_elements = set(AtomSet(ring['atoms']).element) - #SF 6/2013 - #verify that coplanarity - if (len_blist<5): - continue - if len_blist==5: - if not ('N' in ring_elements) and not ('S' in ring_elements) and not ('O' in ring_elements): - continue for bnd in blist: at = bnd.atom1 #next find the other bond in this cycle with at as one of the atoms: @@ -390,10 +380,10 @@ pt1 = at1.coords pt2 = at2.coords pt3 = at3.coords - a1 = Numeric.subtract(pt2,pt1) - b1 = Numeric.subtract(pt3,pt2) + a1 = numpy.subtract(pt2,pt1) + b1 = numpy.subtract(pt3,pt2) p = [a1[1]*b1[2]-a1[2]*b1[1],a1[2]*b1[0]-a1[0]*b1[2],a1[0]*b1[1]-a1[1]*b1[0]] - result0 = Numeric.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]) + result0 = numpy.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]) bnd.nrmsize = result0 result1 = p bnd.nrms = result1 @@ -420,7 +410,7 @@ #theta is the critical test for planarity: #if angle between 2 nrms is 0, atoms are planar #NB>test is comparing theta,cos(angle), w/zero - bnd.theta = Numeric.dot(p,q)/(psize*qsize) + bnd.theta = numpy.dot(p,q)/(psize*qsize) #NB: REPEAT STUFF FROM HERE TO THE END IF aromaticCutOff changes ct = 0 for bnd in blist: @@ -535,34 +525,27 @@ def select(self, bnds, detectAll=False): # first pass: taken from autotorsCommands # bondOrder==1 + #THIS IS WRONG! 4/22: guanidiniums possible but not active + #select the guanidiniums + ####guanidiniumBonds = GuanidiniumBondSelector().select(bnds) + #print "guanidiniumBonds=", len(guanidiniumBonds) + ###possibleBnds = bnds.subtract(guanidiniumBonds) + ###rotatable = BondOrderBondSelector().select(possibleBnds) rotatable = BondOrderBondSelector().select(bnds,1) - #print "found ", len(rotatable), " rotatable bonds" - nonrotatable = BondOrderBondSelector().select(bnds,2) - #print "found ", len(nonrotatable), " bond order 2 bonds" - if len(nonrotatable): - for b in nonrotatable: - if b in rotatable: - rotatable.remove(b) + #select the leaves - #print "now there are ", len(rotatable), " rotatable bonds" leafBonds = LeafBondSelector().select(rotatable) - #print "found ", len(leafBonds), " leaf bonds" - rotatable = rotatable - leafBonds - #print " now there are ", len(rotatable), " rotatable bonds" + #select the cycles - cycleBonds = CycleBondSelector().select(rotatable, detectAll=detectAll) - #print " found ", len(cycleBonds), " cycleBonds" - #remove the cycleBonds - if len(cycleBonds): - if len(cycleBonds)==len(rotatable): - rotatable = BondSet() - else: - for b in cycleBonds: - try: - rotatable.remove(b) - except: - pass - #print "problem removing ", b, " from rotatable (line 564)" - #return remaining bonds: + cycleBonds = CycleBondSelector().select(rotatable,detectAll=detectAll) + #remove the cycle bonds and return the residue + #remove the bonds which are guanidinium bonds + ###4/22rotatable = rotatable.subtract(guanidiniumBonds) + #remove the leaves + rotatable = rotatable.subtract(leafBonds) + #remove the cycle bonds and return the residue + rotatable = rotatable.subtract(cycleBonds) + + #print "rotatable=", len(rotatable) return rotatable diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/data/rotamer.def mgltools-molkit-1.5.7/MolKit/data/rotamer.def --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/data/rotamer.def 1970-01-01 00:00:00.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/data/rotamer.def 2015-08-26 19:38:50.000000000 +0000 @@ -0,0 +1,86 @@ +# DO NOT edit this file unless you are aware of the details of Rotamer code +# to add rotamer for non-standard amino acid, append the chi (X) angle +# definition to the file. following the same format +# +# Yong Zhao +# + +# format: +# amino_acid_name a b c d X Y Z ... +# +# a,b,c,d are the four atom names that defines the dihedral angle. +# X Y Z... etc are the names of atoms that will be moved by this rotation. + +# attention: the angles are ordered. (cooresponding to X1,X2, X3.. etc) +# all data are seperated by (one or more) space/tab + +# ALA and GLY is not defined + +ARG N CA CB CG CG +ARG CA CB CG CD CD +ARG CB CG CD NE NE +ARG CG CD NE CZ CZ NH1 NH2 + +ASN N CA CB CG CG +ASN CA CB CG ND2 OD1 ND2 + +ASP N CA CB CG CG +ASP CA CB CG OD1 OD1 OD2 + +CYS N CA CB SG SG + + +GLN N CA CB CG CG +GLN CA CB CG CD CD +GLN CB CG CD OE1 OE1 NE2 + +GLU N CA CB CG CG +GLU CA CB CG CD CD +GLU CB CG CD OE1 OE1 OE2 + + +HIS N CA CB CG CG +HIS CA CB CG ND1 NE1 CE1 NE2 CD2 + +ILE N CA CB CG1 CG1 CG2 +ILE CA CB CG1 CD1 CD1 + + +LEU N CA CB CG CG +LEU CA CB CG CD1 CD1 CD2 + +LYS N CA CB CG CG +LYS CA CB CG CD CD +LYS CB CG CD CE CE +LYS CG CD CE NZ NZ + +MET N CA CB CG CG +MET CA CB CG SD SD +MET CB CG SD CE CE + + + +PHE N CA CB CG CG +PHE CA CB CG CD1 CD1 CD2 CE1 CE2 CZ + + +PRO N CA CB CG CG +PRO CA CB CG CD CD + + +SER N CA CB OG OG + +THR N CA CB CG2 CG2 OG1 + +TRP N CA CB CG CG +TRP CA CB CG CD1 CD1 CD2 NE1 CE2 CE3 CZ2 CZ3 CH2 + +TYR N CA CB CG CG +TYR CA CB CG CD1 CD1 CD2 CE1 CE2 CZ OH + + +VAL N CA CB CG1 CG1 CG2 + + + + diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/distanceSelector.py mgltools-molkit-1.5.7/MolKit/distanceSelector.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/distanceSelector.py 2007-07-24 17:30:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/distanceSelector.py 2016-02-18 00:24:41.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################# # # Author: Ruth Huey @@ -9,9 +7,9 @@ ############################################################################# -# $Header: /opt/cvs/python/packages/share1.5/MolKit/distanceSelector.py,v 1.10 2007/07/24 17:30:40 vareille Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/distanceSelector.py,v 1.10.10.2 2016/02/18 00:24:41 annao Exp $ # -# $Id: distanceSelector.py,v 1.10 2007/07/24 17:30:40 vareille Exp $ +# $Id: distanceSelector.py,v 1.10.10.2 2016/02/18 00:24:41 annao Exp $ # """ @@ -22,7 +20,8 @@ corresponding to key-value pairs in pairDict. """ -import numpy.oldnumeric as Numeric, types, string, math +import numpy +import types, string, math from molecule import AtomSet from protein import ResidueSet @@ -34,7 +33,7 @@ def __init__(self, return_dist=1, **kw): - self.func = Numeric.less + self.func = numpy.less self.return_dist = return_dist @@ -45,7 +44,7 @@ #test whether cutoff is 1 value or an array if not hasattr(cutoff, 'shape') and type(cutoff)==types.FloatType: #build array with shape (llen, slen) of value cutoff - return Numeric.array(Numeric.ones((llen, slen))*cutoff).astype('f') + return numpy.array(numpy.ones((llen, slen))*cutoff).astype('f') else: #might need to reshape cutoff ? assert cutoff.shape==(llen, slen) @@ -55,11 +54,11 @@ def mul(self, coords, mat): shape = coords.shape assert shape[-1]==3 - #coords = Numeric.reshape(coords, (-1, shape[-1])) - one = Numeric.ones((shape[0],1),'f') - c = Numeric.concatenate((coords, one),1) - coords = Numeric.array(Numeric.reshape(coords, shape)) - return Numeric.array(Numeric.dot(c, Numeric.transpose(mat))[:,:3]) + #coords = numpy.reshape(coords, (-1, shape[-1])) + one = numpy.ones((shape[0],1),'f') + c = numpy.concatenate((coords, one),1) + coords = numpy.array(numpy.reshape(coords, shape)) + return numpy.array(numpy.dot(c, numpy.transpose(mat))[:,:3]) def select(self, keyAts, checkAts, cutoff=3.0, percentCutoff=1.0, @@ -88,14 +87,14 @@ lenC = len(checkAts) #data arrays are used to find atoms with given indices quickly - atar = Numeric.array(checkAts.data) - keyAtar = Numeric.array(keyAts.data) + atar = numpy.array(checkAts.data) + keyAtar = numpy.array(keyAts.data) #basic arrays of coords used to build others - c = Numeric.array(checkAts.coords, 'f') + c = numpy.array(checkAts.coords, 'f') if checkMat: c = self.mul(c, checkMat) - k = Numeric.array(keyAts.coords, 'f') + k = numpy.array(keyAts.coords, 'f') if keyMat: k = self.mul(k, keyMat) @@ -103,7 +102,7 @@ # rows correspond to ats in larger set, columns to those in smaller # first build square matrix if lenC >= lenK: - bigC = Numeric.resize(c, (lenC, lenC, 3)) + bigC = numpy.resize(c, (lenC, lenC, 3)) k.shape = (lenK,1,3) bigM = bigC[:lenK] smallM = k @@ -113,7 +112,7 @@ cutoff.shape = (lenK, -1) else: - bigK = Numeric.resize(k, (lenK, lenK, 3)) + bigK = numpy.resize(k, (lenK, lenK, 3)) c.shape = (lenC,1,3) bigM = bigK[:lenC] smallM = c @@ -126,7 +125,7 @@ # distance squared matrix dSQ = d * d # next step sums deltaX**2, deltaY**2, deltaZ**2 - dSQMAT = Numeric.sum(dSQ,2) + dSQMAT = numpy.sum(dSQ,2) #percentCutoff lets user relax sum of radii #the smaller the percentCutoff the smaller the key @@ -136,13 +135,13 @@ #cutoffSQMAT = cutoffSQMAT * percentCutoff # ansMat has 1 where sq dist. is smaller than cutoff - ansMat = Numeric.logical_and(self.func(dSQMAT, cutoffSQMAT) , \ - Numeric.not_equal(dSQMAT, 0.)) + ansMat = numpy.logical_and(self.func(dSQMAT, cutoffSQMAT) , \ + numpy.not_equal(dSQMAT, 0.)) if lenK > lenC: # in this case need to rearrange matrix # which got shuffled in if-else above - ansMat = Numeric.swapaxes(ansMat, 0, 1) - dSQMAT = Numeric.swapaxes(dSQMAT, 0, 1) + ansMat = numpy.swapaxes(ansMat, 0, 1) + dSQMAT = numpy.swapaxes(dSQMAT, 0, 1) # finally, build result dictionaries which have atom keys: # pairDict has values which are lists of close atoms @@ -151,15 +150,15 @@ distDict = {} # get a list of rows which have non-zero entries # to loop over in next section - rowIndices = Numeric.nonzero(Numeric.sum(ansMat,1)) + rowIndices = numpy.nonzero(numpy.sum(ansMat,1))[0] # rows correspond to ats in keyAts # columns correspond to ats in checkAts for i in rowIndices: # atindex is a list [7 8 9] indexing into checkAts - atindex = Numeric.nonzero(ansMat[i]) + atindex = numpy.nonzero(ansMat[i])[0] # keyAtar[i] is ith atom in keyAts keyAt = keyAtar[i] - pairDict[keyAt] = Numeric.take(atar, atindex) + pairDict[keyAt] = numpy.take(atar, atindex, axis=0) if self.return_dist: distDict[keyAt] = [] for ind in atindex: @@ -199,7 +198,7 @@ def __init__(self, return_dist=1): DistanceSelector.__init__(self) - self.func = Numeric.greater + self.func = numpy.greater self.return_dist = return_dist @@ -215,11 +214,11 @@ lenC = len(bAts) lenK = len(sAts) #set up sum of radii cutoff matrix: - checkRadii = Numeric.array(bAts.vdwRadius, 'f') - bigRC = Numeric.resize(checkRadii, (lenC, lenC)) + checkRadii = numpy.array(bAts.vdwRadius, 'f') + bigRC = numpy.resize(checkRadii, (lenC, lenC)) bigR = bigRC[:lenK] - keyRadii = Numeric.array(sAts.vdwRadius, 'f') + keyRadii = numpy.array(sAts.vdwRadius, 'f') keyRadii.shape = (lenK, 1) smallR = keyRadii cutoff = bigR + smallR @@ -243,17 +242,17 @@ lenC = len(bAts) lenK = len(sAts) #set up sum of radii cutoff matrix: - checkRadii = Numeric.array(bAts.vdwRadius, 'f') - bigRC = Numeric.resize(checkRadii, (lenC, lenC)) + checkRadii = numpy.array(bAts.vdwRadius, 'f') + bigRC = numpy.resize(checkRadii, (lenC, lenC)) bigR = bigRC[:lenK] - keyRadii = Numeric.array(sAts.vdwRadius, 'f') + keyRadii = numpy.array(sAts.vdwRadius, 'f') keyRadii.shape = (lenK, 1) smallR = keyRadii cutoff = bigR + smallR - #create Numeric.ones of appropriate shape * self.const + #create numpy.ones of appropriate shape * self.const #add it to cutoff - constFactor = Numeric.ones(len(bigR.ravel()))*self.constant + constFactor = numpy.ones(len(bigR.ravel()))*self.constant #print "len(constFactor)=", len(constFactor) constFactor.shape = cutoff.shape #print "constFactor.shape=" , constFactor.shape diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/GapFinder.py mgltools-molkit-1.5.7/MolKit/GapFinder.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/GapFinder.py 2010-09-10 17:35:58.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/GapFinder.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # # #$Id @@ -15,11 +13,11 @@ -import numpy.oldnumeric as Numeric, math, types +import numpy +import math, types from molecule import Atom, AtomSet from protein import Residue from types import ListType, TupleType, StringType, IntType, FloatType, LongType -from numpy.oldnumeric import ArrayType, sum """ GapFinder contain class to find Gap between residues. findGap: This class finds the residues which are not connected. @@ -114,7 +112,7 @@ c1 = mat[num] c2 = mat[num+1] d = c2 - c1 - self.dists.append(math.sqrt(sum(d*d))) + self.dists.append(math.sqrt(numpy.sum(d*d))) return self.dists diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/getsecondarystructure.py mgltools-molkit-1.5.7/MolKit/getsecondarystructure.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/getsecondarystructure.py 2013-10-03 22:38:52.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/getsecondarystructure.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/getsecondarystructure.py,v 1.30 2013/10/03 22:38:52 annao Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/getsecondarystructure.py,v 1.29.2.1 2015/08/29 01:26:36 sanner Exp $ # -# $Id: getsecondarystructure.py,v 1.30 2013/10/03 22:38:52 annao Exp $ +# $Id: getsecondarystructure.py,v 1.29.2.1 2015/08/29 01:26:36 sanner Exp $ # """ diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/hydrogenBondBuilder.py mgltools-molkit-1.5.7/MolKit/hydrogenBondBuilder.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/hydrogenBondBuilder.py 2011-04-26 21:04:29.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/hydrogenBondBuilder.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################ # # Author: Ruth Huey @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/hydrogenBondBuilder.py,v 1.9 2011/04/26 21:04:29 rhuey Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/hydrogenBondBuilder.py,v 1.9.2.1 2016/02/12 01:12:48 annao Exp $ # -# $Id: hydrogenBondBuilder.py,v 1.9 2011/04/26 21:04:29 rhuey Exp $ +# $Id: hydrogenBondBuilder.py,v 1.9.2.1 2016/02/12 01:12:48 annao Exp $ # """ @@ -89,7 +87,8 @@ from MolKit.distanceSelector import DistanceSelector #needed for some math.. -import numpy.oldnumeric as Numeric, math +import numpy +import math #set up lists of types for donors/acceptors sp2Donors = ['Nam', 'Ng+', 'Npl'] @@ -106,8 +105,8 @@ def dist(c1, c2): - d = Numeric.array(c2) - Numeric.array(c1) - ans = math.sqrt(Numeric.sum(d*d)) + d = numpy.array(c2) - numpy.array(c1) + ans = math.sqrt(numpy.sum(d*d)) return round(ans, 3) @@ -118,17 +117,17 @@ acCoords = ac.coords hCoords = hat.coords dCoords = don.coords - pt1 = Numeric.array(acCoords, 'f') - pt2 = Numeric.array(hCoords, 'f') - pt3 = Numeric.array(dCoords, 'f') - #pt1 = Numeric.array(ac.coords, 'f') - #pt2 = Numeric.array(hat.coords, 'f') - #pt3 = Numeric.array(don.coords, 'f') - v1 = Numeric.array(pt1 - pt2) - v2 = Numeric.array(pt3 - pt2) - dist1 = math.sqrt(Numeric.sum(v1*v1)) - dist2 = math.sqrt(Numeric.sum(v2*v2)) - sca = Numeric.dot(v1, v2)/(dist1*dist2) + pt1 = numpy.array(acCoords, 'f') + pt2 = numpy.array(hCoords, 'f') + pt3 = numpy.array(dCoords, 'f') + #pt1 = numpy.array(ac.coords, 'f') + #pt2 = numpy.array(hat.coords, 'f') + #pt3 = numpy.array(don.coords, 'f') + v1 = numpy.array(pt1 - pt2) + v2 = numpy.array(pt3 - pt2) + dist1 = math.sqrt(numpy.sum(v1*v1)) + dist2 = math.sqrt(numpy.sum(v2*v2)) + sca = numpy.dot(v1, v2)/(dist1*dist2) if sca>1.0: sca = 1.0 elif sca<-1.0: @@ -139,7 +138,7 @@ def applyTransformation(pt, mat): pth = [pt[0], pt[1], pt[2], 1.0] - return Numeric.dot(mat, pth)[:3] + return numpy.dot(mat, pth)[:3] def getTransformedCoords(atom): diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/__init__.py mgltools-molkit-1.5.7/MolKit/__init__.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/__init__.py 2013-10-03 22:36:21.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/__init__.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -#$Header: /opt/cvs/python/packages/share1.5/MolKit/__init__.py,v 1.30 2013/10/03 22:36:21 annao Exp $ +#$Header: /opt/cvs/python/packages/share1.5/MolKit/__init__.py,v 1.29.2.1 2015/08/29 01:26:36 sanner Exp $ # -#$Id: __init__.py,v 1.30 2013/10/03 22:36:21 annao Exp $ +#$Id: __init__.py,v 1.29.2.1 2015/08/29 01:26:36 sanner Exp $ # import string diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/interactionDescriptor.py mgltools-molkit-1.5.7/MolKit/interactionDescriptor.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/interactionDescriptor.py 2010-05-16 18:08:17.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/interactionDescriptor.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################ # # Author: Ruth Huey @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/interactionDescriptor.py,v 1.22 2010/05/16 18:08:17 rhuey Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/interactionDescriptor.py,v 1.22.6.1 2016/02/12 01:12:48 annao Exp $ # -# $Id: interactionDescriptor.py,v 1.22 2010/05/16 18:08:17 rhuey Exp $ +# $Id: interactionDescriptor.py,v 1.22.6.1 2016/02/12 01:12:48 annao Exp $ # """ @@ -25,7 +23,7 @@ from PyBabel.cycle import RingFinder from PyBabel.aromatic import Aromatic from bondSelector import AromaticCycleBondSelector -import numpy.oldnumeric as Numeric +import numpy from mglutil.math import crossProduct @@ -390,9 +388,9 @@ #--------------------------------- # compute the normal to lig ring #--------------------------------- - a1 = Numeric.array(lig_atoms[0].coords) - a2 = Numeric.array(lig_atoms[2].coords) - a3 = Numeric.array(lig_atoms[4].coords) + a1 = numpy.array(lig_atoms[0].coords) + a2 = numpy.array(lig_atoms[2].coords) + a3 = numpy.array(lig_atoms[4].coords) if debug: print "a1,a2, a3=", a1.tolist(), a2.tolist(), a3.tolist() for macro_ring_bnds in macro_rings: macro_atoms = acbs.getAtoms(macro_ring_bnds) @@ -407,9 +405,9 @@ #--------------------------------- # compute the normal to macro ring #--------------------------------- - b1 = Numeric.array(macro_atoms[0].coords) - b2 = Numeric.array(macro_atoms[2].coords) - b3 = Numeric.array(macro_atoms[4].coords) + b1 = numpy.array(macro_atoms[0].coords) + b2 = numpy.array(macro_atoms[2].coords) + b3 = numpy.array(macro_atoms[4].coords) if debug: print "b1,b2, b3=", b1.tolist(), b2.tolist(), b3.tolist() # check for stacking a2_1 = a2-a1 @@ -424,10 +422,10 @@ n2 = crossProduct(b3_1,b2_1) #to get the normal for the second ring if debug: print "n1=", n1 if debug: print "n2=", n2 - n1 = Numeric.array(n1) - n2 = Numeric.array(n2) - n1_dot_n2 = Numeric.dot(n1,n2) - if debug: print "n1_dot_n2", Numeric.dot(n1,n2) + n1 = numpy.array(n1) + n2 = numpy.array(n2) + n1_dot_n2 = numpy.dot(n1,n2) + if debug: print "n1_dot_n2", numpy.dot(n1,n2) if abs(n1_dot_n2) >= 1*tolerance: if debug: print "The rings are stacked vertically" new_result = (acbs.getAtoms(lig_ring_bnds), acbs.getAtoms(macro_ring_bnds)) diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/listSet.py mgltools-molkit-1.5.7/MolKit/listSet.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/listSet.py 2010-10-08 22:05:37.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/listSet.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/listSet.py,v 1.32 2010/10/08 22:05:37 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/listSet.py,v 1.32.4.1 2015/08/29 01:26:36 sanner Exp $ # -# $Id: listSet.py,v 1.32 2010/10/08 22:05:37 sanner Exp $ +# $Id: listSet.py,v 1.32.4.1 2015/08/29 01:26:36 sanner Exp $ # """ @@ -297,7 +297,9 @@ def remove(self, item): if self.elementType is not None: - assert isinstance(item, self.elementType) + assert isinstance(item, self.elementType), \ + "self=%s\nitem=%s\n, elementType=%s\n"%( + self.__class__, item.__class__, self.elementType) self.data.remove(item) if len(self.data)>0 and self.stringRepr and hasattr(item, 'full_name'): self.stringRepr = self.stringRepr+'/-/'+item.full_name() diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/mol2Parser.py mgltools-molkit-1.5.7/MolKit/mol2Parser.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/mol2Parser.py 2013-10-03 22:36:21.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/mol2Parser.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################# # # Author: Sophiec COON, Michel F. SANNER @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/mol2Parser.py,v 1.17 2013/10/03 22:36:21 annao Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/mol2Parser.py,v 1.15.2.2 2016/02/12 01:12:48 annao Exp $ # -# $Id: mol2Parser.py,v 1.17 2013/10/03 22:36:21 annao Exp $ +# $Id: mol2Parser.py,v 1.15.2.2 2016/02/12 01:12:48 annao Exp $ # import string, sys, types, os @@ -143,11 +141,11 @@ two residues with the same name but belonging to two different chains then the value corresponding to that key is a list of the chains ID.""" - atomlines = map(string.split, self.allLines - [self.keysAndLinesIndices - ['@ATOM'][0]: - self.keysAndLinesIndices - ['@ATOM'][1]]) + #atomlines = map( + # string.split, + # self.allLines[self.keysAndLinesIndices['@ATOM'][0]: + # self.keysAndLinesIndices['@ATOM'][1]]) + atomlines = [x.split() for x in self.allLines[self.keysAndLinesIndices['@ATOM'][0]:self.keysAndLinesIndices['@ATOM'][1]]] subst_chain = {} if len(substlines) == 0: # case 1: no substructures are defined --> 2 levels tree. @@ -321,7 +319,7 @@ Function to build a 4 level hierarchy Protein-Chain-Residue-Atom. """ - self.mol= Protein() + self.mol = Protein() self.mol.allAtoms = AtomSet() self.mol.atmNum = {} self.mol.parser = self @@ -335,11 +333,13 @@ for atmline in atomlines: if len(atmline)>= 10: status = string.split(atmline[9], '|') - else: status = None - if len(atmline) == 8: - tmp = [atmline[5][:5], atmline[5][5:]] - atmline[5] = tmp[0] - atmline.insert(6, tmp[1]) + else: + status = None + + ## if len(atmline) == 8:# and len(atmline[5])>5: + ## tmp = [atmline[5][:5], atmline[5][5:]] + ## atmline[5] = tmp[0] + ## atmline.insert(6, tmp[1]) if status and status[0]=='WATER': chainID = 'W' @@ -410,7 +410,7 @@ self.mol.atmNum[atom.number] = atom atom._coords = [ [float(atmline[2]), float(atmline[3]), float(atmline[4]) ] ] - if len(atmline)>=9: + if len(atmline)>8: atom._charges['mol2'] = float(atmline[8]) atom.chargeSet = 'mol2' # atom.conformation = 0 diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/moleculeParser.py mgltools-molkit-1.5.7/MolKit/moleculeParser.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/moleculeParser.py 2008-09-11 17:00:57.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/moleculeParser.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,15 +7,27 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/moleculeParser.py,v 1.9 2008/09/11 17:00:57 sargis Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/moleculeParser.py,v 1.9.8.1 2015/08/29 01:26:36 sanner Exp $ # -# $Id: moleculeParser.py,v 1.9 2008/09/11 17:00:57 sargis Exp $ +# $Id: moleculeParser.py,v 1.9.8.1 2015/08/29 01:26:36 sanner Exp $ # from MolKit.molecule import Atom import warnings, os from mglutil.util.misc import ensureFontCase +# dict used to guess parser based on file extension +parserToExt = {'PDB':'.pdb', 'PDBQ':'.pdbq', + 'PDBQS':'.pdbqs', 'PDBQT':'.pdbqt', + 'MOL2':'.mol2', + 'PQR':'.pqr', + 'GRO':'.gro', + 'F2D':'.f2d', + 'SDF':'.sdf', + 'CIF':'.cif', + } + + class MoleculeParser: def __init__(self, filename=None, allLines=None): """Supply the filename for reading by readFile, or @@ -49,4 +61,4 @@ txt = '' for line in self.allLines: txt += ''.join(line) - self.st.setvalue(txt) \ No newline at end of file + self.st.setvalue(txt) diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/molecule.py mgltools-molkit-1.5.7/MolKit/molecule.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/molecule.py 2013-11-04 16:58:29.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/molecule.py 2016-02-20 01:32:12.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################ # # Author: Michel F. SANNER @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/molecule.py,v 1.99 2013/11/04 16:58:29 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/molecule.py,v 1.96.2.4 2016/02/20 01:32:12 annao Exp $ # -# $Id: molecule.py,v 1.99 2013/11/04 16:58:29 sanner Exp $ +# $Id: molecule.py,v 1.96.2.4 2016/02/20 01:32:12 annao Exp $ # """ @@ -23,11 +21,11 @@ import string, types, re #import misc from mglutil.util import misc -from numpy.oldnumeric import sum, array, less_equal, take, nonzero, argsort +from numpy import sum, array, less_equal, take, nonzero, argsort from MolKit.tree import TreeNode, TreeNodeSet, TreeNodeSetSelector from math import sqrt # from hbtree import bhtreelib -import numpy.oldnumeric as Numeric +import numpy global bhtreeFlag try: @@ -280,7 +278,7 @@ elementType=None, list=None, childrenName=None, setClass=AtomSet, childrenSetClass=TreeNodeSet, top=None, - childIndex=None, assignUniqIndex=1, **kw): + childIndex=None, assignUniqIndex=1): """Atom constructor. Arguments: @@ -294,9 +292,6 @@ childrenName, setClass, childrenSetClass, top, childIndex, assignUniqIndex) - for k,v in kw.items(): - setattr(self, k, v) - self.conformation = 0 self.element = chemicalElement @@ -423,7 +418,7 @@ # get the alternate coords. coords = [self.coords,] + self.alternate.coords # compute the average as a list of coords. - avCoords = (sum(coords)/len(coords)).tolist() + avCoords = (sum(coords, 0)/len(coords)).tolist() else: # only one coords. avCoords = self.coords @@ -446,16 +441,18 @@ atomList = {} atomList['backbone']={}.fromkeys(['C','CA','N','O']) - atomList['backbone+h']={}.fromkeys(['C','CA','N','O','HN', - 'HN1','HN2', 'HA']) + atomList['backbone+h']={}.fromkeys(['C','CA','N','O']) # H are handle explicitly + #atomList['backbone+h']={}.fromkeys(['C','CA','N','O','HN', + # 'HN1','HN2', 'HA']) atomList['sidechain']={}.fromkeys([ 'SG', 'SD', 'CB','CG','CD', 'CD1', 'CD2', 'CE', 'CE1', 'CE2', 'CE3', 'CG1', 'CG2', 'CZ','CZ2','CZ3','CH2', 'ND1', 'ND2', 'NE', 'NE1', 'NE2','NH1','NH2','NZ', 'OD1', 'OD2', 'OG', 'OG1', 'OE1', 'OE2', 'OH', - 'HD1', 'HE1', 'HE2', 'HE', 'HE21', 'HE22','HH22','HH11','HH12', - 'HG', 'HG1', 'HH21', 'HD22', 'HD21', 'HZ1','HZ2','HZ3','HH','HB1', - 'HB2','HB3', 'HG2', 'HD2']) + #'HD1', 'HE1', 'HE2', 'HE', 'HE21', 'HE22','HH22','HH11','HH12', + #'HG', 'HG1', 'HH21', 'HD22', 'HD21', 'HZ1','HZ2','HZ3','HH','HB1', + #'HB2','HB3', 'HG2', 'HD2' + ]) atomList['hetatm'] = {}.fromkeys([]) @@ -471,18 +468,22 @@ "OP1","OP2"]) NAatomList['backbone+h'] = {}.fromkeys([ 'O1P', 'O2P','P', "C1'", "C2'", "C3'", "C4'", "C5'", "O2'", "O3'", - "O4'", "O5'", "2HO'", "O5T", "H1'", "1H2'", "2H2'", "H3'", "H4'", - "1H5'", "2H5'", "H5T", "H3T", + "O4'", "O5'", "2HO'", "O5T", + #"H1'", "1H2'", "2H2'", "H3'", "H4'", + #"1H5'", "2H5'", "H5T", "H3T", #sargis added the following atoms that were not available in # jmol wiki (10/06/2009) - "OP1","OP2", "H5'", "H5''", "H2''", "H2'", "HO3'", "HO5'"]) + "OP1","OP2", #"H5'", "H5''", "H2''", "H2'", "HO3'", "HO5'" + ]) NAatomList['sidechain']={}.fromkeys([ "N1", "C2", "N3", "C4", "C5", "C6", "N7", "C8", "N9", "O2", "N4", "N2", "N6", "C5M", "O6", "O4", "S4", # sargis added the following atoms that were not available in # jmol wiki (10/06/2009) - "C7", "H71", "H72", "H73", "H1", "H22", "H21", "H2", "H3","H5", - "H6", "H8", "H41", "H42", "H61", "H62"]) + "C7", + #"H71", "H72", "H73", "H1", "H22", "H21", "H2", "H3","H5", + #"H6", "H8", "H41", "H42", "H61", "H62" + ]) NAatomList['hetatm'] = {}.fromkeys([]) #NAatomList['NucBackbone'] = {}.fromkeys([ # "P","O1P","O2P","O5'","C5'","C4'","O4'","C3'","O3'","C2'","C1'"]) @@ -569,7 +570,17 @@ AAnames.has_key(x.parent.type.upper())]) if len(nuklist): atoms.extend([x for x in nodes if nuklist.has_key(x.name)]) - return AtomSet(atoms) + hs = [] + if item=='backbone+h' or item=='sidechain': + # add hydrogen bound to atoms that were selected + for a in atoms: + for b in a.bonds: + a1 = b.atom1 + if a1==a: a1 = b.atom2 + if a1.element=='H': + hs.append(a1) + + return AtomSet(atoms+hs).uniq() ## #here get all atoms w/ name in atomList[item] ## #AND 8/2004: whose parents are std residues... @@ -641,7 +652,7 @@ def __init__(self, atom1, atom2, bondOrder=None, origin='File', name='NoName', parent=None, elementType=None, list=None, - setClass=BondSet, check=1, addBond=1, shared=0): + setClass=BondSet, check=1, addBond=1): """Bond constructor. Arguments: if check: @@ -665,7 +676,7 @@ self.bondOrder = bondOrder self.origin = origin # shared is a flag set to 1 when a bond is shared. example in aromatic - self.shared = shared + self.shared = 0 if addBond: self.atom1.addBond(self) @@ -1248,12 +1259,12 @@ mol = self mol.buildBondsByDistance() ats = mol.allAtoms - atomCoords = Numeric.array( ats.coords, 'f' ) + atomCoords = numpy.array( ats.coords, 'f' ) bht = bhtree.bhtreelib.BHtree( atomCoords, None, 10 ) closePD = bht.closePointsDist2 cutoff = 2.0 - indices = Numeric.zeros( (len(atomCoords),)).astype('i') - dist2 = Numeric.zeros( (len(atomCoords),)).astype('f') + indices = numpy.zeros( (len(atomCoords),)).astype('i') + dist2 = numpy.zeros( (len(atomCoords),)).astype('f') # Search atom without bond and build one bond for it with its closest atom for a in ats: @@ -1318,10 +1329,10 @@ diff = c2 - c1 dist = sum(diff*diff, 1) close = less_equal(dist, cut_off*cut_off) - closeAtoms = take( atomList, nonzero(close) ) + closeAtoms = atomList[nonzero(close)] if sort: - d = take(dist, nonzero(close) ) - closeAtoms = take( closeAtoms, argsort(d) ) + d = dist[nonzero(close)] + closeAtoms = closeAtoms[argsort(d)] return AtomSet(list(closeAtoms)) @@ -1605,7 +1616,7 @@ def getCenter(self): """sets self.center<-getCenter(self)""" coords = self.allAtoms.coords - self.center = sum(coords)/(len(coords)*1.0) + self.center = sum(coords, 0)/(len(coords)*1.0) self.center = list(self.center) for i in range(3): self.center[i] = round(self.center[i], 4) @@ -1620,13 +1631,13 @@ coords=self.allAtoms.coords atSet=AtomSet([]) ats = AtomSet([]) - atar = Numeric.array(self.allAtoms.data) + atar = numpy.array(self.allAtoms.data) for center in centerList: - d = coords - Numeric.array(center, 'f') + d = coords - numpy.array(center, 'f') d = d * d - d = Numeric.sum(d,1) - atindex = Numeric.nonzero(Numeric.less(d, radius * radius)) - newats = Numeric.take(atar, atindex) + d = numpy.sum(d,1) + atindex = numpy.nonzero(numpy.less(d, radius * radius)) + newats = atar[atindex] if len(newats)>0: ats = ats + AtomSet(newats) @@ -1846,6 +1857,14 @@ self.level = MoleculeSet +class MolecularSystems(TreeNodeSet): + """ + Class to represent sets of objects holding multiple Molecules. + """ + def __init__(self, objects=None): + TreeNodeSet.__init__(self, objects, MolecularSystem) + +MoleculeGroups = MolecularSystems class MolecularSystem(TreeNode): """ @@ -1853,7 +1872,8 @@ """ def __init__(self, name='NoName', parent=None, elementType=None, - list=None, childrenName='molecules', setClass=None, + list=None, childrenName='molecules', + setClass=MolecularSystems, childrenSetClass=MoleculeSet, top=None, childIndex=None, assignUniqIndex=1): """MolecularSystem constructor. @@ -1866,3 +1886,27 @@ childrenName, setClass, childrenSetClass, top, childIndex, assignUniqIndex) self.bonds = BondSet([]) + + def __len__(self): + return len(self.children) + + +class MoleculeGroup(MolecularSystem): + """ + Class to represent an multiple Molecules. + """ + + def __init__(self, name='NoName', parent=None, elementType=None, + list=None, childrenName='molecules', + setClass=MoleculeGroups, + childrenSetClass=MoleculeSet, top=None, childIndex=None, + assignUniqIndex=1): + MolecularSystem.__init__( + self, name=name, parent=parent, elementType=elementType, + list=list, childrenName=childrenName, setClass=setClass, + childrenSetClass=MoleculeSet, top=top, childIndex=childIndex, + assignUniqIndex=assignUniqIndex) + + self.elementType=(Molecule,MoleculeGroup) + self.children.elementType=(Molecule,MoleculeGroup) + diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdb2pqr/pdb2pka/ligand_topology.py mgltools-molkit-1.5.7/MolKit/pdb2pqr/pdb2pka/ligand_topology.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdb2pqr/pdb2pka/ligand_topology.py 2007-10-10 22:15:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/pdb2pqr/pdb2pka/ligand_topology.py 2016-02-12 01:12:49.000000000 +0000 @@ -1,9 +1,9 @@ # -# $Id: ligand_topology.py,v 1.2 2007/10/10 22:15:40 vareille Exp $ +# $Id: ligand_topology.py,v 1.2.10.1 2016/02/12 01:12:49 annao Exp $ # PC 2005/09/23 # Get ligand topologies # -import numpy.oldnumeric as Numeric +import numpy from sets import Set from ligandclean.trial_templates import * @@ -37,7 +37,7 @@ for line in lines: split=string.split(line) name=split[0] - self.atoms[name]={'coords':Numeric.array([float(split[1]),float(split[2]),float(split[3])])} + self.atoms[name]={'coords':numpy.array([float(split[1]),float(split[2]),float(split[3])])} self.atoms[name]['bonds']=[] # # Get the likely types from names @@ -92,7 +92,7 @@ for line in lines: name = line.name # self.atoms[name] = name - self.atoms[name] = {'coords': Numeric.array([float(line.x),float(line.y),float(line.z)])} + self.atoms[name] = {'coords': numpy.array([float(line.x),float(line.y),float(line.z)])} self.atoms[name]['sybylType'] = line.sybylType # # we don't have this information when coming from PDB! diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdb2pqr/pdb2pka/NEWligand_topology.py mgltools-molkit-1.5.7/MolKit/pdb2pqr/pdb2pka/NEWligand_topology.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdb2pqr/pdb2pka/NEWligand_topology.py 2007-10-10 22:15:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/pdb2pqr/pdb2pka/NEWligand_topology.py 2016-02-12 01:12:49.000000000 +0000 @@ -1,9 +1,9 @@ # -# $Id: NEWligand_topology.py,v 1.2 2007/10/10 22:15:40 vareille Exp $ +# $Id: NEWligand_topology.py,v 1.2.10.1 2016/02/12 01:12:49 annao Exp $ # PC 2005/09/23 # Get ligand topologies # -import numpy.oldnumeric as Numeric +import numpy from sets import Set from ligandclean.trial_templates import * @@ -40,7 +40,7 @@ for line in lines: split=string.split(line) name=split[0] - self.atoms[name]={'coords':Numeric.array([float(split[1]),float(split[2]),float(split[3])])} + self.atoms[name]={'coords':numpy.array([float(split[1]),float(split[2]),float(split[3])])} self.atoms[name]['bonds']=[] # # Get the likely types from names @@ -95,7 +95,7 @@ for line in lines: name = line.name # self.atoms[name] = name - self.atoms[name] = {'coords': Numeric.array([float(line.x),float(line.y),float(line.z)])} + self.atoms[name] = {'coords': numpy.array([float(line.x),float(line.y),float(line.z)])} self.atoms[name]['sybylType'] = line.sybylType # # we don't have this information when coming from PDB! @@ -518,7 +518,7 @@ self.atoms[i.at_idx1]['alreadyvisited'] = True templates[current_template][i.at_idx2]['alreadyvisited'] = True AtomNameListList.append(AtomNameList) - AGL = Numeric.zeros((len(AtomNameListList),len(AtomNameListList))) + AGL = numpy.zeros((len(AtomNameListList),len(AtomNameListList))) daseinecounter = 0 dasanderecounter = 0 # what again are these counters counting? diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdbParser.py mgltools-molkit-1.5.7/MolKit/pdbParser.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdbParser.py 2013-11-28 01:13:14.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/pdbParser.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/pdbParser.py,v 1.135 2013/11/28 01:13:14 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/pdbParser.py,v 1.132.2.1 2015/08/29 01:26:36 sanner Exp $ # -# $Id: pdbParser.py,v 1.135 2013/11/28 01:13:14 sanner Exp $ +# $Id: pdbParser.py,v 1.132.2.1 2015/08/29 01:26:36 sanner Exp $ # """Module pdbParser. @@ -425,15 +425,14 @@ if atRec[:4]!='ATOM' and atRec[:6]!='HETATM': continue - if atRec.startswith('ATOM 5050'): - pass try: at = self.parse_PDB_ATOM_record(atRec, mol) if at is not None: ats.append(at) except Exception, inst: - print "Error parsing the following line in pdb:\n"+atRec - raise + #print "Error while parsing line %d in %s:\n"+atRec + lineno = self.allLines.index(atRec) + raise RuntimeError, "Error while parsing line %d in %s: %s"%(lineno, self.filename, atRec) mol.allAtoms = mol.allAtoms + AtomSet(ats) @@ -563,7 +562,7 @@ l.alternate.append(atom) # call the progress bar - self.updateProgressBar() + #self.updateProgressBar() return atom @@ -649,8 +648,8 @@ #self.checkForRemark4() totalAtomNumber = len(self.getAtomsLines(-2, 0)) # configure the progress bar, initialize it, set mode to 'increment' - self.configureProgressBar(init=1, mode='increment', - labeltext='parse atoms', max=totalAtomNumber) + #self.configureProgressBar(init=1, mode='increment', + # labeltext='parse atoms', max=totalAtomNumber) if self.pdbRecordParser.has_key('ATOM'): # deal with ATOM first to make sure self.mol, @@ -741,8 +740,8 @@ mnum=1 else: mnum = int(mNum.strip()) - self.configureProgressBar(labeltext='parse atoms Model '+\ - mNum.strip()+'/%d'%len(modelEnd)) + #self.configureProgressBar(labeltext='parse atoms Model '+\ + # mNum.strip()+'/%d'%len(modelEnd)) self.mol = objClass() self.mol.parser = self if self.mol.name == 'NoName': @@ -763,7 +762,7 @@ for mBeg, mEnd, mNum in modelEnd[1:]: if mNum=="": mNum = str(mnum) labeltext='parse atoms Model%d of %d'%(mnum, len(modelEnd)) - self.configureProgressBar(labeltext='parse atoms Model%d of %d'%(mnum, len(modelEnd))) + #self.configureProgressBar(labeltext='parse atoms Model%d of %d'%(mnum, len(modelEnd))) #mNum.strip()+'/%d'%len(modelEnd)) newmol = objClass() @@ -785,9 +784,9 @@ elif self.modelsAs=='conformations': # add a conformation to molecule atms = self.mol.allAtoms for mBeg, mEnd, mNum in modelEnd[1:]: - self.configureProgressBar( - labeltext='parse atoms Model '+\ - mNum.strip()+'/%d'%len(modelEnd)) + #self.configureProgressBar( + # labeltext='parse atoms Model '+\ + # mNum.strip()+'/%d'%len(modelEnd)) mol = objClass() self.pdbRecordParser[record](self.allLines[mBeg+1:mEnd], mol) @@ -1279,8 +1278,7 @@ mol.name = nameStr return mol - - def write_with_new_coords(self, coords, filename=None, comments=[]): + def write_with_new_coords(self, coords, filename=None, comments=[], withBondsFor=None): if len(coords)!=len(self.mol.allAtoms): print "ERROR: length of new coordinates %d does not match %d " %(len(coords), len(self.mol.allAtoms)) print "ERROR: unable to continue" @@ -1292,20 +1290,64 @@ ct = 0 for line in comments: newLines.append("USER %s\n"%line) - - for l in self.allLines: + insertConnectAt = None + for ln, l in enumerate(self.allLines): if l.find("ATOM")==0 or l.find("HETATM")==0: cc = coords[ct] ct = ct + 1 new_l = l[:30]+"%8.3f%8.3f%8.3f" %(cc[0],cc[1],cc[2]) + l[54:] + lastAtomLine = ln else: new_l = l - newLines.append(new_l) + if withBondsFor is not None and new_l[:6]=='CONECT': + if insertConnectAt is None: + insertConnectAt = len(newLines) + elif new_l[:6]=='TER': + insertConnectAt = ln+1 + else: + newLines.append(new_l) + + if withBondsFor is not None: + allBonds = withBondsFor.allAtoms.bonds[0] + for b in allBonds: + rec = 'CONECT%5i%5i'%(b.atom1.number, b.atom2.number) + if insertConnectAt is None: + newLines.append(rec+'\n') + else: + newLines.insert(insertConnectAt, rec+'\n') + if has_filename: for new_l in newLines: fptr.write(new_l) else: return newLines + + ## def write_with_new_coords(self, coords, filename=None, comments=[]): + ## if len(coords)!=len(self.mol.allAtoms): + ## print "ERROR: length of new coordinates %d does not match %d " %(len(coords), len(self.mol.allAtoms)) + ## print "ERROR: unable to continue" + ## return + ## has_filename = filename is not None + ## newLines = [] + ## if has_filename: + ## fptr = open(filename, 'w') + ## ct = 0 + ## for line in comments: + ## newLines.append("USER %s\n"%line) + + ## for l in self.allLines: + ## if l.find("ATOM")==0 or l.find("HETATM")==0: + ## cc = coords[ct] + ## ct = ct + 1 + ## new_l = l[:30]+"%8.3f%8.3f%8.3f" %(cc[0],cc[1],cc[2]) + l[54:] + ## else: + ## new_l = l + ## newLines.append(new_l) + ## if has_filename: + ## for new_l in newLines: + ## fptr.write(new_l) + ## else: + ## return newLines diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdbWriter.py mgltools-molkit-1.5.7/MolKit/pdbWriter.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pdbWriter.py 2011-06-09 19:45:45.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/pdbWriter.py 2015-09-01 00:18:04.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/pdbWriter.py,v 1.27 2011/06/09 19:45:45 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/pdbWriter.py,v 1.27.2.2 2015/09/01 00:18:04 sanner Exp $ # -# $Id: pdbWriter.py,v 1.27 2011/06/09 19:45:45 sanner Exp $ +# $Id: pdbWriter.py,v 1.27.2.2 2015/09/01 00:18:04 sanner Exp $ # from MolKit.moleculeWriter import MoleculeWriter @@ -95,8 +95,15 @@ if sort and hasattr(nodes, 'sort'): nodes.sort(sortFunc) - if isinstance(nodes, TreeNode): mol = nodes.top - elif isinstance(nodes, TreeNodeSet): mol = nodes.top.uniq()[0] + multiMol = False + if isinstance(nodes, TreeNode): + mol = nodes.top + elif isinstance(nodes, TreeNodeSet): + mols = nodes.top.uniq() + if len(mols)>1: + multiMol = True + mol = mols[0] + # get a handle on the molecule parser parser = mol.parser @@ -121,23 +128,43 @@ # Atom records (ATOM, TER and HETATM) atmRec = 'ATOM' in records hetRec = 'HETATM' in records - if atmRec is True or hetRec is True : + if atmRec is True or hetRec is True or multiMol: #self.defineCoordsSection(nodes, sort=sort, sortFunc=sortFunc, atmRec=atmRec, hetRec=hetRec) self.defineCoordsSection(atmInNode, sort=sort, sortFunc=sortFunc, atmRec=atmRec, hetRec=hetRec) + + if not multiMol: - # Hydrogen bonds (HYDBND) - if 'HYDBND' in records: - self.defineHYDBNDRecords(atmInNode) - - # CONECT records - #build excluded Bonds from recType here - #possible recTypes are: - #all, fileUser, fileDist, file, user, userDist, dist, none - if 'CONECT' in records: - self.defineConnectSection(atmInNode, bondOrigin) + # get a handle on the molecule parser + parser = mol.parser + + # Create all the records to be written out. + # Get the from file records this is possible only if the file + # comes from a PDB parser. + if isinstance(parser, PdbParser): + fileRec = filter(lambda x: not x in self.FROMDATASTRUCT, records) + for rec in fileRec: + self.recordsToWrite[rec] = parser.getRecords(parser.allLines,rec) + + # Create the records from the data structure: + # secondary structure 'HELIX', 'SHEET', 'TURN', 'REMARK 650 HELIX', + # 'REMARK 700 SHEET', 'REMARK 750 TURN' + ssRec = filter(lambda x: x in ['HELIX', 'SHEET', 'TURN'], records) + if len(ssRec): + self.defineSecondaryStructureSection(mol, origin=ssOrigin) + + # Hydrogen bonds (HYDBND) + if 'HYDBND' in records: + self.defineHYDBNDRecords(atmInNode) + + # CONECT records + #build excluded Bonds from recType here + #possible recTypes are: + #all, fileUser, fileDist, file, user, userDist, dist, none + if 'CONECT' in records: + self.defineConnectSection(atmInNode, bondOrigin) file = open(filename, 'w') - if not (' ' or ' ' or '') in [x.chemElem for x in mol.allAtoms.data]: + if not multiMol and not (' ' or ' ' or '') in [x.chemElem for x in mol.allAtoms.data]: file.write('REMARK 4 XXXX COMPLIES WITH FORMAT V. 2.0\n') for rec in self.PDBRECORDS: @@ -1134,6 +1161,8 @@ # [60:65] Temperature factor if hasattr(atm, 'temperatureFactor'): tf = atm.temperatureFactor + if tf>999: + tf = 999 elif hasattr(atm, 'pqrRadius'): tf = atm.pqrRadius else: diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pqrWriter.py mgltools-molkit-1.5.7/MolKit/pqrWriter.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/pqrWriter.py 2014-03-18 17:00:10.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/pqrWriter.py 2006-04-19 19:09:26.000000000 +0000 @@ -7,7 +7,6 @@ ############################################################################# from MolKit.moleculeWriter import MoleculeWriter -from MolKit.pdbWriter import PdbWriter from MolKit.protein import Protein, Chain, ChainSet from MolKit.molecule import Atom from MolKit.tree import TreeNode, TreeNodeSet @@ -27,7 +26,7 @@ using this function. This function has to return -1, 0, 1 if the first argument is smaller, equal or larger then the second argument""" - self.numTer = 0 + self.numCoord = 0 filename = fileName root_ext = os.path.splitext('%s' %filename) @@ -111,22 +110,12 @@ f.write('%8.3f' %atm.charge) if hasattr(atm, 'pqrRadius'): f.write('%8.3f' %atm.pqrRadius) - elif hasattr(atm, 'radius'): - f.write('%8.3f' %atm.radius) else: - atm.top._atomRadius(atm) f.write('%8.3f' %atm.radius) f.write('\n') - def write_TER(self, file, atm): - sss = PdbWriter().defineTERRecord(atm) - file.write(sss) - #print "wrote ", sss, " to ", file - self.numTer = self.numTer + 1 - - def write_AtomSet(self, file, node): """Takes a file object and a TreeNode or TreeNodeSet instance. For each Atom in node, write_AtomSet calls method write_atom. @@ -142,26 +131,22 @@ try: atmset.charge except: - print 'ERROR: atoms with missing charge found! Add charges + try again!!' + print 'ERROR: atoms with missing charge found' + return 'Error' + + try: + atmset.radius + except: + print 'ERROR: atoms with missing radius found' return 'Error' - top = atmset[0].top - for at in atmset: - if not hasattr(at, 'radius'): - top._atomRadius(at) - #print at.name, 'radius set to', at.radius for a in atmset: self.write_atom(file, a) self.numCoord = self.numCoord + 1 self.write_TER(file, atmset[-1]) - #self.numTer = self.numTer + 1 + self.numTer = self.numTer + 1 else: atmset = node.findType(Atom) - top = atmset[0].top - for at in atmset: - if not hasattr(at, 'radius'): - top._atomRadius(at) - #print at.name, 'radius set to', at.radius try: atmset.charge except: @@ -171,17 +156,8 @@ atmset.radius except: print 'ERROR: atoms with missing radius found' - return 'Error' + return 'Error' for a in atmset: self.write_atom(file, a) - self.numCoord = self.numCoord + 1 - - #self.write_TER(file, atmset[-1]) - #self.numTer = self.numTer + 1 - - - - - - + self.numCoord = self.numCoord + 1 diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/PROSS.py mgltools-molkit-1.5.7/MolKit/PROSS.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/PROSS.py 2010-08-17 19:48:34.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/PROSS.py 2016-02-12 01:12:48.000000000 +0000 @@ -708,7 +708,7 @@ if na == 0: return if HAVE_NUMPY: - a = Numeric.zeros((na, 3), 'd') + a = numpy.zeros((na, 3), 'd') else: a = [None]*na @@ -821,7 +821,7 @@ atoms = apply(self.atoms_with_name, names) coords = map(lambda a:a.coords(), atoms) if HAVE_NUMPY: - return Numeric.array(coords) + return numpy.array(coords) else: return coords @@ -1017,7 +1017,7 @@ coords = map(lambda a:a.coords(), atoms) del atoms if HAVE_NUMPY: - return Numeric.array(coords) + return numpy.array(coords) else: return coords @@ -1279,7 +1279,7 @@ def coords(self): if HAVE_NUMPY: - return Numeric.array((self.x, self.y, self.z)) + return numpy.array((self.x, self.y, self.z)) else: return [self.x, self.y, self.z] diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/protein.py mgltools-molkit-1.5.7/MolKit/protein.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/protein.py 2013-10-03 22:33:59.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/protein.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ############################################################################# # # Author: Michel F. SANNER @@ -9,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/protein.py,v 1.66 2013/10/03 22:33:59 annao Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/protein.py,v 1.65.2.2 2016/02/12 01:12:48 annao Exp $ # -# $Id: protein.py,v 1.66 2013/10/03 22:33:59 annao Exp $ +# $Id: protein.py,v 1.65.2.2 2016/02/12 01:12:48 annao Exp $ # """ @@ -28,7 +26,7 @@ import re from types import NoneType, StringType, IntType, TupleType, FloatType, ListType from string import split, upper, find -from numpy.oldnumeric import sum +from numpy import sum global bhtreeFlag try: import bhtree @@ -640,9 +638,9 @@ def testSequence(self, item): - import numpy.oldnumeric as Numeric + import numpy try: - ans = Numeric.add.reduce(map(self.testR,item))==len(item) + ans = numpy.add.reduce(map(self.testR,item))==len(item) except: ans = 0 return ans @@ -780,6 +778,7 @@ childrenName, setClass, childrenSetClass, top, childIndex, assignUniqIndex) self.id = id + self.name = id self.hasBonds = 0 # 1 for bondsByDistance is supported self.gaps = [] # list to store tuple (Res, Res) define the edge of a gap diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/rotamerLib.py mgltools-molkit-1.5.7/MolKit/rotamerLib.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/rotamerLib.py 1970-01-01 00:00:00.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/rotamerLib.py 2015-08-26 19:38:50.000000000 +0000 @@ -0,0 +1,207 @@ +############################################################################ +# +# Author: Michel F. SANNER +# +# Copyright: M. Sanner TSRI 2014 +# +############################################################################# + +# +# $Header: /opt/cvs/python/packages/share1.5/MolKit/rotamerLib.py,v 1.2.4.1 2015/08/26 19:38:50 sanner Exp $ +# +# $Id: rotamerLib.py,v 1.2.4.1 2015/08/26 19:38:50 sanner Exp $ +# +import MolKit, os + +class RotamerLib: + """ +This class load the backbone-dependent rotamer library published in +Protein Science, 6, 1661-1681 (1997) by Dunbrack. +ttp://dunbrack.fccc.edu/bbdep/bbind02.May.lib.gz +l +Usage: + lib = RotamerLib() + atomNamesForChiAngles = lib.getAngleDef('ARG') + listOfChiAngles = lib.getAngles('ARG') + listOfAngleDevistations = lib.getAnglesDev('ARG') +""" + + residueNames = ['ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'HIS', 'ILE', + 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', + 'TYR', 'VAL'] + + + def __init__(self): + """Constructor +lib <- RotamerLib() +""" + # angleDef is a dict with key the amino acid type i.e. ARG and the value + # is a list of CHI angle definition. Each CHI angle definition contains + # a list of 4 atoms defining the torsion followed by a list of atoms + # moved by this CHI angle + self.angleDef = {} # [ [A1 A2 A3 A4], [A5, A6 ...] ] + + # angleList is a list of rotameric angles, each rotameric conformation + # contains a list of N floating point values for N CHI angles. The + # values are given in degrees + self.angleList = {} + + # angleList is a list of rotameric angles deviations, each rotameric + # conformation contains a list of N floating point values for N CHI + # angles. The values are given in degrees + self.angleStddev = {} + + self.loadRotamerLib() + + + def loadRotamerLib(self): + """ +load backbone-independent rotamer library May 15, 2002 +http://dunbrack.fccc.edu/bbdep/bbind02.May.lib.gz +libFile: bbind02.May.lib, all descriptive lines begin with '#' +defFile: define the chi angles and the atoms that are moved by the chi rotation + +Roland L. Dunbrack, Jr., Ph. D. +Institute for Cancer Research, Fox Chase Cancer Center +7701 Burholme Avenue, Philadelphia PA 19111 +""" + rotlib = self.angleList + angdef = self.angleDef + angledev = self.angleStddev + + ## + ## parse angle definiton file + defFile = os.path.join(MolKit.__path__[0], 'data', 'rotamer.def') + input_file = open(defFile, 'r') + lines = input_file.readlines() + + for line in lines: + words = line.split() + if len(words) == 0: continue + if words[0][0] == '#': continue + name = words[0] + atomsInChiAngle = words[1:5] + atomsMovedByChiAngle = words[5:] + if angdef.has_key(name): + angdef[name].append([atomsInChiAngle, atomsMovedByChiAngle]) + else: + angdef[name] = [[atomsInChiAngle, atomsMovedByChiAngle]] + + ## + ## parse angle values and standard deviations list + libFile = os.path.join(MolKit.__path__[0], 'data', + 'backboneDependentRotamers.lib') + input_file = open(libFile) + lines = input_file.readlines() + + for line in lines: + words = line.split() + if len(words) ==0: continue + if words[0][0] == '#': continue + name = words[0] + # hardwired code for parsing Dunbrack's lib + number = (len(words) - 11)/2 # number of CHI angles + chi_angles=[] + stdev = [] + for i in range(number): + chi_angles.append(float(words[11 + i*2])) + stdev.append(float(words[12+ i*2])) + if rotlib.has_key(name): + rotlib[name].append(chi_angles) + angledev[name].append(stdev) + else: + rotlib[name]= [chi_angles] + angledev[name]= [stdev] + + + def getAngleDef(self, residueType): + """ +returns a list of 2 tuples in which the first list contains 4 atom names +defining the torsion angle and the second list contains a list of atoms moved +by this torsion. +For ALA and GLY 2 empty lists are returned +""" + if residueType.upper() in ['ALA', 'GLY']: + return [[[],[]]] + elif residueType.upper() in self.residueNames: + return self.angleDef[residueType] + else: + raise ValueError("%s is not a correct residue type, expect %s"% + (residueType, self.residueNames)) + + + def getAngles(self, residueType): + """ +Returns a list of rotameric angles. The length of the list corresponds to the +number of rotamers. Each list contains a list of CHI angles for a given rotamer +""" + if residueType.upper() in ['ALA', 'GLY']: + return [] + elif residueType.upper() in self.residueNames: + return self.angleList[residueType] + else: + raise ValueError("%s is not a correct residue type, expect %s"% + (residueType, self.residueNames)) + + + def getAnglesDev(self, residueType): + """ +Returns a list of rotameric anglesdeviations. +The length of the list corresponds to the number of rotamers. +Each list contains a list of CHI angles deviations for a given rotamer +""" + if residueType.upper() in ['ALA', 'GLY']: + return [] + elif residueType.upper() in self.residueNames: + return self.angleStddev[residueType] + else: + raise ValueError("%s is not a correct residue type, expect %s"% + (residueType, self.residueNames)) + + + def nbRotamers(self, residueType): + if residueType.upper() in ['ALA', 'GLY']: + return 0 + elif residueType.upper() in self.residueNames: + return len(self.angleList[residueType]) + else: + raise ValueError("%s is not a correct residue type, expect %s"% + (residueType, self.residueNames)) + + + ## def get(self, residueName ): + ## """ returns the angle definition and the angle lists of the residue (residueName) """ + + ## if self.angleDef.has_key(residueName) and \ + ## self.angleList.has_key(residueName): + ## return self.angleDef[residueName], self.angleList[residueName], \ + ## self.angleStddev[residueName] + + ## else: + ## print residueName, "is not found in the library" + ## print self.angleDef.keys(), 'are defined' + ## print self.angleDef.keys(), 'angles are loaded ' + ## raise KeyError + + +if __name__=='__main__': + lib = RotamerLib() + for name in lib.residueNames: + print name, lib.nbRotamers(name) + + print 'GLY', lib.nbRotamers('Gly') + print 'ALA', lib.nbRotamers('ala') + + try: + lib.nbRotamers('test') + except ValueError: + pass + + for chi in lib.getAngleDef('ASN'): + print 'def: %s Moving: %s'%(chi[0], chi[1]) + + angles = lib.getAngles('ASN') + dev = lib.getAnglesDev('ASN') + for a, d in zip(angles, dev): + print "angles: %7.2f %7.2f dev: %6.2f %6.2f"%( + a[0], a[1], d[0], d[1]) diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/sdfParser.py mgltools-molkit-1.5.7/MolKit/sdfParser.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/sdfParser.py 2013-08-30 00:43:29.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/sdfParser.py 2015-08-26 19:38:50.000000000 +0000 @@ -189,7 +189,10 @@ bond.topo = int(line[15:18]) # 0 = Either, 1 = Ring, 2 = Chain - bond.ReactionCenter = int(line[18:21]) + try: + bond.ReactionCenter = int(line[18:21]) + except ValueError: + bond.ReactionCenter = 0 #0 = unmarked, 1 = a center, -1 = not a center, #Additional: 2 = no change, #4 = bond made/broken, diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/sequence.py mgltools-molkit-1.5.7/MolKit/sequence.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/sequence.py 2010-09-13 22:21:33.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/sequence.py 2015-09-01 00:38:23.000000000 +0000 @@ -6,12 +6,20 @@ # # adapted from earlier code from B. Norledge # +# A module for dealing with sequences and sequence alignments. +# +# Sequence: +# +# Alignment: A collection of sequences. The sequences in an alignment +# must all be the same length, but the alignment takes care +# of this by automatically padding with gaps +# ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/sequence.py,v 1.1 2010/09/13 22:21:33 sanner Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/sequence.py,v 1.1.4.1 2015/09/01 00:38:23 annao Exp $ # -# $Id: sequence.py,v 1.1 2010/09/13 22:21:33 sanner Exp $ +# $Id: sequence.py,v 1.1.4.1 2015/09/01 00:38:23 annao Exp $ # import numpy @@ -23,8 +31,9 @@ class Sequence: - - def __init__(self,sequence=None, numbers=None, name='None'): + """A single sequence, stored as a list.""" + + def __init__(self,sequence=None, numbers=None, name=None): """ numbers is an optional list, same length as sequence, with the corresponding sequence numbers. Note that gaps are also numbered @@ -86,11 +95,12 @@ return self.sequence[index] - class Alignment: """ Base class for a sequence alignment. Data is a dictionary with molecule - identifiers as keys and the aligned sequences as values""" - + identifiers as keys and the aligned sequences as values. + The sequences in an alignment + must all be the same length, but the alignment takes care + of this by automatically padding with gaps""" def __init__(self, sequences=None, name=None): self.name = name self.sequences={} diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/stringSelector.py mgltools-molkit-1.5.7/MolKit/stringSelector.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/stringSelector.py 2013-10-10 22:42:59.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/stringSelector.py 2008-11-21 20:02:01.000000000 +0000 @@ -6,7 +6,7 @@ # ############################################################################# # -# $Id: stringSelector.py,v 1.43 2013/10/10 22:42:59 sanner Exp $ +# $Id: stringSelector.py,v 1.41 2008/11/21 20:02:01 vareille Exp $ # diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_bondSelector.py mgltools-molkit-1.5.7/MolKit/Tests/test_bondSelector.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_bondSelector.py 2013-09-23 19:40:28.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/Tests/test_bondSelector.py 2009-07-10 22:23:31.000000000 +0000 @@ -2,7 +2,7 @@ # # # -# $Id: test_bondSelector.py,v 1.13 2013/09/23 19:40:28 rhuey Exp $ +# $Id: test_bondSelector.py,v 1.12 2009/07/10 22:23:31 rhuey Exp $ # import unittest @@ -769,8 +769,8 @@ #print 'some_cb_bonds:len(resultBnds)=', len(resultBnds) #self.assertEqual(len(resultBnds) , 34) #because of disulfide bridges-> large cycles - self.assertEqual(len(resultBnds) , 27) - #self.assertEqual(len(resultBnds) , 20) + #self.assertEqual(len(resultBnds) , 27) + self.assertEqual(len(resultBnds) , 20) def test_RotatableBondSelector_select_all(self): diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_chargeCalculator.py mgltools-molkit-1.5.7/MolKit/Tests/test_chargeCalculator.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_chargeCalculator.py 2007-07-24 17:30:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/Tests/test_chargeCalculator.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,14 +1,12 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # # # # -# $Id: test_chargeCalculator.py,v 1.2 2007/07/24 17:30:40 vareille Exp $ +# $Id: test_chargeCalculator.py,v 1.2.10.1 2016/02/12 01:12:48 annao Exp $ # import unittest -import numpy.oldnumeric as Numeric +import numpy from string import split from MolKit.chargeCalculator import GasteigerChargeCalculator from MolKit.chargeCalculator import KollmanChargeCalculator @@ -46,7 +44,7 @@ g_calc.addCharges(self.mol.allAtoms) g_ats = self.mol.allAtoms.get(lambda x: x.chargeSet=='gasteiger') self.assertEquals(atlen, len(g_ats)) - total_charge = Numeric.add.reduce(self.mol.allAtoms.charge) + total_charge = numpy.add.reduce(self.mol.allAtoms.charge) self.assertAlmostEquals(total_charge, 1.221245e-15, 6) @@ -67,7 +65,7 @@ k_calc.addCharges(self.mol.allAtoms) k_ats = self.mol.allAtoms.get(lambda x: x.chargeSet=='Kollman') self.assertEquals(atlen, len(k_ats)) - total_charge = Numeric.add.reduce(self.mol.allAtoms.charge) + total_charge = numpy.add.reduce(self.mol.allAtoms.charge) self.assertAlmostEquals(total_charge, -19.554, 4) @@ -81,7 +79,7 @@ k_calc.addCharges(mol.allAtoms) k_ats = mol.allAtoms.get(lambda x: x.chargeSet=='Kollman') self.assertEquals(atlen, len(k_ats)) - total_charge = Numeric.add.reduce(mol.allAtoms.charge) + total_charge = numpy.add.reduce(mol.allAtoms.charge) self.assertAlmostEquals(total_charge, 5.7060, 4) if __name__ == '__main__': diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_distanceSelector.py mgltools-molkit-1.5.7/MolKit/Tests/test_distanceSelector.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_distanceSelector.py 2007-07-24 17:30:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/Tests/test_distanceSelector.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,14 +1,11 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # # # # -# $Id: test_distanceSelector.py,v 1.2 2007/07/24 17:30:40 vareille Exp $ +# $Id: test_distanceSelector.py,v 1.2.10.1 2016/02/12 01:12:48 annao Exp $ # import unittest -import numpy.oldnumeric as Numeric from MolKit.distanceSelector import CloserThanVDWSelector, CloserThanVDWPlusConstantSelector from MolKit import Read diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_selection.py mgltools-molkit-1.5.7/MolKit/Tests/test_selection.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_selection.py 2010-09-10 19:31:49.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/Tests/test_selection.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,10 +1,8 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # # # # -# $Id: test_selection.py,v 1.10 2010/09/10 19:31:49 sanner Exp $ +# $Id: test_selection.py,v 1.10.4.1 2016/02/12 01:12:48 annao Exp $ # import unittest diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_Sets.py mgltools-molkit-1.5.7/MolKit/Tests/test_Sets.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/Tests/test_Sets.py 2007-07-24 17:30:40.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/Tests/test_Sets.py 2016-02-12 01:12:48.000000000 +0000 @@ -1,14 +1,11 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - # # # # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/Tests/test_Sets.py,v 1.2 2007/07/24 17:30:40 vareille Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/Tests/test_Sets.py,v 1.2.10.1 2016/02/12 01:12:48 annao Exp $ # import unittest -import numpy.oldnumeric as Numeric from string import split from MolKit.sets import Sets from MolKit import Read diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/tree.py mgltools-molkit-1.5.7/MolKit/tree.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/tree.py 2013-10-14 21:10:03.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/tree.py 2015-08-29 01:26:36.000000000 +0000 @@ -7,9 +7,9 @@ ############################################################################# # -# $Header: /opt/cvs/python/packages/share1.5/MolKit/tree.py,v 1.74 2013/10/14 21:10:03 annao Exp $ +# $Header: /opt/cvs/python/packages/share1.5/MolKit/tree.py,v 1.72.2.1 2015/08/29 01:26:36 sanner Exp $ # -# $Id: tree.py,v 1.74 2013/10/14 21:10:03 annao Exp $ +# $Id: tree.py,v 1.72.2.1 2015/08/29 01:26:36 sanner Exp $ # """ @@ -796,7 +796,8 @@ return result else: - raise RuntimeError ("could not find level of type %s"%what) + #raise RuntimeError ("could not find level of type %s"%what) + return [] def findChildrenOfType(self, what): @@ -1016,7 +1017,7 @@ # also, this creates an additional reference to the object whcihc # should be handled at deletion time self.childByName = {} # {'name': childnode} - + self.alias = None # can be overwritten with a string def deleteSubTree(self): """ Function to actually delete all the reference to a TreeNode to diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/VisionInterface/MolKitNodes.py mgltools-molkit-1.5.7/MolKit/VisionInterface/MolKitNodes.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/VisionInterface/MolKitNodes.py 2009-12-01 18:52:52.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/VisionInterface/MolKitNodes.py 2016-05-16 18:34:57.000000000 +0000 @@ -1,5 +1,3 @@ -## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by - ######################################################################### # # Date: Nov 2001 Authors: Michel Sanner, Daniel Stoffler @@ -16,7 +14,8 @@ ######################################################################### import warnings -import numpy.oldnumeric as Numeric, string, os +import numpy +import string, os from NetworkEditor.items import NetworkNode from Vision import UserLibBuild @@ -32,14 +31,7 @@ from MolKit.chargeCalculator import GasteigerChargeCalculator, KollmanChargeCalculator from MolKit.hydrogenBuilder import HydrogenBuilder, PolarHydrogenBuilder -try: - from mslib import MSMS, _msms - msmsFound=1 -except ImportError: - import traceback - traceback.print_exc() - msmsFound=0 - +from .MolKitTypes import msmsFound def importMolKitLib(net): try: @@ -79,7 +71,7 @@ class writePDBFiles(NetworkNode): """ - Write a PDF file for each set of coordinates in coordsList + Write a PDB file for each set of coordinates in coordsList [filenames] <- writePDBFiles(mol, coordsList, filename) @@ -115,11 +107,11 @@ fnames = [] try: for i, coords in enumerate(coordsList): - fname = filename+'''%05d'''%i + fname = filename+'''%05d'''%i+'.pdb' fnames.append(fname) allAtoms.coords = coords writer = PdbWriter() - writer.write(filename+'''%05d'''%i, mol) + writer.write(fname, mol) finally: allAtoms.coords = origCoords pass @@ -167,7 +159,7 @@ rem290 = filter(lambda x: x[:18]=="REMARK 290 SMTRY", all) for i in range(0, len(rem290), 3): lines = [] - mat = Numeric.identity(4).astype('f') + mat = numpy.identity(4).astype('f') for j in range(3): line1 = rem290[i+j] r1 = float(line1[24:33]) @@ -176,7 +168,7 @@ t = float(line1[54:68]) mat[j] = (r1, r2, r3, t) mat[3] = (0., 0., 0., 1.) - #matrices.append( Numeric.array( Numeric.transpose( mat) ) ) + #matrices.append( numpy.array( numpy.transpose( mat) ) ) matrices.append( mat ) self.outputData(matrices=matrices)\n""" @@ -216,7 +208,7 @@ matrices = numpy.zeros( (len(mtrix)/3, 4, 4), 'f') for i in range(0, len(mtrix), 3): lines = [] - mat = Numeric.identity(4).astype('f') + mat = numpy.identity(4).astype('f') for j in range(3): line1 = mtrix[i+j] num = int(line1[7:10])-1 @@ -261,16 +253,16 @@ op.append(datatype='float', name='radius') code = """def doit(self, molecules): - import numpy.oldnumeric as Numeric + import numpy from math import sqrt centers = [] radii = [] for mol in molecules: - c = Numeric.array(mol.chains.residues.atoms.coords) - g = Numeric.add.reduce(c) / len(c) + c = numpy.array(mol.chains.residues.atoms.coords) + g = numpy.add.reduce(c) / len(c) centers.append( g ) d = c-[g] - radii.append( sqrt(max(Numeric.add.reduce(d*d, 1))) ) + radii.append( sqrt(max(numpy.add.reduce(d*d, 1))) ) if len(centers): self.outputData(center=centers, radius=radii) @@ -477,8 +469,8 @@ calculator = GasteigerChargeCalculator() for mol in mols: calculator.addCharges(mol.allAtoms) - import numpy.oldnumeric as Numeric - charge_total = Numeric.add.reduce(mols.allAtoms.charge) + import numpy + charge_total = numpy.add.reduce(mols.allAtoms.charge) self.outputData(mols=mols, charge_total=charge_total) """ @@ -502,8 +494,8 @@ calculator = KollmanChargeCalculator() for mol in mols: calculator.addCharges(mol.allAtoms) - import numpy.oldnumeric as Numeric - charge_total = Numeric.add.reduce(mols.allAtoms.charge) + import numpy + charge_total = numpy.add.reduce(mols.allAtoms.charge) self.outputData(mols=mols, charge_total=charge_total) """ @@ -834,9 +826,9 @@ colors = ( (0.7, 0.7, 0.7), ) if instanceMatrices: - mat = Numeric.array(instanceMatrices) + mat = numpy.array(instanceMatrices) else: - mat = [Numeric.identity(4).astype('f')] + mat = [numpy.identity(4).astype('f')] if cradii is None: cradii = 0.25 @@ -1083,10 +1075,10 @@ intats.append(a) if cutoff!=0.0: - import numpy.oldnumeric as Numeric - points = Numeric.array(vf[:,:3], 'f') - ids = Numeric.arange(len(points)).astype('i') - result = Numeric.zeros( (len(points),) ).astype('i') + import numpy + points = numpy.array(vf[:,:3], 'f') + ids = numpy.arange(len(points)).astype('i') + result = numpy.zeros( (len(points),) ).astype('i') bht = bhtreelib.TBHTree( points, ids, 10, 10, 9999.0 ) for a in intats: nb = bht.ClosePoints( tuple(a.coords), cutoff, result) @@ -1458,7 +1450,7 @@ normals = vf[:,3:6] faces = f[:,:3] if component > 0: - normals = (-1.*Numeric.array( normals )).astype('f') + normals = (-1.*numpy.array( normals )).astype('f') faces = map( lambda x: (x[0], x[2], x[1]), f) self.outputData(vertices=vf[:,:3]) @@ -1630,7 +1622,7 @@ normals = vf[:,3:6] faces = f[:, :3] if component > 0: - normals = (-1.*Numeric.array( normals )).astype('f') + normals = (-1.*numpy.array( normals )).astype('f') faces = map( lambda x: (x[0], x[2], x[1]), f) self.outputData(vertices=vf[:,:3]) @@ -1764,7 +1756,7 @@ # support ofr MSMS server node ################################################# -import types, numpy.oldnumeric as Numeric, re +import types, re class PublicHttpServer: @@ -1796,7 +1788,7 @@ self.arguments[k] = v else: pat = re.compile("[\[,\]\012]") - arrayStr = re.sub(pat, '', str(Numeric.array(v).ravel()) ) + arrayStr = re.sub(pat, '', str(numpy.array(v).ravel()) ) c = split(arrayStr) c = map( float, c ) c = re.sub(pat, '', str(c) ) @@ -1899,10 +1891,10 @@ try: colors = atoms.colors except: colors = ( (0.7, 0.7, 0.7), ) - import numpy.oldnumeric as Numeric - radii = Numeric.array(radii) + import numpy + radii = numpy.array(radii) radii.shape = (-1, 1) - coords = Numeric.concatenate( (atoms.coords, radii), 1 ) + coords = numpy.concatenate( (atoms.coords, radii), 1 ) print coords.shape self.serverObj.setArguments( Coordinates=coords, Probe_Radius=probe_radius, diff -Nru mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/VisionInterface/MolKitTypes.py mgltools-molkit-1.5.7/MolKit/VisionInterface/MolKitTypes.py --- mgltools-molkit-1.5.7~rc1+cvs.20140424/MolKit/VisionInterface/MolKitTypes.py 2006-06-17 00:21:04.000000000 +0000 +++ mgltools-molkit-1.5.7/MolKit/VisionInterface/MolKitTypes.py 2016-05-16 18:33:09.000000000 +0000 @@ -19,21 +19,31 @@ # # $Id$ # +import warnings from NetworkEditor.datatypes import AnyArrayType -class MSMSobjectType(AnyArrayType): - - from mslib import MSMS - def __init__(self, name='MSMSobject', datashape=None, color='#6060c3', - shape='pentagon', width=None, height=None, - dataDescr='MSMS Instance', - klass=MSMS): - - AnyArrayType.__init__(self, name=name, color=color, - shape=shape, width=width, height=height, - klass=klass, datashape=datashape, - dataDescr=dataDescr) +try: + from mslib import MSMS, _msms + msmsFound=1 +except ImportError: + warnings.warn( + 'WARNING: Could not locate or import mslib, disabling related commands') + msmsFound=0 + +if msmsFound: + class MSMSobjectType(AnyArrayType): + + from mslib import MSMS + def __init__(self, name='MSMSobject', datashape=None, color='#6060c3', + shape='pentagon', width=None, height=None, + dataDescr='MSMS Instance', + klass=MSMS): + + AnyArrayType.__init__(self, name=name, color=color, + shape=shape, width=width, height=height, + klass=klass, datashape=datashape, + dataDescr=dataDescr) @@ -146,7 +156,8 @@ if isinstance(data, TreeNode): return True, data.setClass([data]) else: - lArray = Numeric.array(data) + import numpy + lArray = numpy.array(data) lArray0 = lArray[0] while hasattr(lArray0,'shape'): lArray0 = lArray0[0]