Difference between revisions of "Animated Gifs"

From Bioinformatikpedia
(NOMAD-Ref)
(generating animated gifs on a linux based machine)
 
(4 intermediate revisions by 2 users not shown)
Line 31: Line 31:
 
* Load individual models with pymol and save snapshots of each model
 
* Load individual models with pymol and save snapshots of each model
 
* Create animated gif
 
* Create animated gif
  +
  +
Now we found a simpler way:
  +
* replace the "HEADER Frame generated by pdbio.c" in your pdb-files by "MODEL"
  +
* start it in pymol
  +
* continue on Anisotropic Network Model web server, step 4
   
 
=== All-atom NMA using Gromacs on the NOMAD-Ref server ===
 
=== All-atom NMA using Gromacs on the NOMAD-Ref server ===
Line 37: Line 42:
 
2) Load it in pymol<br>
 
2) Load it in pymol<br>
 
3) Continue on Anisotropic Network Model web server, step 4<br>
 
3) Continue on Anisotropic Network Model web server, step 4<br>
  +
  +
=== generating animated gifs on a linux based machine ===
  +
As in any other aproach start by producing the frames with pymol like in [http://ihome.cuhk.edu.hk/~b102142/pymol/pymol_tutorial.html this tutorial]
  +
then convert these .png to .gif with following bash command:
  +
<source lang="bash">
  +
for img in *.png; do
  +
filename=${img%.*}
  +
convert "$filename.png" "$filename.gif"
  +
done
  +
</source>
  +
which converts any png in this folder to a gif.<br>
  +
Now you need ''gifsicle'' a command line tool. If you are not sure whether it is already installed on your machine try:
  +
<source lang="bash">
  +
which gifsicle
  +
</source>
  +
It is available for any common distribution and included in their repositories.
  +
<br>
  +
Now that you only have to use gifsicle to combine the frames produced above by convert.
  +
<source lang = "bash">
  +
gifsicle --loop --delay=10 *.gif > anim.gif
  +
</source>
  +
and be happy about your new animated gif. As gifsicle offers a lot of options you should consult the man pages and if you have trouble to stay below the 2Mb boundary I recommend the --scale and --optimize=3 option to reduce the filesize!
  +
<br>
  +
Have fun!
  +
  +
==== Addition ====
  +
If you have installed [http://www.imagemagick.org/script/index.php ImageMagick] you can simply use
  +
<source lang = "bash">
  +
convert -delay 60 -loop 1 *.png ani.gif
  +
</source>
  +
and skip the ''gifsicle'' part.
  +
  +
If you find your files to be sorted the wrong way (e.g. file1, file10, file2, ...) you can use
  +
<source lang = "bash">
  +
FILES=$(ls "pics/" | sort -n)
  +
cd pics/
  +
convert -delay 60 -loop 1 $FILES ani.gif
  +
</source>
  +
In this case make sure you really only have the pngs in the folder. That's why it is best to put them in a separate directory like "pics".
  +
  +
ImageMagick also has a lot of commands to improve file size and quality. Again - check the man page for help.

Latest revision as of 00:14, 2 July 2012

Animated Gifs

Some methods offer the user already some animated gifs, but some methods only provide pymol skripts. Here we explain how to create animated gifs for each method.

Webnma

We did not find any method the visualize the VMD or DCD file. Therefore we created the pictures manually.

1) right click on the animation to see the menue
2) Animation -> Framerate einstellen -> 5
3) Animation -> Anhalten
4) Datei -> exportiere Gif Abbild
5) Animation -> Nächster Frame
6) Repeat step 4 and 5 until you made pictures of the whole motion
7) Now search for a program which allows you the create animated gifs (we used http://www.createagif.net/ but this site only allows to upload 20 pictures, but the site accepts gif and png files; an alternative is GIMP, if you open the first picture and add the following as "Ebenen" you can save it as a gif-animation)
8) Save the gif and upload it to the wiki

Anisotropic Network Model web server

1) Create Pymol Scripts for each Model you want to visualize
2) Download the three files. The files have to be in the same directory
3) Start pymol and load the pml file with Run into Pymol
4) Start the animation (click on the play button on the lower right side to see the visualisation
5) Save movie as PNG Images
6) Continue as on Webnma at step 7

NOMAD-Ref

  • Download multiple model PDB-file
  • Split multiple model PDB-file into individual models (find scripts here)
  • Load individual models with pymol and save snapshots of each model
  • Create animated gif

Now we found a simpler way:

  • replace the "HEADER Frame generated by pdbio.c" in your pdb-files by "MODEL"
  • start it in pymol
  • continue on Anisotropic Network Model web server, step 4

All-atom NMA using Gromacs on the NOMAD-Ref server

1) Download different modes
2) Load it in pymol
3) Continue on Anisotropic Network Model web server, step 4

generating animated gifs on a linux based machine

As in any other aproach start by producing the frames with pymol like in this tutorial then convert these .png to .gif with following bash command: <source lang="bash"> for img in *.png; do

   filename=${img%.*}
   convert "$filename.png" "$filename.gif"

done </source> which converts any png in this folder to a gif.
Now you need gifsicle a command line tool. If you are not sure whether it is already installed on your machine try: <source lang="bash"> which gifsicle </source> It is available for any common distribution and included in their repositories.
Now that you only have to use gifsicle to combine the frames produced above by convert. <source lang = "bash">

gifsicle --loop --delay=10  *.gif > anim.gif

</source> and be happy about your new animated gif. As gifsicle offers a lot of options you should consult the man pages and if you have trouble to stay below the 2Mb boundary I recommend the --scale and --optimize=3 option to reduce the filesize!
Have fun!

Addition

If you have installed ImageMagick you can simply use <source lang = "bash">

convert  -delay 60 -loop 1 *.png  ani.gif

</source> and skip the gifsicle part.

If you find your files to be sorted the wrong way (e.g. file1, file10, file2, ...) you can use <source lang = "bash"> FILES=$(ls "pics/" | sort -n) cd pics/ convert -delay 60 -loop 1 $FILES ani.gif </source> In this case make sure you really only have the pngs in the folder. That's why it is best to put them in a separate directory like "pics".

ImageMagick also has a lot of commands to improve file size and quality. Again - check the man page for help.