util.py (pymol-v1.8.6.0.tar.bz2) | : | util.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
#G* Please see the accompanying LICENSE file for further information. | #G* Please see the accompanying LICENSE file for further information. | |||
#H* ------------------------------------------------------------------- | #H* ------------------------------------------------------------------- | |||
#I* Additional authors of this source file include: | #I* Additional authors of this source file include: | |||
#-* | #-* | |||
#-* | #-* | |||
#-* | #-* | |||
#Z* ------------------------------------------------------------------- | #Z* ------------------------------------------------------------------- | |||
from __future__ import print_function | from __future__ import print_function | |||
import sys | ||||
if sys.version_info[0] == 2: | ||||
_next_method_name = 'next' | ||||
else: | ||||
_next_method_name = '__next__' | ||||
cmd = __import__("sys").modules["pymol.cmd"] | cmd = __import__("sys").modules["pymol.cmd"] | |||
import pymol | import pymol | |||
from pymol import movie | from pymol import movie | |||
# legacy mappings, remove in PyMOL 2.0 | # legacy mappings, remove in PyMOL 2.0 | |||
mload = movie.load | mload = movie.load | |||
mrock = movie.rock | mrock = movie.rock | |||
mroll = movie.roll | mroll = movie.roll | |||
# should match the list in layer1/Color.c: | # should match the list in layer1/Color.c: | |||
skipping to change at line 113 | skipping to change at line 119 | |||
if orgN != tmpN: | if orgN != tmpN: | |||
raise pymol.CmdException('color_by_area failed') | raise pymol.CmdException('color_by_area failed') | |||
_self.set("dot_solvent", asa, tmpObj) | _self.set("dot_solvent", asa, tmpObj) | |||
_self.set("dot_density", 3, tmpObj) | _self.set("dot_density", 3, tmpObj) | |||
l = [] | l = [] | |||
_self.get_area(tmpSel, load_b=1) | _self.get_area(tmpSel, load_b=1) | |||
_self.spectrum("b", palette, tmpSel) | _self.spectrum("b", palette, tmpSel) | |||
_self.iterate(tmpSel, "l_a(color)", space={'l_a': l.append}) | _self.iterate(tmpSel, "l_a(color)", space={'l_a': l.append}) | |||
_self.alter(orgSel, "color=l_n()", space={'l_n': iter(l).__next__}) | _self.alter(orgSel, "color=l_n()", space={'l_n': getattr(iter(l), _next_ method_name)}) | |||
_self.recolor(orgSel) | _self.recolor(orgSel) | |||
finally: | finally: | |||
_self.delete(tmpSel) | _self.delete(tmpSel) | |||
_self.delete(tmpObj) | _self.delete(tmpObj) | |||
_self.delete(orgSel) | _self.delete(orgSel) | |||
def find_surface_residues(sele, name='', _self=cmd): | def find_surface_residues(sele, name='', _self=cmd): | |||
""" | """ | |||
DESCRIPTION | DESCRIPTION | |||
skipping to change at line 362 | skipping to change at line 368 | |||
# make sure all atoms are included... | # make sure all atoms are included... | |||
cmd.alter(obj_name,"q=1.0",quiet=1) | cmd.alter(obj_name,"q=1.0",quiet=1) | |||
print(" Util: Fixing termini and assigning formal charges...") | print(" Util: Fixing termini and assigning formal charges...") | |||
assign.missing_c_termini(obj_name,quiet=1,_self=_self) | assign.missing_c_termini(obj_name,quiet=1,_self=_self) | |||
while not assign.formal_charges(obj_name,quiet=1,_self=_self): | while not assign.formal_charges(obj_name,quiet=1,_self=_self): | |||
print(" WARNING: unrecognized or incomplete residues are being deleted:" ) | print(" WARNING: unrecognized or incomplete residues are being deleted:" ) | |||
cmd.iterate("(byres ("+obj_name+" and flag 23)) and flag 31", | cmd.iterate("(byres ("+obj_name+" and flag 23)) and flag 31", | |||
'print " "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+" /"',quiet=1) | 'print(" "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+" /")',quiet=1) | |||
cmd.remove("byres ("+obj_name+" and flag 23)") # get rid of residues tha t weren't assigned | cmd.remove("byres ("+obj_name+" and flag 23)") # get rid of residues tha t weren't assigned | |||
assign.missing_c_termini(obj_name,quiet=1,_self=_self) | assign.missing_c_termini(obj_name,quiet=1,_self=_self) | |||
print(" Util: Assigning Amber 99 charges and radii...") | print(" Util: Assigning Amber 99 charges and radii...") | |||
cmd.h_add(obj_name) | cmd.h_add(obj_name) | |||
if not assign.amber99(obj_name,quiet=1,_self=_self): | if not assign.amber99(obj_name,quiet=1,_self=_self): | |||
print(" WARNING: some unassigned atoms are being deleted:") | print(" WARNING: some unassigned atoms are being deleted:") | |||
cmd.iterate("byres ("+obj_name+" and flag 23)", | cmd.iterate("byres ("+obj_name+" and flag 23)", | |||
'print " "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+" /"+name+"? ["+elem+"]"',quiet=1) | 'print(" "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+" /"+name+"? ["+elem+"]")',quiet=1) | |||
cmd.remove(obj_name+" and flag 23") # get rid of any atoms that weren't assigned | cmd.remove(obj_name+" and flag 23") # get rid of any atoms that weren't assigned | |||
# show the user what the net charges are... | # show the user what the net charges are... | |||
formal = sum_formal_charges(obj_name,quiet=0,_self=_self) | formal = sum_formal_charges(obj_name,quiet=0,_self=_self) | |||
partial = sum_partial_charges(obj_name,quiet=0,_self=_self) | partial = sum_partial_charges(obj_name,quiet=0,_self=_self) | |||
if round(formal)!=round(partial): | if round(formal)!=round(partial): | |||
print(" WARNING: formal and partial charge sums don't match -- there is a problem!") | print(" WARNING: formal and partial charge sums don't match -- there is a problem!") | |||
def protein_vacuum_esp(selection, mode=2, border=10.0, quiet = 1, _self=cmd): | def protein_vacuum_esp(selection, mode=2, border=10.0, quiet = 1, _self=cmd): | |||
skipping to change at line 813 | skipping to change at line 819 | |||
c = (c + 1) % _color_cycle_len | c = (c + 1) % _color_cycle_len | |||
def color_deep(color, name='all', quiet=1, _self=cmd): | def color_deep(color, name='all', quiet=1, _self=cmd): | |||
''' | ''' | |||
Unset all object and atom level (not global) color settings and | Unset all object and atom level (not global) color settings and | |||
apply given color. | apply given color. | |||
''' | ''' | |||
from pymol.menu import rep_setting_lists | from pymol.menu import rep_setting_lists | |||
_self.unset_deep([s for L in rep_setting_lists for (r, s) in L if s], | _self.unset_deep([s for L in rep_setting_lists for (r, s) in L if s], | |||
name, updates=0, quiet=quiet) | name, updates=0, quiet=quiet) | |||
_self.color(color, name, quiet=quiet, _self=_self) | _self.color(color, name, quiet=quiet) | |||
def chainbow(selection='(all)', palette="rainbow", quiet=1, _self=cmd): | def chainbow(selection='(all)', palette="rainbow", quiet=1, _self=cmd): | |||
''' | ''' | |||
Color all chains in rainbow | Color all chains in rainbow | |||
''' | ''' | |||
for model in _self.get_object_list('(' + selection + ')'): | for model in _self.get_object_list('(' + selection + ')'): | |||
for a in _self.get_chains('model %s & (%s)' % (model, selection)) or ['' ]: | for a in _self.get_chains('model %s & (%s)' % (model, selection)) or ['' ]: | |||
_self.spectrum('count', palette, | _self.spectrum('count', palette, | |||
"(chain '%s' & model %s & (%s))" % (a, model, selection), | "(chain '%s' & model %s & (%s))" % (a, model, selection), | |||
byres=1, quiet=quiet) | byres=1, quiet=quiet) | |||
skipping to change at line 1686 | skipping to change at line 1692 | |||
if vis: | if vis: | |||
_self.label('?%s & guide' % (sele), '"%.1f" % ' + var) | _self.label('?%s & guide' % (sele), '"%.1f" % ' + var) | |||
_self.spectrum(var, 'white blue', sele, minimum=0., maximum=1.) | _self.spectrum(var, 'white blue', sele, minimum=0., maximum=1.) | |||
finally: | finally: | |||
_self.set('dot_solvent', dot_solvent, updates=0) | _self.set('dot_solvent', dot_solvent, updates=0) | |||
_self.delete(sele) | _self.delete(sele) | |||
return resarea | return resarea | |||
def ligand_zoom(_self=cmd): | def ligand_zoom(step=1, _self=cmd): | |||
''' | ''' | |||
DESCRIPTION | DESCRIPTION | |||
Zoom to the next organic molecule (by residue identifier) | Zoom to the next organic molecule (by residue identifier) | |||
Bound to CTRL-L key. | Bound to CTRL-L key. | |||
''' | ''' | |||
global _current_ligand | global _current_ligand | |||
s = {'ligand_set': set()} | s = {'ligand_set': set()} | |||
skipping to change at line 1708 | skipping to change at line 1714 | |||
space=s) < 1: | space=s) < 1: | |||
return | return | |||
ligands = sorted(s["ligand_set"]) | ligands = sorted(s["ligand_set"]) | |||
try: | try: | |||
i = ligands.index(_current_ligand) | i = ligands.index(_current_ligand) | |||
except (ValueError, NameError): | except (ValueError, NameError): | |||
i = -1 | i = -1 | |||
i = (i + 1) % len(ligands) | i = (i + int(step)) % len(ligands) | |||
_current_ligand = ligands[i] | _current_ligand = ligands[i] | |||
# use "do" for feedback | # use "do" for feedback | |||
_self.do('zoom /%s/%s/%s & resi %s, animate=1, buffer=2' % ligands[i]) | _self.do('zoom /%s/%s/%s & resi %s, animate=1, buffer=2' % ligands[i]) | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 12 lines changed or added |