Protein structure and PyMOL scripting

Protein structure and PyMOL scripting
Object control panel
A(Actions): Rename,duplicate,remove
S(Show): Changethewaythingsappear,e.g.changetostick
orcartoonview.
H(Hide): ThingsthatareshownusingS accumulate,and
don'tautomaticallyreplacethelastview.H istheoppositeof
S andhidesunwantedrepresentations.
L(Label): Labelatoms,residues,etc.
C(Color): Changethecolorofatomsandgroups
Anything you can do with a menu, you can do
with a command
command arg1, arg2, arg3
>fetch 3KAS
Anything you can do with a menu, you can do
with a command
select name, selector
selectchainA
>select chain_a, chain A
selectalltyrosines
>select all_tyr, resn TYR
Moreonselectorsyntax
http://pymolwiki.org/index.php/Property_Selectors
Anything you can do with a menu, you can do
with a command
hideeverything
>hide all
showselectionasribbon
>show ribbon, (chain_a)
colorselectionblue
>color blue, (all_tyr)
PyMOL exercises
1. Download&openstructure3KAS:
fetch 3KAS
– Displayinvariousforms(cartoon,stick,spheres,…)
– Colordifferentchains
2. Download&openstructure1DLW
– Displayascartoon
– Showheme assticks
Every PyMOL command has a python
counterpart
PyMOL:>select chain_a, chain A
Python:cmd.select(“chain_a”,“chain A”)
Needhelp?(PyMOL commandline)
>help select
You can navigate through your file system
with the PyMOL console
Showthecurrentworkingdirectory:
>pwd
(printworkingdirectory)
Listallfilesanddirectoriesinthecurrentworking
directory:
>ls
You can navigate through your file system
with the PyMOL console
Changedirectories
>cd directory_name
Navigatetoadirectorycalleddownloads
>cd Downloads
Navigatetoaparentdirectory
>cd ..
PyMOL Excercises
• UsethePyMOL consoletonavigatetoyour
Downloadsfolder
• UsethePyMOL consoletonavigatetoyourDesktop
An aside about text editors
• Texteditorseditplainorrawtext(nobold,italic,
underline,etc.)
• MicrosoftWordisnotatexteditor
• Windows:Notepad
• MacOSX:TextEdit (Format>Makeplaintext)
• Cross-platform:Atom
– www.atom.io
A simple python script to view a protein
structure
• Openanewtextfile
• Addthecontents:
cmd.fetch(“3KAS”)
• Saveas“myscript.py”(oranynameyouwant)
– Textfilescanhaveanyextension,butforpython
scriptsweuse“.py”byconvention
• UsingthePyMOL console,navigatetothedirectory
whereyousavedyourscript
• InthePyMOL console:
>run myscript.py
Every PyMOL command has a python
counterpart
PyMOL:>select chain_a, chain A
Python:cmd.select(“chain_a”,“chain A”)
Needhelp?(PyMOL commandline)
>help select
PyMOL exercises
Writeapythonscripttodothefollowing:
1. Download&openstructure3KAS:
fetch 3KAS
– Displayinvariousforms(cartoon,stick,spheres,…)
– Colordifferentchains
2. Download&openstructure1DLW
– Displayascartoon
– Showheme assticks