pKaTool/pKaIO.py
def WI_res_text(self,residue,format):
        """Constructs the WHAT IF residue ID line
        f.ex. 1 LYS  (   1  ) from 0001LYS.
        Function works with new names."""
        if format=='WHAT IF':
            if not self.newname:
                # Old names
                import string
                terminal=None
                if residue[0]=="T":
                    terminal=1
                    residue=residue[1:]
                number=string.atoi(residue[:4])
                residue=residue[4:]
                if len(residue)>3:
                    chainid=residue[-1]
                    residue=residue[:-1]
                else:
                    chainid=' '
                line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
                if terminal:
                    line='TERMINAL GROUP:\n'+line
                return line
            else:
                #
                # New names
                #
                terminal=None
                split=residue.split(':')
                if split[-1]=="CTERM" or split[-1]=='NTERM':
                    terminal=1
                try:
                    number=int(split[1])
                    residue=split[2]
                    chainid=split[0]
                    line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
                    if terminal:
                        line='TERMINAL GROUP:\n'+line
                    return line
                except:
                    return residue
        elif format=='pdb2pka':
            #
            # PDB2PKA format
            #
            terminal=None
            split=residue.split(':')
            if split[1]=='NTR' or split[1]=='CTR':
                terminal=1
            #
            res=split[0]
            res=res.split('_')
            residue=res[0]
            chainid=res[1]
            #
            # For Design_pKa
            #
            chainid=''
            #
            number=int(res[2])
            line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
            if terminal:
                line='TERMINAL GROUP:\n'+line
            return line
        else:
            raise Exception('Unknown format:'+format)
Constructs the WHAT IF residue ID line
        f.ex. 1 LYS  (   1  ) from 0001LYS.
        Function works with new names.
Constructs the WHAT IF residue ID line
f.ex.
Constructs the WHAT IF residue ID line f . ex .
def WI_res_text(self,residue,format):
        if format=='WHAT IF':
            if not self.newname:
                import string
                terminal=None
                if residue[0]=="T":
                    terminal=1
                    residue=residue[1:]
                number=string.atoi(residue[:4])
                residue=residue[4:]
                if len(residue)>3:
                    chainid=residue[-1]
                    residue=residue[:-1]
                else:
                    chainid=' '
                line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
                if terminal:
                    line='TERMINAL GROUP:\n'+line
                return line
            else:
                 New names
                terminal=None
                split=residue.split(':')
                if split[-1]=="CTERM" or split[-1]=='NTERM':
                    terminal=1
                try:
                    number=int(split[1])
                    residue=split[2]
                    chainid=split[0]
                    line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
                    if terminal:
                        line='TERMINAL GROUP:\n'+line
                    return line
                except:
                    return residue
        elif format=='pdb2pka':
             PDB2PKA format
            terminal=None
            split=residue.split(':')
            if split[1]=='NTR' or split[1]=='CTR':
                terminal=1
            res=split[0]
            res=res.split('_')
            residue=res[0]
            chainid=res[1]
             For Design_pKa
            chainid=''
            number=int(res[2])
            line='%4d %3s  (%4d  ) %1s' %(number,residue,number,chainid)
            if terminal:
                line='TERMINAL GROUP:\n'+line
            return line
        else:
            raise Exception('Unknown format:'+format)
def WI_res_text ( self , residue , format ) : if format == 'WHAT IF' : if not self . newname : import string terminal = None if residue [ 0 ] == "T" : terminal = 1 residue = residue [ 1 : ] number = string . atoi ( residue [ : 4 ] ) residue = residue [ 4 : ] if len ( residue ) > 3 : chainid = residue [ - 1 ] residue = residue [ : - 1 ] else : chainid = ' ' line = '%4d %3s  (%4d  ) %1s' % ( number , residue , number , chainid ) if terminal : line = 'TERMINAL GROUP:\n' + line return line else : terminal = None split = residue . split ( ':' ) if split [ - 1 ] == "CTERM" or split [ - 1 ] == 'NTERM' : terminal = 1 try : number = int ( split [ 1 ] ) residue = split [ 2 ] chainid = split [ 0 ] line = '%4d %3s  (%4d  ) %1s' % ( number , residue , number , chainid ) if terminal : line = 'TERMINAL GROUP:\n' + line return line except : return residue elif format == 'pdb2pka' : terminal = None split = residue . split ( ':' ) if split [ 1 ] == 'NTR' or split [ 1 ] == 'CTR' : terminal = 1 res = split [ 0 ] res = res . split ( '_' ) residue = res [ 0 ] chainid = res [ 1 ] chainid = '' number = int ( res [ 2 ] ) line = '%4d %3s  (%4d  ) %1s' % ( number , residue , number , chainid ) if terminal : line = 'TERMINAL GROUP:\n' + line return line else : raise Exception ( 'Unknown format:' + format )
Constructs the WHAT IF residue ID line
f.ex.
Constructs the WHAT IF residue ID line f . ex .
"""Constructs the WHAT IF residue ID line
        f.ex. 1 LYS  (   1  ) from 0001LYS.
        Function works with new names.""" # Old names # # New names # # # PDB2PKA format # # # # For Design_pKa # #
self
residue
format