Skip to content

Instantly share code, notes, and snippets.

@bougui505
Created April 29, 2014 14:00
Show Gist options
  • Save bougui505/11401240 to your computer and use it in GitHub Desktop.
Save bougui505/11401240 to your computer and use it in GitHub Desktop.
Create a png image from a pdb using pymol
#!/usr/bin/env python
# -*- coding: UTF8 -*-
"""
author: Guillaume Bouvier
email: guillaume.bouvier@ens-cachan.org
creation date: 2014 04 29
license: GNU GPL
Please feel free to use and modify this, but keep the above information.
Thanks!
"""
import sys
sys.path.append('/c5/shared/pymol/1.7.0.0-python-2.7.5-shared/lib/python2.7/site-packages/')
import __main__
__main__.pymol_argv = ['pymol','-qc'] # Pymol: quiet and no GUI
import pymol
pymol.finish_launching()
pdb_file =sys.argv[1]
pdb_name =pdb_file.split('.')[0]
pymol.cmd.load(pdb_file, pdb_name)
pymol.cmd.disable("all")
pymol.cmd.enable(pdb_name)
print pymol.cmd.get_names()
pymol.cmd.hide('all')
pymol.cmd.show('cartoon')
pymol.cmd.set('ray_opaque_background', 0)
pymol.cmd.color('red', 'ss h')
pymol.cmd.color('yellow', 'ss s')
pymol.cmd.png("%s.png"%(pdb_name))
pymol.cmd.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment