From: Spencer B. <sb...@uc...> - 2013-08-23 00:42:26
|
James, If the CA position is acceptable as the residue coordinate (as assumed in Jason's answer), then you don't need to bother with pseudoatoms. Here's the easiest way to display all the distances for a figure: select resn LYS and n. CA dist (sele), (sele) Aside: this doesn't work for me as `dist sele, sele`. Anyone know why? Is that a bug or a feature? If you need to print the individual distances rather than display them, this gets slightly harder : atms=[] iterate resn LYS and n. CA, atms.append( (model,ID,resi) ) # print residue IDs and CA-CA distance print "\n".join([ "%s, %s, %s" % ( atms[i][2],atms[j][2], cmd.distance("dist","%s and ID %s" % atms[i][:2], "%s and ID %s"%atms[j][:2])) for i in xrange(1,len(atms)) for j in xrange(i)]) BTW, are you studying crosslinking? -Spencer On Thu, Aug 22, 2013 at 3:57 PM, Jason Vertrees < jas...@sc...> wrote: > Hi James, > > It could look something like this: > > # for_rutley.py > > # fetch a protein > cmd.fetch("1rx1", async=0) > > # make a blank list > l=[] > > # iterate over all lysine's alpha carbons > cmd.iterate_state(1, "n. CA and resn lys", "l.append((x,y,z))") > > # set a counter to 0 for controlling unique names > p=0 > > # iterate over all coordinates and create a > # pseudoatom at each lysine's alpha carbon > for ca in l: > p+=1 > cmd.pseudoatom("pseudo%s" % (p), pos=ca) > > # measure the pairwise distances across all pseudoatoms just created > cmd.distance("/pseudo*", "/pseudo*") > > I bet someone like Thomas or Tsjerk could code this in half the number of > lines, but this should be a starting point. > > Cheers, > > -- Jason > > > On Thu, Aug 22, 2013 at 9:55 AM, James Rutley <jam...@gm...> wrote: > >> >> >> ---------- Forwarded message ---------- >> From: James Rutley <jam...@gm...> >> Date: 22 August 2013 14:50 >> Subject: Script writing >> To: pym...@li... >> >> >> Hi, >> >> I am new to Pymol and programming. What's the best way to approach >> creating a script that does the following: >> >> [image: Inline images 3] >> >> Thanks, >> >> James, >> UCL >> >> >> >> ------------------------------------------------------------------------------ >> Introducing Performance Central, a new site from SourceForge and >> AppDynamics. Performance Central is your source for news, insights, >> analysis and resources for efficient Application Performance Management. >> Visit us today! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk >> _______________________________________________ >> PyMOL-users mailing list (PyM...@li...) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pym...@li... >> > > > > -- > Jason Vertrees, PhD > Director of Core Modeling Products > Schrödinger, Inc. > > (e) Jas...@sc... > (o) +1 (603) 374-7120 > > > ------------------------------------------------------------------------------ > Introducing Performance Central, a new site from SourceForge and > AppDynamics. Performance Central is your source for news, insights, > analysis and resources for efficient Application Performance Management. > Visit us today! > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > _______________________________________________ > PyMOL-users mailing list (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > |
From: Thomas H. <tho...@sc...> - 2013-08-23 07:22:35
|
Hi James, > select resn LYS and n. CA > dist (sele), (sele) > > Aside: this doesn't work for me as `dist sele, sele`. Anyone know why? > Is that a bug or a feature? It's a feature. Both the "select" and the "distance" command actually take as first argument the name of the object which they will create. But they are "smart" enough to recognize when you skipped the first argument, then they use default names (sele, dist01). So better write this: select lysca, resn LYS and n. CA distance lysdist, lysca, lysca Cheers, Thomas -- Thomas Holder PyMOL Developer Schrödinger Contractor |