## Re: [PyMOL] Help for surface coloring

 Re: [PyMOL] Help for surface coloring From: Hongbo Zhu - 2011-07-28 19:27:05 Attachments: Message as HTML ```I have a slightly different answer using (almost:) only PyMOL commands: # take 1acb as example fetch 1acb, async=0 import numpy # center is [x0,y0,z0] x0,y0,z0=[1,2,3] alldist = [] iterate_state 1, 1acb, alldist.append(numpy.sqrt(numpy.sum([(x-x0)**2,(y-y0)**2,(z-z0)**2]))) # assign dist to b-factors! di = iter(alldist) alter 1acb, b=di.next() spectrum b, rainbow, 1acb The distance computation line is awkward. I thought of using distance() command to replace it. It is also much faster to use distance(). But I failed to dig distance values out of the object generated by distance(). Anybody knows how to do that? cheers,hongbo On 28.07.2011 5:06, Thomas Holder wrote: > Hi Robert, > > you can set the distance between each atom and the center as b-factor, > and then use spectrum (or spectrumany [1]) for coloring. > > I wrote a small python script that will do that, see attachment. > > Example (in PyMOL command line): > > run distancecoloring.py > centerdistance2b (all) > spectrum b, blue_white_red, (all) > > Cheers, > Thomas > > [1] http://pymolwiki.org/index.php/Spectrumany > > On 07/28/2011 04:29 PM, Muench, Robert wrote: >> Dear community, >> >> I was searching the internet for several days now to find out how to >> perform a distance dependent coloring in pymol. >> >> The idea is to color the surface of a viral (spherical) structure. I >> would like to define the xyz-coordinates of the center of the viral >> structure an color all residues with a gradient depending on the >> distance from these xyz coordinates. >> >> Can anyone please help me out? >> >> All the best >> >> Robert >> >> *Robert Münch*** >> >> --------------------------------------------------------- >> >> Dipl. Biologist / PhD-Student >> >> *Paul-Ehrlich-Institut* >> >> Federal Institute for Vaccines and Biomedicines >> >> Division of Medical Biotechnology >> >> Section 6/5 - Viral Gene Transfer Medicinal Products >> >> 63225 Langen, Germany >> >> Phone: +49-6103-77-4222 >> >> Fax: +49-6103-77-1255 > > > ------------------------------------------------------------------------------ > Got Input? Slashdot Needs You. > Take our quick survey online. Come on, we don't ask for help often. > Plus, you'll get a chance to win \$100 to spend on ThinkGeek. > http://p.sf.net/sfu/slashdot-survey > > > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... ```

 [PyMOL] Help for surface coloring From: Muench, Robert - 2011-07-28 14:29:24 Attachments: Message as HTML ```Dear community, I was searching the internet for several days now to find out how to perform a distance dependent coloring in pymol. The idea is to color the surface of a viral (spherical) structure. I would like to define the xyz-coordinates of the center of the viral structure an color all residues with a gradient depending on the distance from these xyz coordinates. Can anyone please help me out? All the best Robert Robert Münch --------------------------------------------------------- Dipl. Biologist / PhD-Student Paul-Ehrlich-Institut Federal Institute for Vaccines and Biomedicines Division of Medical Biotechnology Section 6/5 - Viral Gene Transfer Medicinal Products 63225 Langen, Germany Phone: +49-6103-77-4222 Fax: +49-6103-77-1255 --------------------------------------------------------- ```
 Re: [PyMOL] Help for surface coloring From: Thomas Holder - 2011-07-28 15:07:16 Attachments: distancecoloring.py ```Hi Robert, you can set the distance between each atom and the center as b-factor, and then use spectrum (or spectrumany [1]) for coloring. I wrote a small python script that will do that, see attachment. Example (in PyMOL command line): run distancecoloring.py centerdistance2b (all) spectrum b, blue_white_red, (all) Cheers, Thomas [1] http://pymolwiki.org/index.php/Spectrumany On 07/28/2011 04:29 PM, Muench, Robert wrote: > Dear community, > > I was searching the internet for several days now to find out how to > perform a distance dependent coloring in pymol. > > The idea is to color the surface of a viral (spherical) structure. I > would like to define the xyz-coordinates of the center of the viral > structure an color all residues with a gradient depending on the > distance from these xyz coordinates. > > Can anyone please help me out? > > All the best > > Robert > > *Robert Münch*** > > --------------------------------------------------------- > > Dipl. Biologist / PhD-Student > > *Paul-Ehrlich-Institut* > > Federal Institute for Vaccines and Biomedicines > > Division of Medical Biotechnology > > Section 6/5 - Viral Gene Transfer Medicinal Products > > 63225 Langen, Germany > > Phone: +49-6103-77-4222 > > Fax: +49-6103-77-1255 -- Thomas Holder MPI for Developmental Biology ```
 Re: [PyMOL] Help for surface coloring From: Hongbo Zhu - 2011-07-28 19:27:05 Attachments: Message as HTML ```I have a slightly different answer using (almost:) only PyMOL commands: # take 1acb as example fetch 1acb, async=0 import numpy # center is [x0,y0,z0] x0,y0,z0=[1,2,3] alldist = [] iterate_state 1, 1acb, alldist.append(numpy.sqrt(numpy.sum([(x-x0)**2,(y-y0)**2,(z-z0)**2]))) # assign dist to b-factors! di = iter(alldist) alter 1acb, b=di.next() spectrum b, rainbow, 1acb The distance computation line is awkward. I thought of using distance() command to replace it. It is also much faster to use distance(). But I failed to dig distance values out of the object generated by distance(). Anybody knows how to do that? cheers,hongbo On 28.07.2011 5:06, Thomas Holder wrote: > Hi Robert, > > you can set the distance between each atom and the center as b-factor, > and then use spectrum (or spectrumany [1]) for coloring. > > I wrote a small python script that will do that, see attachment. > > Example (in PyMOL command line): > > run distancecoloring.py > centerdistance2b (all) > spectrum b, blue_white_red, (all) > > Cheers, > Thomas > > [1] http://pymolwiki.org/index.php/Spectrumany > > On 07/28/2011 04:29 PM, Muench, Robert wrote: >> Dear community, >> >> I was searching the internet for several days now to find out how to >> perform a distance dependent coloring in pymol. >> >> The idea is to color the surface of a viral (spherical) structure. I >> would like to define the xyz-coordinates of the center of the viral >> structure an color all residues with a gradient depending on the >> distance from these xyz coordinates. >> >> Can anyone please help me out? >> >> All the best >> >> Robert >> >> *Robert Münch*** >> >> --------------------------------------------------------- >> >> Dipl. Biologist / PhD-Student >> >> *Paul-Ehrlich-Institut* >> >> Federal Institute for Vaccines and Biomedicines >> >> Division of Medical Biotechnology >> >> Section 6/5 - Viral Gene Transfer Medicinal Products >> >> 63225 Langen, Germany >> >> Phone: +49-6103-77-4222 >> >> Fax: +49-6103-77-1255 > > > ------------------------------------------------------------------------------ > Got Input? Slashdot Needs You. > Take our quick survey online. Come on, we don't ask for help often. > Plus, you'll get a chance to win \$100 to spend on ThinkGeek. > http://p.sf.net/sfu/slashdot-survey > > > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... ```
 Re: [PyMOL] Help for surface coloring From: Jason Vertrees - 2011-07-28 19:02:18 ```Hi Robert, I did something like this in the past. Check out the ramp_new command page on the PyMOLWiki for an example (http://pymolwiki.org/index.php/Ramp_new#Elaborate_examples) for arbitrary functions. Here's a very quick way to color a surface by distance from a given point--here I chose the origin (0,0,0): # fetch a friendly protein fetch 1hug, async=0 # show it as a surface as surface # create a pseudoatom at the origin; we will # measure the distance from this point pseudoatom pOrig, pos=(0,0,0), label=origin # create a new color ramp, measuring the distance # from pOrig to 1hug, colored as rainbow ramp_new proximityRamp, pOrig, selection=1hug, range=[5,65], color=rainbow # set the surface color to the ramp coloring set surface_color, proximityRamp, 1hug # some older PyMOLs need this recoloring/rebuilding recolor; rebuild Cheers, -- Jason On Thu, Jul 28, 2011 at 10:29 AM, Muench, Robert wrote: > Dear community, > > > > I was  searching the internet for several days now to find out how to > perform a distance dependent coloring in pymol. > > The idea is to color the surface of a viral (spherical) structure. I would > like to define the xyz-coordinates of the center of the viral structure an > color all residues with a gradient depending on the distance from these xyz > coordinates. > > Can anyone please help me out? > > > > All the best > > > > Robert > > > > > > Robert Münch > > --------------------------------------------------------- > > Dipl. Biologist / PhD-Student > > Paul-Ehrlich-Institut > > Federal Institute for Vaccines and Biomedicines > > Division of Medical Biotechnology > > Section 6/5 - Viral Gene Transfer Medicinal Products > > 63225 Langen, Germany > > > > Phone: +49-6103-77-4222 > > Fax: +49-6103-77-1255 > > --------------------------------------------------------- > > > > ------------------------------------------------------------------------------ > Got Input?   Slashdot Needs You. > Take our quick survey online.  Come on, we don't ask for help often. > Plus, you'll get a chance to win \$100 to spend on ThinkGeek. > http://p.sf.net/sfu/slashdot-survey > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@... > -- Jason Vertrees, PhD PyMOL Product Manager Schrodinger, LLC (e) Jason.Vertrees@... (o) +1 (603) 374-7120 ```