{"id":3279,"date":"2017-01-10T19:35:30","date_gmt":"2017-01-10T19:35:30","guid":{"rendered":"http:\/\/www.blopig.com\/blog\/?p=3279"},"modified":"2020-12-09T13:19:36","modified_gmt":"2020-12-09T13:19:36","slug":"using-pml-scripts-to-generate-pymol-images","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2017\/01\/using-pml-scripts-to-generate-pymol-images\/","title":{"rendered":"Using PML Scripts to generate PyMOL images"},"content":{"rendered":"<p>We can all agree that typing commands into PyMOL can make pretty and publishable pictures. But your love for PyMOL lasts\u00a0until you realise there is a mistake and need to re-do it. Or have to iterate over several proteins. And it takes many fiddly commands to get yourself back there (relatable rant over). Recently I was introduced to\u00a0the useful tool of PML scripting, and for those who have not already discovered this gem please do read on.<\/p>\n<p>These scripts can be called when you launch PyMOL (or from File&gt;Run) and iterate through the commands in the script to adapt the image. This means all your commands can be adjusted to make the figure optimal and allow for later editing.<\/p>\n<p>I have constructed and commented an example script (<code>Joe_Example.pml<\/code>) below to give a basic depiction of a T4 Lysozyme protein. Here I\u00a0load\u00a0the structure and set the view (the co-ordinates can be copied from PyMOL\u00a0easily by clicking the \u2018get view\u2019 command). You then essentially call the commands that you would normally use to enhance your image.\u00a0To\u00a0try this for yourself, download\u00a0the T4 Lysozyme structure from the PBD (1LYD) and running the script (command line:\u00a0<code>pymol Joe_Example.pml)\u00a0<\/code>in the same directory\u00a0to give the image below.<\/p>\n<div id=\"attachment_3280\" style=\"width: 210px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" aria-describedby=\"caption-attachment-3280\" loading=\"lazy\" class=\"wp-image-3280 size-medium\" src=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?resize=200%2C300&#038;ssl=1\" width=\"200\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?resize=200%2C300&amp;ssl=1 200w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?resize=768%2C1152&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?resize=683%2C1024&amp;ssl=1 683w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?resize=624%2C936&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2017\/01\/Lysozyme_Example_Output.png?w=1000&amp;ssl=1 1000w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><p id=\"caption-attachment-3280\" class=\"wp-caption-text\">The image generated by the attached PML script of the T4 Lysozyme (PDB: 1LYD)<\/p><\/div>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#########################\r\n### Load your protein ###\r\n#########################\r\n\r\nload .\/1lyd.pdb, 1lyd\r\n\r\n##########################\r\n### Set your viewpoint ###\r\n##########################\r\n\r\nset_view (\\\r\n    -0.682980239,    0.305771887,   -0.663358808,\\\r\n    -0.392205656,    0.612626553,    0.686194837,\\\r\n     0.616211832,    0.728826880,   -0.298486710,\\\r\n     0.000000000,    0.000000000, -155.216171265,\\\r\n     4.803394318,   63.977561951,  106.548652649,\\\r\n   123.988197327,  186.444198608,   20.000000000 )\r\n\r\n#################\r\n### Set Style ###\r\n#################\r\n\r\nhide everything\r\nset cartoon_fancy_helices = 1\r\nset cartoon_highlight_color = grey70\r\nbg_colour white\r\nset antialias = 1\r\nset ortho = 1\r\nset sphere_mode, 5\r\n\r\n############################\r\n### Make your selections ###\r\n############################\r\n\r\nselect sampleA, 1lyd and resi 1-20\r\n\r\ncolour blue, 1lyd\r\ncolour red, sampleA\r\nshow cartoon, 1lyd\r\n\r\n\r\n###################\r\n### Save a copy ###\r\n###################\r\n\r\nray 1000,1500\r\npng Lysozyme_Example_Output.png<\/pre>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We can all agree that typing commands into PyMOL can make pretty and publishable pictures. But your love for PyMOL lasts\u00a0until you realise there is a mistake and need to re-do it. Or have to iterate over several proteins. And it takes many fiddly commands to get yourself back there (relatable rant over). Recently I [&hellip;]<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[351,221],"tags":[],"ppma_author":[525],"class_list":["post-3279","post","type-post","status-publish","format-standard","hentry","category-molecular-visualization","category-python"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":525,"user_id":37,"is_guest":0,"slug":"joe","display_name":"Joseph Bluck","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/83982ffcf500f0fe47fec340fcf3c1c396ae844739c03da6c069f0a4552641bd?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/3279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=3279"}],"version-history":[{"count":3,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/3279\/revisions"}],"predecessor-version":[{"id":3283,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/3279\/revisions\/3283"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=3279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=3279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=3279"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=3279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}