Jmol/Useful one-liners: Difference between revisions

From Proteopedia
Jump to navigation Jump to search
Karsten Theis (talk | contribs)
No edit summary
Karsten Theis (talk | contribs)
Line 5: Line 5:
<StructureSection load='' size='340' side='right' caption='' scene='86/865284/Myoglobin/1'>
<StructureSection load='' size='340' side='right' caption='' scene='86/865284/Myoglobin/1'>


===Enhancing visibility===
  set zshade on
  set zshade on


Line 14: Line 15:
<jmol><jmolButton><text>change hover text</text><script>hover "%n%R_%a"; font hover 30</script></jmolButton></jmol>
<jmol><jmolButton><text>change hover text</text><script>hover "%n%R_%a"; font hover 30</script></jmolButton></jmol>
When spinning is off and you hover over an atom, you get some information. This one-liner increases the font size and condenses the information displayed, showing the one-letter residue name, the residue number and the atom name.
When spinning is off and you hover over an atom, you get some information. This one-liner increases the font size and condenses the information displayed, showing the one-letter residue name, the residue number and the atom name.
color bonds green
<jmol><jmolButton><text>color aromatic sidechains green</text><script>select aromatic and sidechain; color bonds green</script></jmolButton></jmol>
This colors the bonds of the selected atoms, but not the atoms themselves. This is useful to keep the atoms in CPK color scheme (showing which elements we have) while highlighting certain residues or side chains.
center visible
<jmol><jmolButton><text>center visible</text><script>center visible</script></jmolButton></jmol>
This centers on all atoms that are visible, either explicitly or as part of a cartoon etc.


  set fontScaling ON
  set fontScaling ON
Line 30: Line 20:
All labels created after this will scale as you zoom in or out of the structure.
All labels created after this will scale as you zoom in or out of the structure.


  model 0
  select selected and not *%B
 
Deselects alternate conformations. Some models contain two conformations (labeled A and B in column 17 of a PDB file, with fractional occupancies adding up to 1, see e.g. [https://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/dealing-with-coordinates]. The example button removes all representations of alternate conformations.


When multiple models are loaded (e.g. NMR structures), or multiple structures are loaded (e.g. superpositions), this shows all the structures at the same time.
===Color bonds independently from atoms===
color bonds green


select selected and not *%B
<jmol><jmolButton><text>color aromatic sidechains green</text><script>select aromatic and sidechain; color bonds green</script></jmolButton></jmol>
This colors the bonds of the selected atoms, but not the atoms themselves. This is useful to keep the atoms in CPK color scheme (showing which elements we have) while highlighting certain residues or side chains.


Deselects alternate conformations. Some models contain two conformations (labeled A and B in column 17 of a PDB file, with fractional occupancies adding up to 1, see e.g. [https://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/dealing-with-coordinates]. The example button removes all representations of alternate conformations.
   
   
<jmol><jmolButton><text>hide %B</text><script>hide hidden or *%B</script></jmolButton></jmol>
<jmol><jmolButton><text>hide %B</text><script>hide hidden or *%B</script></jmolButton></jmol>
<jmol><jmolButton><text>display %B</text><script>hide hidden and not *%B</script></jmolButton></jmol>
<jmol><jmolButton><text>display %B</text><script>hide hidden and not *%B</script></jmolButton></jmol>


===Saving selections and views for later use===
  define aoi selected
  define aoi selected


Line 50: Line 44:


  script inline @view1
  script inline @view1
===Not yet categorized===
center visible
<jmol><jmolButton><text>center visible</text><script>center visible</script></jmolButton></jmol>
This centers on all atoms that are visible, either explicitly or as part of a cartoon etc.
model 0
When multiple models are loaded (e.g. NMR structures), or multiple structures are loaded (e.g. superpositions), this shows all the structures at the same time.
</StructureSection>
</StructureSection>

Revision as of 15:24, 28 October 2020

This is a collection of useful one-liners in Jmol. While the Scene authoring tools give you access to a lot of Jmol's functionality, they don't cover the entire scripting language. However, the SAT contains an input box for entering Jmol commands directly. This page collects commands that might be entered into that textbox to achieve effects not otherwise possible. Viewers of Proteopedia pages might find occasional use of these one-liners as well. To enter them, you first have to right-click on the Jmol window and open a console. For more complex Jmol commands, see Jmol/Using the console.


ExamplesExamples


Enhancing visibility

set zshade on

This fades the scene (to white if the background is white, to black if the background is black) for atoms further away from the viewer, giving a better 3D feel even when the model is not moving.

hover "%n%R %a"; font hover 30

When spinning is off and you hover over an atom, you get some information. This one-liner increases the font size and condenses the information displayed, showing the one-letter residue name, the residue number and the atom name.

set fontScaling ON

All labels created after this will scale as you zoom in or out of the structure.

select selected and not *%B

Deselects alternate conformations. Some models contain two conformations (labeled A and B in column 17 of a PDB file, with fractional occupancies adding up to 1, see e.g. [1]. The example button removes all representations of alternate conformations.

Color bonds independently from atoms

color bonds green

This colors the bonds of the selected atoms, but not the atoms themselves. This is useful to keep the atoms in CPK color scheme (showing which elements we have) while highlighting certain residues or side chains.


Saving selections and views for later use

define aoi selected

Defines the currently selected atoms as "aoi". You can use this later in commands such as "select aoi" to select the atoms again.

view1 = script("show moveto")

Saves the current orientation in the variable "view1". Later, you can go back to this view using:

script inline @view1

Not yet categorized

center visible

This centers on all atoms that are visible, either explicitly or as part of a cartoon etc.

model 0

When multiple models are loaded (e.g. NMR structures), or multiple structures are loaded (e.g. superpositions), this shows all the structures at the same time.


Drag the structure with the mouse to rotate

Proteopedia Page Contributors and Editors (what is this?)Proteopedia Page Contributors and Editors (what is this?)

Karsten Theis, Angel Herraez