This is a read-only mirror of pymolwiki.org
Difference between revisions of "Label"
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Image:Label_pre.png|thumb|PyMol Labels]] | ||
===DESCRIPTION=== | ===DESCRIPTION=== | ||
− | + | '''label''' labels one or more atoms properties over a selection using the python evaluator with a separate name space for each atom. The symbols defined in the name space are: | |
− | + | *name | |
− | + | *resn | |
− | + | *resi | |
− | + | *chain | |
− | + | *q | |
− | + | *b | |
− | + | *segi | |
− | + | *type (ATOM,HETATM) | |
− | + | *formal_charge | |
− | + | *partial_charge | |
− | + | *numeric_type | |
− | + | *text_type | |
+ | |||
+ | All strings in the expression must be explicitly quoted. This operation typically takes several seconds per thousand atoms altered. To clear labels, simply omit the expression or set it to ''. | ||
+ | |||
===USAGE=== | ===USAGE=== | ||
− | + | label (selection),expression | |
− | + | ||
− | + | ||
+ | ===SETTINGS=== | ||
+ | ====FONT==== | ||
+ | There are 9 different scalable fonts. | ||
+ | <source lang="python">set label_font_id, number</source> | ||
+ | where number is 5 through 14. | ||
+ | =====UTF8 Fonts===== | ||
+ | |||
+ | [[Image:New_fonts.jpeg|thumb|New fonts in PyMol. Notice the alpha and beta characters.]] | ||
+ | |||
+ | Newer versions support UTF8 fonts; use '''font_label_id''' from above to 15 or 16. The good news about the UTF8 fonts is that they support the alpha and beta characters. (See iamge.) | ||
+ | |||
+ | Here's some example code for the image at right: | ||
+ | <source lang="python"> | ||
+ | # roman | ||
+ | set label_font_id, 15 | ||
+ | label 5/CA, "\316\261-Helix" | ||
+ | label 10/CA, "\316\262-Sheet" | ||
+ | |||
+ | # italic | ||
+ | set label_font_id, 16 | ||
+ | |||
+ | # make bigger | ||
+ | set label_size, 50 | ||
+ | </source> | ||
+ | |||
+ | ====SIZE==== | ||
+ | The font size can be adjusted | ||
+ | <source lang="python">set label_size, number</source> | ||
+ | where number is the point size (or -number for Angstroms) | ||
+ | |||
+ | ====COLOR==== | ||
+ | Set a label's color by | ||
+ | set label_color, color | ||
+ | where color is a valid PyMol color. | ||
+ | |||
+ | ====EXPRESSION==== | ||
+ | To set what the label reads (see above) | ||
+ | <source lang="python">label selection, expression</source> | ||
+ | For example | ||
+ | <source lang="python"> | ||
+ | label all, name | ||
+ | label resi 10, b | ||
+ | </source> | ||
+ | |||
+ | ====POSITION==== | ||
+ | To position labels | ||
+ | edit_mode | ||
+ | then | ||
+ | ctrl-middle-click-and-drag to position the label in space. | ||
+ | |||
===EXAMPLES=== | ===EXAMPLES=== | ||
− | + | label (chain A),chain | |
− | + | label (n;ca),"%s-%s" % (resn,resi) | |
− | + | label (resi 200),"%1.3f" % partial_charge | |
− | + | ||
− | + | The following image was created with | |
+ | <source lang="python"> | ||
+ | label (resi 200),"%1.3f" % b | ||
+ | set label_font_id, 10 | ||
+ | set label_size, 10 | ||
+ | </source> | ||
+ | and finally, some labels were moved around in '''edit_mode'''. | ||
+ | [[Image:Label_ex.png|thumb|Labels.]] | ||
+ | |||
+ | ===Users Comments=== | ||
+ | ====Labels Using ID Numbers==== | ||
+ | The following commnent, | ||
+ | label SELECTION, " %s" % ID | ||
+ | labels the SELECTION with atom ID numbers. | ||
+ | |||
+ | You can make more complicated selections/lables such as | ||
+ | label SELECTION, " %s:%s %s" % (resi, resn, name) | ||
+ | which will give you something like "GLU:139 CG" | ||
+ | |||
+ | ====Labels Using One Letter Abbreviations==== | ||
+ | * First, Add this to your $HOME/.pymolrc file: | ||
+ | <source lang="python"> | ||
+ | # start $HOME/.pymolrc modification | ||
+ | one_letter ={'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', \ | ||
+ | 'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y', \ | ||
+ | 'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A', \ | ||
+ | 'GLY':'G', 'PRO':'P', 'CYS':'C'} | ||
+ | # end modification | ||
+ | </source> | ||
+ | |||
+ | *. Second, instead of: | ||
+ | label n. ca, resn | ||
+ | use: | ||
+ | label n. ca, one_letter[resn] | ||
+ | |||
[[Category:Commands|label]] | [[Category:Commands|label]] |
Revision as of 11:30, 7 April 2006
DESCRIPTION
label labels one or more atoms properties over a selection using the python evaluator with a separate name space for each atom. The symbols defined in the name space are:
- name
- resn
- resi
- chain
- q
- b
- segi
- type (ATOM,HETATM)
- formal_charge
- partial_charge
- numeric_type
- text_type
All strings in the expression must be explicitly quoted. This operation typically takes several seconds per thousand atoms altered. To clear labels, simply omit the expression or set it to .
USAGE
label (selection),expression
SETTINGS
FONT
There are 9 different scalable fonts.
set label_font_id, number
where number is 5 through 14.
UTF8 Fonts
Newer versions support UTF8 fonts; use font_label_id from above to 15 or 16. The good news about the UTF8 fonts is that they support the alpha and beta characters. (See iamge.)
Here's some example code for the image at right:
# roman
set label_font_id, 15
label 5/CA, "\316\261-Helix"
label 10/CA, "\316\262-Sheet"
# italic
set label_font_id, 16
# make bigger
set label_size, 50
SIZE
The font size can be adjusted
set label_size, number
where number is the point size (or -number for Angstroms)
COLOR
Set a label's color by
set label_color, color
where color is a valid PyMol color.
EXPRESSION
To set what the label reads (see above)
label selection, expression
For example
label all, name
label resi 10, b
POSITION
To position labels
edit_mode
then ctrl-middle-click-and-drag to position the label in space.
EXAMPLES
label (chain A),chain label (n;ca),"%s-%s" % (resn,resi) label (resi 200),"%1.3f" % partial_charge
The following image was created with
label (resi 200),"%1.3f" % b
set label_font_id, 10
set label_size, 10
and finally, some labels were moved around in edit_mode.
Users Comments
Labels Using ID Numbers
The following commnent,
label SELECTION, " %s" % ID
labels the SELECTION with atom ID numbers.
You can make more complicated selections/lables such as
label SELECTION, " %s:%s %s" % (resi, resn, name)
which will give you something like "GLU:139 CG"
Labels Using One Letter Abbreviations
- First, Add this to your $HOME/.pymolrc file:
# start $HOME/.pymolrc modification
one_letter ={'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', \
'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y', \
'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A', \
'GLY':'G', 'PRO':'P', 'CYS':'C'}
# end modification
- . Second, instead of:
label n. ca, resn
use:
label n. ca, one_letter[resn]