Protool/mutate.py
def read_aa_defs(self):
        """Read the amino acid defininition file"""
        import Protool, os
        location=os.path.split(Protool.__file__)[0]
        location=os.path.join(location,'AA.DAT')
        fd=open(location)
        line=fd.readline()
        #
        #
        #
        self.aadefs={}
        while line:
            import string
            line=string.strip(line)
            if line[:2]=='//':
                line=fd.readline()
                continue
            #
            # Start of record
            #
            if string.strip(line)=='*END':
                break
            elif line[0]=='*':
                line=string.strip(fd.readline()).split()
                name=line[0]
                number=line[1]
                line=string.strip(fd.readline()).split()
                atoms=[]
                count=0
                while line[0][0] not in string.digits:
                    count=count+1
                    atname=line[0]
                    x=float(line[1])
                    y=float(line[2])
                    z=float(line[3])
                    atoms.append([atname,numpy.array([x,y,z]),count])
                    line=string.strip(fd.readline()).split()
                self.aadefs[name]={'atoms':atoms[:]}
                bonds=[]
                for count in range(0,len(line),2):
                    bonds.append([int(line[count]),int(line[count+1])])
                self.aadefs[name]['bonds']=bonds
                #
                # Process torsions
                #
                line=string.strip(fd.readline()).split()
                torsions=[]
                if len(line)>1:
                    for count in range(0,len(line)-1,4):
                        torsions.append([int(line[count+1]),int(line[count+2]),int(line[count+3]),int(line[count+4])])
                self.aadefs[name]['torsions']=torsions[:]
            line=fd.readline()
        fd.close()
        return
Read the amino acid defininition file
Read the amino acid defininition file
Read the amino acid defininition file
def read_aa_defs(self):
        import Protool, os
        location=os.path.split(Protool.__file__)[0]
        location=os.path.join(location,'AA.DAT')
        fd=open(location)
        line=fd.readline()
        self.aadefs={}
        while line:
            import string
            line=string.strip(line)
            if line[:2]=='//':
                line=fd.readline()
                continue
             Start of record
            if string.strip(line)=='*END':
                break
            elif line[0]=='*':
                line=string.strip(fd.readline()).split()
                name=line[0]
                number=line[1]
                line=string.strip(fd.readline()).split()
                atoms=[]
                count=0
                while line[0][0] not in string.digits:
                    count=count+1
                    atname=line[0]
                    x=float(line[1])
                    y=float(line[2])
                    z=float(line[3])
                    atoms.append([atname,numpy.array([x,y,z]),count])
                    line=string.strip(fd.readline()).split()
                self.aadefs[name]={'atoms':atoms[:]}
                bonds=[]
                for count in range(0,len(line),2):
                    bonds.append([int(line[count]),int(line[count+1])])
                self.aadefs[name]['bonds']=bonds
                 Process torsions
                line=string.strip(fd.readline()).split()
                torsions=[]
                if len(line)>1:
                    for count in range(0,len(line)-1,4):
                        torsions.append([int(line[count+1]),int(line[count+2]),int(line[count+3]),int(line[count+4])])
                self.aadefs[name]['torsions']=torsions[:]
            line=fd.readline()
        fd.close()
        return
def read_aa_defs ( self ) : import Protool , os location = os . path . split ( Protool . __file__ ) [ 0 ] location = os . path . join ( location , 'AA.DAT' ) fd = open ( location ) line = fd . readline ( ) self . aadefs = { } while line : import string line = string . strip ( line ) if line [ : 2 ] == '//' : line = fd . readline ( ) continue if string . strip ( line ) == '*END' : break elif line [ 0 ] == '*' : line = string . strip ( fd . readline ( ) ) . split ( ) name = line [ 0 ] number = line [ 1 ] line = string . strip ( fd . readline ( ) ) . split ( ) atoms = [ ] count = 0 while line [ 0 ] [ 0 ] not in string . digits : count = count + 1 atname = line [ 0 ] x = float ( line [ 1 ] ) y = float ( line [ 2 ] ) z = float ( line [ 3 ] ) atoms . append ( [ atname , numpy . array ( [ x , y , z ] ) , count ] ) line = string . strip ( fd . readline ( ) ) . split ( ) self . aadefs [ name ] = { 'atoms' : atoms [ : ] } bonds = [ ] for count in range ( 0 , len ( line ) , 2 ) : bonds . append ( [ int ( line [ count ] ) , int ( line [ count + 1 ] ) ] ) self . aadefs [ name ] [ 'bonds' ] = bonds line = string . strip ( fd . readline ( ) ) . split ( ) torsions = [ ] if len ( line ) > 1 : for count in range ( 0 , len ( line ) - 1 , 4 ) : torsions . append ( [ int ( line [ count + 1 ] ) , int ( line [ count + 2 ] ) , int ( line [ count + 3 ] ) , int ( line [ count + 4 ] ) ] ) self . aadefs [ name ] [ 'torsions' ] = torsions [ : ] line = fd . readline ( ) fd . close ( ) return
Read the amino acid defininition file
Read the amino acid defininition file
"""Read the amino acid defininition file""" # # # # # Start of record # # # Process torsions #
self