Hi Lina, "diff_len" is a one-line function that your email program probably broke into two or more lines. Please either make the following:
diff_len = lambda x,y : math.sqrt((x[0]-y[0])*(x[0]-y[0]) + (x[1]-y[1])*(x[1]-y[1]) + (x[2]-y[2])*(x[2]-y[2])) one line of code your in script instead of two. Cheers, -- Jason On Sun, Sep 18, 2011 at 2:45 AM, lina <lina.lastn...@gmail.com> wrote: > > > On Sun, Sep 18, 2011 at 11:55 AM, Jason Vertrees > <jason.vertr...@schrodinger.com> wrote: >> >> Hi Alfonso, >> >> PyMOL knows about more spectrum types but cannot take advantage of >> them (at this point). You will need to do something different if you >> want to use a different palette. It's not hard and here's how. >> >> I'll adapt that same script using PDB 1HUG. Since you want to color >> the distance from all atoms to any given point (here chosen at the >> origin=(0,0,0)) we need to get all the atom distances from 1HUG to the >> origin. We then put those distances into the b-factor column and >> color. I posted the details of the spectrum command and this script on >> the PyMOLWiki (http://www.pymolwiki.org/index.php/Spectrum). >> >> # returns the length of the distance between atom A and atom B >> >> diff_len = lambda x,y : math.sqrt((x[0]-y[0])*(x[0]-y[0]) + >> (x[1]-y[1])*(x[1]-y[1]) + (x[2]-y[2])*(x[2]-y[2])) >> >> # fetch 1hug from the PDB >> >> fetch 1hug, async=0 >> >> # show it as surface >> >> as surface >> >> # create the pseudoatom at the origin >> >> pseudoatom pOrig, pos=(0,0,0), label=origin >> >> # these are special PyMOL variables that will hold # the coordinates of >> # the atoms and the pseudoatom >> >> stored.origCoord = [] >> stored.distCoord = [] >> >> # copy the coordinates into those special variables >> >> iterate_state 1, pOrig, stored.origCoord.append((x,y,z)) >> iterate_state 1, 1hug, stored.distCoord.append((x,y,z)) >> >> # extend origCoord to be the same length as the other >> >> stored.origCoord *= len(stored.distCoord) >> >> # calculate the distances >> >> newB = map(lambda x,y: diff_len(x,y), stored.distCoord, stored.origCoord) > > Sorry to interrupt, > > PyMOL>newB = map(lambda x,y: diff_len(x,y), stored.distCoord, > stored.origCoord) > Traceback (most recent call last): > File "/usr/local/lib/python2.6/dist-packages/pymol/parser.py", line 211, > in parse > exec(layer.com2+"\n",self.pymol_names,self.pymol_names) > File "<string>", line 1, in <module> > File "<string>", line 1, in <lambda> > NameError: global name 'diff_len' is not defined > >> >> # put them into the b-factor of the protein >> >> alter 1hug, b=newB.pop(0) >> >> # color by rainbow_rev or any other >> # palette listed in "help spectrum" >> >> spectrum b, rainbow_rev, 1hug >> >> Cheers, >> >> -- Jason >> >> >> On Sat, Sep 17, 2011 at 1:44 PM, Afonso Duarte <afonsomdua...@gmail.com> >> wrote: >> > Dear All, >> > >> > I am using the ramp_new command to color the surface of protein A >> > according to the distance of protein B (i.e. like in the wiki example >> > ramp_new proximityRamp, pOrig, 1hug, range=[5,65], color=rainbow). >> > However I would like to color the surface of protein A in the inverse >> > rainbow color... from what understood we only can use (afmhot >> > grayscale object rainbow traditional grayable hot >> > ocean and sludge), >> > >> > Does anybody have a suggestion on how to change the colors of the ramp >> > or just to obtain a reverse rainbow ? >> > >> > >> > Best >> > >> > Afonso >> > >> > >> > ------------------------------------------------------------------------------ >> > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> > http://p.sf.net/sfu/rim-devcon-copy2 >> > _______________________________________________ >> > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >> > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net >> > >> >> >> >> -- >> Jason Vertrees, PhD >> PyMOL Product Manager >> Schrodinger, LLC >> >> (e) jason.vertr...@schrodinger.com >> (o) +1 (603) 374-7120 >> >> >> ------------------------------------------------------------------------------ >> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> http://p.sf.net/sfu/rim-devcon-copy2 >> _______________________________________________ >> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net > > > > -- > Best Regards, > > lina > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > http://p.sf.net/sfu/rim-devcon-copy2 > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) jason.vertr...@schrodinger.com (o) +1 (603) 374-7120 ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net