{"id":4447,"date":"2018-12-04T16:03:12","date_gmt":"2018-12-04T16:03:12","guid":{"rendered":"https:\/\/www.blopig.com\/blog\/?p=4447"},"modified":"2020-12-09T13:19:16","modified_gmt":"2020-12-09T13:19:16","slug":"turning-md-trajectories-into-movies-using-pymol","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2018\/12\/turning-md-trajectories-into-movies-using-pymol\/","title":{"rendered":"Turning MD Trajectories into Movies using PyMOL"},"content":{"rendered":"<p>Putting movies into your presentations is the perfect way to <s>cover up a terrible underlying presentation<\/s> help the audience visualise the systems you are discussing. Static protein movies can enhance an introduction or help users understand important interactions between proteins and ligands. PyMOL plugins, such as <code>emovie.py<\/code>, help you move beyond the &#8216;rock&#8217; and &#8216;roll&#8217; scenes in PyMOL&#8217;s movie tab. But there ends the scope for your static structures.<\/p>\n<p>If you want to take your PyMOL movie making skills to the next level, you should start adding some dynamics data. This allows your audience to visualise how your protein dynamics evolve over time and a much easier way to explain your results (because, who likes 10,000 graphs in a presentation!? Even if your R plots look super swish.). For example: understanding binding events, PPIs over time or even loop motion.<\/p>\n<p>The following tutorial shows you how to turn a static PDB structure into a dynamic one, by adding a GROMACS trajectory. Most of the commands you will encounter while making a static structure movie, so should not be too alien.<\/p>\n<p><!--more--><\/p>\n<p>Firstly, you need to load in your structure. A word of warning, the <code>.pdb<\/code>, <code>.gro<\/code> and <code>.xtc<\/code> files all need to have the same atoms. That is to say, all the protein, solvent and ions named in all three. The easiest way to ensure this happens is to use the <code>trjconv<\/code> command in GROMACS to produce a <code>.pdb<\/code> that matches the <code>.gro<\/code> file. You will also need to ensure that your\u00a0 <code>.pdb<\/code>, <code>.gro<\/code> and <code>.xtc<\/code> files all share the same name. An annoying feature that you often forget until half way through.<\/p>\n<p><code>load protein.pdb<\/code><\/p>\n<p>Next up, you need to add the co-ordinate <code>.gro<\/code> file:<\/p>\n<p><code>load protein.gro<\/code><\/p>\n<p>Now is the time to customise your PyMOL session. I find it easier to use a <code>.pml<\/code> script to ensure I have the same colouring and viewing parameters set for each movie. You can also so this by hand.<\/p>\n<p>Once you have set everything up, it is time to load the trajectory. You shouldn&#8217;t need more than 200 frames, anything larger will start to cause problems for your workstation:<\/p>\n<p><code>load_traj protein.xtc<\/code><\/p>\n<p>Once this has been loaded in, you should smooth over several frames to make the image smooth and less jittery:<\/p>\n<p><code>smooth protein, 30, 3<\/code><\/p>\n<p>You are now ready to produce the movie. First, you need to ensure the frames are ray traced:<\/p>\n<p><strong>Movie &gt; Ray Trace all frames<\/strong><\/p>\n<p>Now you need to produce the movie. This will take time, depending on the length and resolution. Luckily, the verbose output will give you an estimated time until completion. There are two ways to do this with PyMOL:<\/p>\n<p>1) <strong>File &gt; Save Movie As &gt; MPEG<\/strong><\/p>\n<p>However, if that doesn\u2019t work (you find out the hard way sadly) you will need to save each frame individually and then stitch it together yourself afterwards:<\/p>\n<p>2) <strong>File &gt; Save Movie As &gt; PNG<\/strong><\/p>\n<p>Then use your favourite software to stitch it up. Some people praise the <code>convert<\/code> package, or imagej, but I prefer the <code>ffmpeg<\/code> package as I find it gives smoother images:<\/p>\n<p><code>ffmpeg -i frame%04d.png -c:v libx264 movie.mp4<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Putting movies into your presentations is the perfect way to cover up a terrible underlying presentation help the audience visualise the systems you are discussing. Static protein movies can enhance an introduction or help users understand important interactions between proteins and ligands. PyMOL plugins, such as emovie.py, help you move beyond the &#8216;rock&#8217; and &#8216;roll&#8217; [&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":[14,351],"tags":[212,210,211,132,213],"ppma_author":[525],"class_list":["post-4447","post","type-post","status-publish","format-standard","hentry","category-howto","category-molecular-visualization","tag-gromacs","tag-md","tag-movies","tag-pymol","tag-trajectories"],"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\/4447","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=4447"}],"version-history":[{"count":4,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/4447\/revisions"}],"predecessor-version":[{"id":4451,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/4447\/revisions\/4451"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=4447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=4447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=4447"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=4447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}