Resicolor: Difference between revisions
Jump to navigation
Jump to search
Philaltist (talk | contribs) (New page: Hello ! Here is a small script to color proteins according to residue type. Call it from your .pymolrc or from within pymol: "run resicolor.py". Then, issuing "resicolor" will apply the s...) |
No edit summary |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
==Description== | |||
Here is a small script to color proteins according to residue type. Call it from your .pymolrc or from within pymol: "run resicolor.py". Then, issuing "resicolor" will apply the scheme. Selections are supported: "resicolor chain A" will apply the scheme only to chain A. | Here is a small script to color proteins according to residue type. Call it from your .pymolrc or from within pymol: "run resicolor.py". Then, issuing "resicolor" will apply the scheme. Selections are supported: "resicolor chain A" will apply the scheme only to chain A. | ||
This functionality is also available as a plugin ([[Resicolor_plugin]]). | |||
<source lang="python"> | |||
#script contributed by Philippe Garteiser; garteiserp@omrf.ouhsc.edu | |||
from pymol import cmd | from pymol import cmd | ||
Line 26: | Line 29: | ||
'polar' : 'green' , | 'polar' : 'green' , | ||
'cys' : 'yellow'} | 'cys' : 'yellow'} | ||
cmd.select ('none') | cmd.select ('none') | ||
for elem in code: | for elem in code: | ||
Line 39: | Line 41: | ||
cmd.extend ('resicolor',resicolor) | cmd.extend ('resicolor',resicolor) | ||
</source> | |||
==Download== | |||
[[Media:Resicolor-0.1.tar.zip|Resicolor-0.1.tar.zip]] | |||
[[Category:Script_Library]] | |||
[[Category:Coloring|Resicolor Script]] | |||
[[Category:Biochemical_Scripts]] |
Latest revision as of 12:32, 31 October 2015
Description
Here is a small script to color proteins according to residue type. Call it from your .pymolrc or from within pymol: "run resicolor.py". Then, issuing "resicolor" will apply the scheme. Selections are supported: "resicolor chain A" will apply the scheme only to chain A. This functionality is also available as a plugin (Resicolor_plugin).
#script contributed by Philippe Garteiser; garteiserp@omrf.ouhsc.edu
from pymol import cmd
def resicolor(selection='all'):
'''USAGE: resicolor <selection>
colors all or the given selection with arbitrary
coloring scheme.
'''
cmd.select ('calcium','resn ca or resn cal')
cmd.select ('acid','resn asp or resn glu or resn cgu')
cmd.select ('basic','resn arg or resn lys or resn his')
cmd.select ('nonpolar','resn met or resn phe or resn pro or resn trp or resn val or resn leu or resn ile or resn ala')
cmd.select ('polar','resn ser or resn thr or resn asn or resn gln or resn tyr')
cmd.select ('cys','resn cys or resn cyx')
cmd.select ('backbone','name ca or name n or name c or name o')
cmd.select ('none')
print selection
code={'acid' : 'red' ,
'basic' : 'blue' ,
'nonpolar': 'orange' ,
'polar' : 'green' ,
'cys' : 'yellow'}
cmd.select ('none')
for elem in code:
line='color '+code[elem]+','+elem+'&'+selection
print line
cmd.do (line)
word='color white,backbone &'+selection
print word
cmd.do (word) #Used to be in code, but looks like
#dictionnaries are accessed at random
cmd.hide ('everything','resn HOH')
cmd.extend ('resicolor',resicolor)