This is a read-only mirror of pymolwiki.org

Difference between revisions of "Save sep"

From PyMOL Wiki
Jump to navigation Jump to search
(New page: <code> from pymol import cmd import glob import re def save_sep(prefix=''): """ save_sep <files>, <object> saves multiple objects into multiple files using an optional prefix name....)
 
Line 1: Line 1:
<code>
+
<source lang="python">
 
from pymol import cmd
 
from pymol import cmd
 
import glob
 
import glob
Line 25: Line 25:
 
cmd.extend('save_sep',save_sep)
 
cmd.extend('save_sep',save_sep)
  
</code>
+
</source>

Revision as of 22:28, 14 April 2009

from pymol import cmd
import glob
import re

def save_sep(prefix=''):
  """
  save_sep <files>, <object>

  saves multiple objects into multiple files using an optional prefix name.

  e.g. save_sep prefix
  """
  obj_list = cmd.get_names('models')

  if obj_list:
    for i in range(len(obj_list)):
#      if ( obj == '' ):
      obj_name = "%s%s.pdb" % (prefix, obj_list[i])
      cmd.save(obj_name, obj_list[i])
      print "Saving %s" %  obj_name
  else:
    print "No objects found"
    
cmd.extend('save_sep',save_sep)