Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
User:Mglerner
(section)
User page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
User contributions
Logs
View user groups
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= My ~/.pymolrc runs this .py script= <source lang="python"> #!/usr/bin/env python from pymol import cmd,stored cmd.set('pdb_retain_ids',1) cmd.set('retain_order',1) import os def gro(fnm,name=None): os.system("/usr/local/bin/editconf -f %s -o /tmp/tmp.pdb" % fnm) print "Just did","/usr/local/bin/editconf -f %s -o /tmp/tmp.pdb" % fnm if name is None: name = fnm[:-4] cmd.load("/tmp/tmp.pdb",name) cmd.extend("gro",gro) def splitseq(seq,size): """ Split up seq in pieces of size """ return [seq[i:i+size] for i in range(0, len(seq), size)] def getIDsInSel(sel, sorted=True, reversed=False): """ PARAMETERS sel, The selection, object or group to iterate over sorted (boolean), Should the list be sorted? reversed (boolean) Should the list be reversed before returned? (Combined with the above, you can return a decreasing-sorted list of names RETURNS list[] of strings, representing the object IDs desired. CREDITS This is a very slightly modified version of getNamesInSel from http://pymolwiki.org/index.php/GetNamesInSel """ stored.tempNames = set() cmd.iterate(sel, "stored.tempNames.add(ID)") rList = list(stored.tempNames) # if you want the list reversed or sorted, # uncomment the following lines if sorted: rList.sort() if reversed: rList.reverse() return rList cmd.extend("getIDsInSel", getIDsInSel) def togrp(selname,fname): '''Make a GROMACS index group from a selection''' f = file(fname,'w') f.write('[ %s ]\n'%selname) # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 idxs = getIDsInSel(selname) for g in splitseq(idxs,15): line = ' '.join(['%4s'%i for i in g]) line = line + '\n' f.write(line) f.write('\n') f.close() cmd.extend('togrp',togrp) def rayy(width=-1,height=-1,units='in',dpi=-1,**kwargs): """ Slightly better version of the ray command. You can specify width and height in the units of your choice, e.g. rayy 3,2,units=in,dpi=300 rayy 3in,2in rayy 1in, 2 cm, dpi=600 Extra keyword arguments get passed on to the normal ray command. Units can be 'in' or 'cm'. For backwards compatibility, the conversion to dpi (or dots per centimeter) is only performed when dpi is specified. """ if type(dpi) in [type('')]: dpi = int(dpi) in_per_cm = 0.393700787 def todots(x,units,dpi): if type(x) in [type('')]: x = x.lower() if 'in' in x: units = 'in' elif 'cm' in x: units = 'cm' x = float(x.replace(units,'').strip()) if (dpi == -1): return x if units == 'cm': x = x * in_per_cm elif units == 'in': pass else: raise ValueError('Unknown units (%s)'%units) print '%s%s at %sdpi'%(x,units,dpi) return int(x * dpi) # How do we get current width/height of viewport? MainSceneGetSize perhaps # But it doesn't matter, as PyMOL will autoscale internally for us when given -1. try: width,height = todots(width,units,dpi),todots(height,units,dpi) except ValueError: print "Unknown units" return print 'width',width,'height',height cmd.ray(width=width,height=height,**kwargs) cmd.extend('rayy',rayy) </source>
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
User:Mglerner
(section)
Add topic