|
- #####################################
- # outline
- # use pymol to auto save a trj pdb into figures
- #
- # example :
- # pymol -c Py_draw.py -- iamref.pdb iamtraj.pdb iamanme 3000 iamfigname
- #####################################
- import pymol
- import cmd
- import sys, time, os
- #####################################
- # inputs
- # pdb : a structure file. .pdb .gro
- # trj : a trajectory file. .pdb(multi frames), .trr
- # name : the name of the trj u import into pymol, it is anything u like
- # ray_size : ray number, usually bigger, more clear
- # fig_name : the output figure name
- pdb = sys.argv[1]
- trj = sys.argv[2]
- name = sys.argv[3]
- ray_size = sys.argv[4]
- fig_name = sys.argv[5]
- ####################################
- # load and plot
- cmd.load(pdb,name)# load reference structure
- cmd.load(trj,name)# load traj file
- cmd.show("cartoon",name)#use cartoon to plot pdb
- cmd.hide("line",name)# hide the line
- cmd.color("red","ss h")# set alpha red
- cmd.color("yellow","ss s")# set beta yellow
- cmd.color("green","ss l+''")# set other green
- cmd.set("ray_opaque_background","off")# background transpancy
- for x in range(1,12,2) :# plot range for 1 to 12 int 1
- cmd.frame("%d" %x )
- cmd.zoom(name,state=-1)# zoom, show a big pdb in each frame
- cmd.ray(ray_size)# clearer
- cmd.png("fig_name"+str(x-1)+".png")# output fig
- cmd.quit()# quit pymol
- ####################################
- # logs
- # typed by : meatball1982@163.com
- #
复制代码 有一个轨迹, 有一个ref的pdb,如何自动将轨迹中的每隔2frame的图存出来.
|
|