[Dock-fans] Amide Planarity

Brian Fochtman brianfochtman at gmail.com
Mon Jul 24 12:14:52 PDT 2017


Hi James,
   Which version of dock are you using - I've worked on a feature to
preserve planarity in amide bonds (that are labeled 'am' in the mol2 file)
and believe it may be implemented in the latest version of the code (6.8).
If you do not have 6.8 you can use the following work around that I have
had some success with:

Use the attached python script on your input ligand file and specify a
temporary mol2 file that you will use for docking. Perform docking without
a bmp filter using the temporary ligand file. Finally run the same python
script on your output. The script attaches and removes 'dummy' atoms which
prevent sampling or minimization of torsion angles around double bonds and
amides.

      1.   python     2017.07.24_cyclize_db.py
<http://2014.05.16_cyclize_db.py/>      input.mol2
temp_for_docking.mol2
      2.   run dock as you normally would except specify
"temp_for_docking.mol2" from above as the ligand_atom_file
      3.   python      2017.07.24_cyclize_db.py
<http://2014.05.16_cyclize_db.py/>      output_scored.mol2
final_output_scored.mol2

-Brian

On Sat, Jul 22, 2017 at 6:46 PM, James Foster (PG Research) <
j.r.foster at dundee.ac.uk> wrote:

> Hi,
>
>
> I recently tried to dock a molecule containing an amide and noticed it
> looked wrong. Does anyone know a way of conserving the planarity of amides?
>
>
> Regards,
>
> James
>
> The University of Dundee is a registered Scottish Charity, No: SC015096
>
> _______________________________________________
> Dock-fans mailing list
> Dock-fans at docking.org
> http://mailman.docking.org/mailman/listinfo/dock-fans
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.docking.org/pipermail/dock-fans/attachments/20170724/1e0f82b7/attachment.html 
-------------- next part --------------
### Fochtman 5.15.14
### Given a mol2 file will add dummy
###   atoms to cyclize double bond so
###   that they will not be minimized.
### Given a mol2 file which has already
###   been cyclized this will remove
###   dummy atoms and bonds.
### This script can then be used to 
###   remove dummy atoms/bonds after
###   docking. 
### Docking calculations using mol2s
###   altered by this script should 
###   have all minimization flags in
###   flex.defn set to "1" (minimize).
### This script was modified in 2017 to
###   cyclize amide bonds as well.

import sys

def isNumRecord(line):
    spl = line.split()
    if (not (len(spl)==5)):
        return False
    else:
        for i in range(0,5):
            try:
                int(spl[i])
            except:
                return False
    return True 


##############################################################
############ ATOM CLASS ###################

class atom():
    def __init__(self, at_num, at_name, x, y, z, at_type,
                       res_num, res_name, p_char):
        self.at_num   = at_num
        self.at_name  = at_name

        self.x = x
        self.y = y
        self.z = z

        self.at_type  = at_type
        self.res_num  = res_num
        self.res_name = res_name
        self.p_char   = p_char 

    def set_at_num(self, num):
        self.at_num = num        
  
    def format(self):
        string = self.at_num.rjust(6) + " "
        string += self.at_name.ljust(5) + "   "
        string += self.x.rjust(10)
        string += self.y.rjust(10)
        string += self.z.rjust(10) + " "
        string += self.at_type.ljust(6)
        string += self.res_num.rjust(5) + " "
        string += self.res_name.ljust(5)
        string += self.p_char.rjust(8)
        return string

#################################################################
########### BOND CLASS ##############

class bond():
    def __init__(self, b_num, b_origin, 
                       b_target, b_type):
        self.b_num    = b_num
        self.b_origin = b_origin
        self.b_target = b_target
        self.b_type   = b_type

    def set_b_num(self, num):
        self.b_num = num

    def format(self):
        string = self.b_num.rjust(6)
        string += self.b_origin.rjust(5)
        string += self.b_target.rjust(5) + " "
        string += self.b_type.ljust(5)
        return string



#################################################################
########### MOLECULE CLASS ##############

class molecule():
    def __init__(self):
        self.header = ""
        self.atoms  = []
        self.bonds  = []
        self.footer = ""

    def add_to_header(self, line):
        if (len(self.header) == 0):
            self.header = line
        else:
            self.header += line

    def add_atom(self, line):
        temp = line.split()
        self.atoms.append( atom( temp[0], temp[1], temp[2],
                                 temp[3], temp[4], temp[5],
                                 temp[6], temp[7], temp[8] ) )
    def add_bond(self, line):
        temp = line.split()
        self.bonds.append( bond( temp[0], temp[1], 
                                 temp[2], temp[3] ) )

    def add_to_footer(self, line):
        if (len(self.header) == 0):
            self.footer = line
        else:
            self.footer += line

    def print_mol(self, filename):
        f_out = open(filename, 'a')
        self.fixNumRecord()
        f_out.write( self.header )

        f_out.write( "@<TRIPOS>ATOM\n" )
        for i in range( len(self.atoms) ):
            f_out.write( self.atoms[i].format() +'\n')            

        f_out.write( "@<TRIPOS>BOND\n" )
        for i in range( len(self.bonds) ):
            f_out.write( self.bonds[i].format() + '\n')

        f_out.write( self.footer )
        f_out.close()

    def fixNumRecord(self):
        numAtoms = len(self.atoms)
        numBonds = len(self.bonds) 
        tmpHeader = self.header
        self.header = ""
        for line in tmpHeader.split('\n'):
           if (isNumRecord(line)):
               self.add_to_header(str(numAtoms)+" "+\
                            str(numBonds)+" 1 0 0\n")
           else:
               self.add_to_header(line+'\n')

    def cyclize_db(self): 
        #what about triple bonds
        #what about esters
        #fix to not cyclize what is already in a ring
        #fix to give sensable coordinats for dummy atoms
        num_dummy_atom = 0
        for bnd in self.bonds:
            if ((bnd.b_type == '2') or (bnd.b_type == 'am')):
                origin = bnd.b_origin
                target = bnd.b_target
                num_dummy_atom += 1
                dummy_atom = atom( "-1" , "D" + str(num_dummy_atom) ,
                                   "0.0" , "0.0" , "0.0" , "Du" ,
                                   "1" , "DUM" ,  "0.0" )
                next_atom_num = str(len(self.atoms) + 1)
                dummy_atom.set_at_num(next_atom_num)
                self.atoms.append(dummy_atom)

                next_bond_num = str(len(self.bonds) + 1)
                dummy_bond_1 = bond( "-1" , origin ,
                                     dummy_atom.at_num , "1" ) 
                dummy_bond_1.set_b_num(next_bond_num)
                self.bonds.append(dummy_bond_1) 

                next_bond_num = str(len(self.bonds) + 1)
                dummy_bond_2 = bond( "-1" , target , 
                                     dummy_atom.at_num , "1" ) 
                dummy_bond_2.set_b_num(next_bond_num)
                self.bonds.append(dummy_bond_2) 
              
                del(dummy_atom) 
                del(dummy_bond_1)
                del(dummy_bond_2)

    def rm_dummies(self):
        #if already_cyclized removes dummes so they are not printed
        last_atom = self.atoms.pop()
        atoms_removed = []
        while (last_atom.res_name == "DUM"):
            atoms_removed.append(last_atom.at_num)
            last_atom = self.atoms.pop()
        self.atoms.append(last_atom)

        last_bond = self.bonds.pop()
        while (last_bond.b_target in atoms_removed):
            last_bond = self.bonds.pop()
        self.bonds.append(last_bond)

#################################################################
########### MAIN ##############
def main():
    input_file  = sys.argv[1]
    output_file = sys.argv[2]
 
    mol = molecule()
    in_header = True
    in_atoms  = False
    in_bonds  = False
    in_footer = False

    already_cyclized = False #will become true if dummy atoms/bonds found
                             #if true will remove dummies, if false will add

    for line in open(input_file, 'r'):
        if (in_bonds):
            if "@<TRIPOS>SUBSTRUCTURE" in line:
                in_bonds = False
                in_footer = True
            elif (len( line.split() ) == 4):
                mol.add_bond( line )
        if (in_footer):
            if ( ("##" in line) or ("@<TRIPOS>MOLECULE" in line)):
                in_footer = False
                in_header = True
                if (not already_cyclized):
                    mol.cyclize_db()
                else:
                    mol.rm_dummies()
                mol.print_mol(output_file)
                del( mol )
                mol = molecule()
            else: 
                mol.add_to_footer( line )
        
        if (in_atoms):
            if "@<TRIPOS>BOND" in line:
                in_atoms = False
                in_bonds = True
            elif (len( line.split() ) == 9):
                if ( 'DUM' in line ):
                    already_cyclized = True
                mol.add_atom( line )

        if (in_header):
            if "@<TRIPOS>ATOM" in line:
                in_header = False
                in_atoms  = True
            else:
                mol.add_to_header( line )

    if (not already_cyclized):
        mol.cyclize_db()
    else:
        mol.rm_dummies()
    mol.print_mol(output_file)
    del( mol )
    mol = molecule()

main()



More information about the Dock-fans mailing list