22
33from prody import calcDistance
44
5- from checks_module import CheckClashes
6- from coordinates_module import ChangeResidueCoordinates
7- from global_processes import FindInitialAndFinalResidues
8- from global_variables import protein_atomnames_dictionary , supported_aminoacids , supported_metals
9- from program_own_classes import ROTAMERLIB
5+ from PPP . checks_module import CheckClashes
6+ from PPP . coordinates_module import ChangeResidueCoordinates
7+ from PPP . global_processes import FindInitialAndFinalResidues
8+ from PPP . global_variables import protein_atomnames_dictionary , supported_aminoacids , supported_metals
9+ from PPP . program_own_classes import ROTAMERLIB
1010
1111__author__ = 'jelisa'
1212
1313
1414def SolveClashes (initial_structure , initial_clashes , mutation , zmatrix , initial_residue_number , final_residue_number ):
15- print "Trying to solve the clashes."
15+ print ( "Trying to solve the clashes." )
1616 dihedral2check = 0
1717 initial_part_of_the_protein = initial_structure .select ("resnum < {}" .format (mutation ["resnum" ])).copy ()
1818 final_part_of_the_protein = initial_structure .select ("resnum > {}" .format (mutation ["resnum" ])).copy ()
@@ -28,8 +28,8 @@ def SolveClashes(initial_structure, initial_clashes, mutation, zmatrix, initial_
2828 initial_number_of_clashes = 0
2929 for values in initial_clashes .values ():
3030 initial_number_of_clashes += len (values )
31- print "Starting number of heavy atoms clashes: {}" .format (len (initial_clashes .keys ()))
32- print "Starting number of total clashes: {}" .format (initial_number_of_clashes )
31+ print ( "Starting number of heavy atoms clashes: {}" .format (len (initial_clashes .keys () )))
32+ print ( "Starting number of total clashes: {}" .format (initial_number_of_clashes ) )
3333
3434 zmatrix .ComputeDeltaFi ()
3535 while maximum_number_of_trials > 0 :
@@ -51,16 +51,16 @@ def SolveClashes(initial_structure, initial_clashes, mutation, zmatrix, initial_
5151 break
5252 elif len (new_clashes .keys ()) < len (initial_clashes .keys ()):
5353
54- print 'The number of clashing heavy atoms in the residue now is: {} and clashes with {} atoms' .format (
54+ print ( 'The number of clashing heavy atoms in the residue now is: {} and clashes with {} atoms' .format (
5555 len (new_clashes .keys ()),
56- current_number_of_clashes )
56+ current_number_of_clashes ))
5757 initial_residue = new_residue .copy ()
5858 initial_number_of_clashes = current_number_of_clashes
5959 initial_clashes = new_clashes
6060 elif len (new_clashes .keys ()) == len (initial_clashes .keys ()):
6161 if current_number_of_clashes < initial_number_of_clashes :
62- print "The number of clashing heavy atoms is still the same but now they clash with {} atoms." .format (
63- current_number_of_clashes )
62+ print ( "The number of clashing heavy atoms is still the same but now they clash with {} atoms." .format (
63+ current_number_of_clashes ))
6464 initial_residue = new_residue .copy ()
6565 initial_number_of_clashes = current_number_of_clashes
6666 return initial_part_of_the_protein + initial_residue + final_part_of_the_protein
@@ -86,14 +86,14 @@ def FixAtomNames(initial_structure, gaps={}, no_gaps={}, debug=False):
8686 no_gaps_residues = []
8787 initial_res , final_res = FindInitialAndFinalResidues (chain )
8888 if debug :
89- print "working with chain {}" .format (chain .getChid ())
89+ print ( "working with chain {}" .format (chain .getChid () ))
9090 for residue in chain .iterResidues ():
9191 tmp_dictio = copy .deepcopy (protein_atomnames_dictionary )
9292 resname = residue .getResname ()
9393 try :
9494 possible_names = tmp_dictio [resname ]
9595 except KeyError :
96- print ' * The residue {} is not an aa nor a water.' .format (resname )
96+ print ( ' * The residue {} is not an aa nor a water.' .format (resname ) )
9797 possible_names = [["CL" ], ["CU" ], ["FE1" ], ["FE2" ], ["ZN" ], ["MG" ]]
9898 heteroatom = True
9999 else :
@@ -107,9 +107,6 @@ def FixAtomNames(initial_structure, gaps={}, no_gaps={}, debug=False):
107107 # should have the hydrogen H from the nitrogen, but if the residue is the
108108 # first one in the protein it should be changed into H3 which belongs to
109109 # the "END" keyword in the names dictionary.
110- if debug :
111- print 'the initial residue is: {} and the residue number: {}' .format (initial_res ,
112- residue .getResnum ())
113110 if 'H' in possible_names [0 ]:
114111 possible_names .pop (0 )
115112 if residue .getResnum () in [initial_res , final_res ] + gaps_residues :
@@ -131,26 +128,22 @@ def FixAtomNames(initial_structure, gaps={}, no_gaps={}, debug=False):
131128 atom_name = atoms [0 ]
132129 atom_found = True
133130 possible_names .pop (possible_names .index (atoms ))
134- if debug and atom .getResnum () == debug [0 ] and chain .getChid () == debug [
135- 1 ]: # .split()[0] and atom.getResnum() == debug.split()[1]:
136- print 'a' , residue .getResnum (), old_atom_name , atom_name , final_res
137- # print 'a', possible_names
138131
139132 break
140133 if not atom_found and not heteroatom :
141134 if atom_name in ['HXT' , 'H1' , "H2" ]:
142135 if residue .getResnum () in gaps_residues or residue .getResnum () in [initial_res , final_res ]:
143136 pass
144137 elif residue .getResnum () in no_gaps_residues :
145- print " * The residue {} won't be considered as a gap, if it really is one," \
138+ print ( " * The residue {} won't be considered as a gap, if it really is one," \
146139 " let the developer know" .format ("{2} {1} {0}" .format (residue .getResnum (),
147140 residue .getChid (),
148- residue .getResname ()))
141+ residue .getResname ())))
149142 else :
150- print " * The Atom {} from residue {} {} {} doesn't have a valid name." .format (atom_name ,
143+ print ( " * The Atom {} from residue {} {} {} doesn't have a valid name." .format (atom_name ,
151144 resname ,
152145 atom .getChid (),
153- atom .getResnum ())
146+ atom .getResnum ()))
154147 atom .setName (atom_name )
155148 # if debug: break
156149 return correct_structure
@@ -196,7 +189,7 @@ def FixStructureResnames(initial_structure, ligand_chain=False):
196189 if ligand_chain == res .getChid () and resname in supported_aminoacids :
197190 ligand_structure = structure .chain_Z .copy ()
198191 if ligand_structure is not None and ligand_structure .hetero is not None :
199- print "INFO: Renaming the ligand to LIG in structure {}" .format (initial_structure .getTitle ())
192+ print ( "INFO: Renaming the ligand to LIG in structure {}" .format (initial_structure .getTitle () ))
200193 resname = "LIG"
201194 res .setResnum (1 )
202195 if resname == "HIS" :
@@ -219,16 +212,16 @@ def FixStructureResnames(initial_structure, ligand_chain=False):
219212 elif "HD1" in res .getNames () or "HND" in res .getNames ():
220213 resname = "HID"
221214 else :
222- print "Make sure the histidine is correctly protonated and then, only then, explain the bug" \
223- " to the the developer."
215+ print ( "Make sure the histidine is correctly protonated and then, only then, explain the bug" \
216+ " to the the developer." )
224217 elif res .numAtoms () == 17 :
225218 if "HE2" in res .getNames () or "HNE" in res .getNames ():
226219 resname = "HIE"
227220 elif "HD1" in res .getNames () or "HND" in res .getNames ():
228221 resname = "HID"
229222 else :
230- print " * WARNING: The hystidine {} has an incorrect number " \
231- "of atoms. PELE won't work correctly" .format ("{} {}" .format (res .getResnum (), res .getChid (),))
223+ print ( " * WARNING: The hystidine {} has an incorrect number " \
224+ "of atoms. PELE won't work correctly" .format ("{} {}" .format (res .getResnum (), res .getChid (),)))
232225 elif resname == "LYS" :
233226 if res .numAtoms () == 21 :
234227 resname = "LYN"
0 commit comments