Re: [PyMOL] Map to cartoon

2023-07-24 Thread Jarrett Johnson
Hi Mark,

Great question. I currently cannot see a way to do so. I think the color
command when providing a ramp should, by intention, color the cartoon, but
there may be a bug or this might not have been implemented yet (the cartoon
removes its color and is set to white). I have a workaround if the only
thing you need to do is color atoms by proximity to another object (using
the example from the `ramp_new` PyMOLWiki documentation). Note that the
color smoothing is not as good as using the `ramp_new` command:

from pymol import cmd

def set_property_proximity_to(obj, target, ramp='red yellow', minimum=None,
maximum=None):
ligand_atoms = []
cmd.iterate_state(0, target, 'ligand_atoms.append((x, y, z))', space=
locals())

def find_nearest_dist(x, y, z):
min2 = min((x - x1) ** 2 + (y - y1) ** 2 + (z - z1) ** 2
   for x1, y1, z1 in ligand_atoms)
return min2 ** 0.5

nearest_ds = []
cmd.alter_state(0, obj, 'nearest_ds.append(find_nearest_dist(x, y, z))',
space=locals())

# Hijack 'b' property for closest distance
cmd.alter(obj, 'b = nearest_ds[index-1]', space=locals())
cmd.spectrum('b', palette='red yellow', selection=obj, minimum=minimum,
maximum=maximum)


cmd.fetch('1rx1')
cmd.extract('ligand', 'organic')
set_property_proximity_to('1rx1', 'ligand', ramp='red yellow', minimum=4,
maximum=8)
cmd.color('blue', 'ligand')
cmd.show('surface', 'ligand')

I'll do some investigation regarding why ramp coloring for cartoons isn't
working as intended (assuming there isn't something I'm missing already).

Hope this helps,

Jarrett J

On Mon, Jul 24, 2023 at 1:27 PM Foster, Mark  wrote:

> Thanks Jarrett for the response.
>
>
>
> I think `spectrum` should work, but I can’t figure out how to access the
> proximity parameter calculated by `ramp_new` in order to use it directly
> (e.g., “p.prox”), or to map it to the b factor.
>
>
>
> Does ramp_new store the values in an array?
>
>
>
> -M
>
>
>
>
>
> *From: *Jarrett Johnson 
> *Date: *Monday, July 24, 2023 at 12:02 PM
> *To: *Foster, Mark 
> *Cc: *pymol-users@lists.sourceforge.net  >
> *Subject: *Re: [PyMOL] Map to cartoon
>
> Hi Mark, Does the `spectrum` command cover your use case? https:
> //pymolwiki. org/index. php/Spectrum . You can specify an atomic property
> and map specified colors to a range of the given property. Hope that helps,
> Jarrett J. On Mon, Jul 24, 2023
>
> Hi Mark,
>
> Does the `spectrum` command cover your use case?
> https://pymolwiki.org/index.php/Spectrum
> <https://urldefense.com/v3/__https:/pymolwiki.org/index.php/Spectrum__;!!KGKeukY!2YCpuhVe5GRqx_4jegX3LkI02R8BJqaQz4vDGwiaUTk4P0DKAA-uma5ffkB7b706ohBs7I5Alp7QFqei3X8edZnW_j-ow-ipqQ$>
> . You can specify an atomic property and map specified colors to a range of
> the given property.
>
> Hope that helps,
> Jarrett J.
>
>
>
> On Mon, Jul 24, 2023 at 9:21 AM Foster, Mark  wrote:
>
> PyMOL fans,
>
>
>
> Is possible to use ramp_new to color cartoons, in addition to atoms and
> surfaces?
>
>
>
> I assume ramp_new stores the property to be mapped in a variable that
> could be used for the CA atom color.
>
>
>
> color prox, (sele) sets the color of each atom, but not the cartoon.
>
>
>
> Thanks in advance,
>
>
>
> -M
>
>
>
>
>
> —
>
> Mark P. Foster, Professor, he/him
> Department of Chemistry and Biochemistry
> The Ohio State University
> 734 Riffe Building
> 484 West 12th Ave.
> Columbus, OH 43210-1214
> (614) 292-1377
> foster@osu.edu
> http://go.osu.edu/fosterlab
>
> --
>
> Acknowledgement: The land that The Ohio State University occupies is the
> ancestral and contemporary territory of the Shawnee, Potawatomi, Delaware,
> Miami, Peoria, Seneca, Wyandotte, Ojibwe and Cherokee peoples. The
> university resides on land ceded in the 1795 Treaty of Greeneville and
> appropriated through the Indian Removal Act of 1830. As a land grant
> institution, we wish to honor the resiliency of these tribal nations and
> recognize the historical context that has and continues to affect the
> Indigenous peoples of this land.
>
>
>
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> <https://urldefense.com/v3/__http:/www.mail-archive.com/pymol-users@lists.sourceforge.net__;!!KGKeukY!2YCpuhVe5GRqx_4jegX3LkI02R8BJqaQz4vDGwiaUTk4P0DKAA-uma5ffkB7b706ohBs7I5Alp7QFqei3X8edZnW_j_ykYKLTA$>
> Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
> <https://urldefense.com/v3/__https:/sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe__;!!K

Re: [PyMOL] Map to cartoon

2023-07-24 Thread Jarrett Johnson
Hi Mark,

Does the `spectrum` command cover your use case?
https://pymolwiki.org/index.php/Spectrum . You can specify an atomic
property and map specified colors to a range of the given property.

Hope that helps,
Jarrett J.

On Mon, Jul 24, 2023 at 9:21 AM Foster, Mark  wrote:

> PyMOL fans,
>
>
>
> Is possible to use ramp_new to color cartoons, in addition to atoms and
> surfaces?
>
>
>
> I assume ramp_new stores the property to be mapped in a variable that
> could be used for the CA atom color.
>
>
>
> color prox, (sele) sets the color of each atom, but not the cartoon.
>
>
>
> Thanks in advance,
>
>
>
> -M
>
>
>
>
>
> —
>
> Mark P. Foster, Professor, he/him
> Department of Chemistry and Biochemistry
> The Ohio State University
> 734 Riffe Building
> 484 West 12th Ave.
> Columbus, OH 43210-1214
> (614) 292-1377
> foster@osu.edu
> http://go.osu.edu/fosterlab
>
> --
>
> Acknowledgement: The land that The Ohio State University occupies is the
> ancestral and contemporary territory of the Shawnee, Potawatomi, Delaware,
> Miami, Peoria, Seneca, Wyandotte, Ojibwe and Cherokee peoples. The
> university resides on land ceded in the 1795 Treaty of Greeneville and
> appropriated through the Indian Removal Act of 1830. As a land grant
> institution, we wish to honor the resiliency of these tribal nations and
> recognize the historical context that has and continues to affect the
> Indigenous peoples of this land.
>
>
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>


-- 

*Jarrett Johnson* | Senior Developer, PyMOL
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

[PyMOL] Map to cartoon

2023-07-24 Thread Foster, Mark
PyMOL fans,

Is possible to use ramp_new to color cartoons, in addition to atoms and 
surfaces?

I assume ramp_new stores the property to be mapped in a variable that could be 
used for the CA atom color.

color prox, (sele) sets the color of each atom, but not the cartoon.

Thanks in advance,

-M


—
Mark P. Foster, Professor, he/him
Department of Chemistry and Biochemistry
The Ohio State University
734 Riffe Building
484 West 12th Ave.
Columbus, OH 43210-1214
(614) 292-1377
foster@osu.edu
http://go.osu.edu/fosterlab
--
Acknowledgement: The land that The Ohio State University occupies is the 
ancestral and contemporary territory of the Shawnee, Potawatomi, Delaware, 
Miami, Peoria, Seneca, Wyandotte, Ojibwe and Cherokee peoples. The university 
resides on land ceded in the 1795 Treaty of Greeneville and appropriated 
through the Indian Removal Act of 1830. As a land grant institution, we wish to 
honor the resiliency of these tribal nations and recognize the historical 
context that has and continues to affect the Indigenous peoples of this land.

___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe