[PyMOL] Add fragment

2015-05-20 Thread Benjamin Bobay
H
​i All,

I was wondering if someone could point me to the correct notation for
something.

When making a peptide from the command line one could type:

for aa in "GTHYRD":cmd._alt(string.lower(aa))

Let's say that I want to add a methane. The key code is CTRL+SHIFT+M

I was wondering how to alter the "cmd.​
_
​alt" to be CTRL-SHIFT.

I've tried ​
​"cmd._ctrl+_shift"
"cmd._ctrl and _shift"
"cmd.(_ctrl and _shift)"​
"cmd._ctrl._shift"

Nothing has worked. I searched the list serve but came up empty on how to
combine two keys to the "cmd'.

Any help would be greatly appreciated!

Thanks
Ben

-- 

Research Assistant Professor
North Carolina State University
Department of Molecular and Structural Biochemistry
128 Polk Hall
Campus Box 7622
Raleigh, NC 27695
Phone: (919)-513-0698
Fax: (919)-515-2047
http://biochem.ncsu.edu/
http://biochem.ncsu.edu/faculty/bobay/bobaypage.php
http://biochem.ncsu.edu/faculty/bobay/index.php
http://biochem.ncsu.edu/NMR

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
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

Re: [PyMOL] Add fragment

2015-05-20 Thread Sampson, Jared
Hi Ben -

Try this:

editor.attach_fragment("pk1", "methane", 1, 0)

Here's how I tracked this down, not having known about this function before 
your email.  cmd._alt() and likewise cmd._ctrl() are functions (you can see for 
yourself in the source code in pymol/modules/pymol/cmd.py), and they are 
basically wrappers (via internal.py and back through cmd.py again) for 
functions in keyboard.py called keyboard.get_alt() and keyboard.get_ctrl(), 
which each return a dictionary list of commands to run for each shortcut key.  
For example:

def get_alt(self_cmd=cmd):
return {
'1' : [ editor.attach_fragment  , ("pk1","formamide",5,0), {}],
'2' : [ editor.attach_fragment  , ("pk1","formamide",4,0), {}],
'3' : [ editor.attach_fragment  , ("pk1","sulfone",3,1), {}],
'4' : [ editor.attach_fragment  , ("pk1","cyclobutane",4,0), {}],
'5' : [ editor.attach_fragment  , ("pk1","cyclopentane",5,0), {}],
'6' : [ editor.attach_fragment  , ("pk1","cyclohexane",7,0), {}],
'7' : [ editor.attach_fragment  , ("pk1","cycloheptane",8,0), {}],
'8' : [ editor.attach_fragment  , ("pk1","cyclopentadiene",5,0), {}],
'9' : [ editor.attach_fragment  , ("pk1","benzene",6,0), {}],
'0' : [ editor.attach_fragment  , ("pk1","formaldehyde",2,0), {}],
'a' : [ editor.attach_amino_acid, ("pk1","ala"), {}],
'b' : [ editor.attach_amino_acid, ("pk1","ace"), {}],
'c' : [ editor.attach_amino_acid, ("pk1","cys"), {}],
'd' : [ editor.attach_amino_acid, ("pk1","asp"), {}],
'e' : [ editor.attach_amino_acid, ("pk1","glu"), {}],
'f' : [ editor.attach_amino_acid, ("pk1","phe"), {}],
...etc
}

So to add a methyl group, just model it after the cyclobutane example, and just 
run the editor.attach_fragment command (which you can explore in 
pymol/modules/pymol/editor.py) for methane.  A little more info from the 
editor.attach_fragment() docstring:

def attach_fragment(selection,fragment,hydrogen,anchor,_self=cmd):
'''
ARGUMENTS

selection = str: must be "pk1"

fragment = str: fragment name to load from fragment library

hydrogen = int: hydrogen atom ID in fragment to fuse

anchor = int: none-hydrogen atom ID in fragment to fuse
'''

You can also define custom 
fragments.

Also, in case you didn't know about it, an easier way to create your peptide 
might be the `fab` function (so long as you don't need to continue editing it 
afterward):

fab GTHYRD, my_peptide

Hope that helps!

Cheers,
Jared

--
Jared Sampson
Xiangpeng Kong Lab
NYU Langone Medical Center
http://kong.med.nyu.edu/


On May 20, 2015, at 8:43 AM, Benjamin Bobay 
mailto:bgbo...@ncsu.edu>> wrote:

H
​i All,

I was wondering if someone could point me to the correct notation for something.

When making a peptide from the command line one could type:

for aa in "GTHYRD":cmd._alt(string.lower(aa))

Let's say that I want to add a methane. The key code is CTRL+SHIFT+M

I was wondering how to alter the "cmd.​
_
​alt" to be CTRL-SHIFT.

I've tried ​
​"cmd._ctrl+_shift"
"cmd._ctrl and _shift"
"cmd.(_ctrl and _shift)"​
"cmd._ctrl._shift"

Nothing has worked. I searched the list serve but came up empty on how to 
combine two keys to the "cmd'.

Any help would be greatly appreciated!

Thanks
Ben

--

Research Assistant Professor
North Carolina State University
Department of Molecular and Structural Biochemistry
128 Polk Hall
Campus Box 7622
Raleigh, NC 27695
Phone: (919)-513-0698
Fax: (919)-515-2047
http://biochem.ncsu.edu/
http://biochem.ncsu.edu/faculty/bobay/bobaypage.php
http://biochem.ncsu.edu/faculty/bobay/index.php
http://biochem.ncsu.edu/NMR

--
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
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

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
PyMOL-use

Re: [PyMOL] Add fragment

2015-05-20 Thread Benjamin Bobay
Jared -

Many thanks for the quick reply. I think you and I found the same thing at
the same time.

I noticed in the keyboard.py file that there was a "get_ctsh" section.
Which I assumed (and it is) equivalent to "Ctrl-Shift".

Also under the "get_ctsh" section there was no definition for
"Ctrl-Shift-M":
'm' : [ editor.attach_amino_acid, ("pk1","methane"), {}],

So I added it and it works.

Now you can type on the command line.

for aa in "M": cmd._ctsh(string.lower(aa))

and get a methane molecule.

Thanks for the help and guidance.

Ben



On Wed, May 20, 2015 at 12:49 PM, Sampson, Jared 
wrote:

>  Hi Ben -
>
>  Try this:
>
>  editor.attach_fragment("pk1", "methane", 1, 0)
>
>  Here's how I tracked this down, not having known about this function
> before your email.  cmd._alt() and likewise cmd._ctrl() are functions (you
> can see for yourself in the source code in pymol/modules/pymol/cmd.py), and
> they are basically wrappers (via internal.py and back through cmd.py again)
> for functions in keyboard.py called keyboard.get_alt() and
> keyboard.get_ctrl(), which each return a dictionary list of commands to run
> for each shortcut key.  For example:
>
>  def get_alt(self_cmd=cmd):
> return {
> '1' : [ editor.attach_fragment  , ("pk1","formamide",5,0), {}],
> '2' : [ editor.attach_fragment  , ("pk1","formamide",4,0), {}],
> '3' : [ editor.attach_fragment  , ("pk1","sulfone",3,1), {}],
> '4' : [ editor.attach_fragment  , ("pk1","cyclobutane",4,0), {}],
> '5' : [ editor.attach_fragment  , ("pk1","cyclopentane",5,0), {}],
> '6' : [ editor.attach_fragment  , ("pk1","cyclohexane",7,0), {}],
> '7' : [ editor.attach_fragment  , ("pk1","cycloheptane",8,0), {}],
> '8' : [ editor.attach_fragment  , ("pk1","cyclopentadiene",5,0),
> {}],
> '9' : [ editor.attach_fragment  , ("pk1","benzene",6,0), {}],
> '0' : [ editor.attach_fragment  , ("pk1","formaldehyde",2,0), {}],
> 'a' : [ editor.attach_amino_acid, ("pk1","ala"), {}],
> 'b' : [ editor.attach_amino_acid, ("pk1","ace"), {}],
>
> 'c' : [ editor.attach_amino_acid, ("pk1","cys"), {}],
> 'd' : [ editor.attach_amino_acid, ("pk1","asp"), {}],
> 'e' : [ editor.attach_amino_acid, ("pk1","glu"), {}],
> 'f' : [ editor.attach_amino_acid, ("pk1","phe"), {}],
> ...etc
> }
>
>  So to add a methyl group, just model it after the cyclobutane example,
> and just run the editor.attach_fragment command (which you can explore in
> pymol/modules/pymol/editor.py) for methane.  A little more info from the
> editor.attach_fragment() docstring:
>
>  def attach_fragment(selection,fragment,hydrogen,anchor,_self=cmd):
> '''
> ARGUMENTS
>
>  selection = str: must be "pk1"
>
>  fragment = str: fragment name to load from fragment library
>
>  hydrogen = int: hydrogen atom ID in fragment to fuse
>
>  anchor = int: none-hydrogen atom ID in fragment to fuse
> '''
>
>  You can also define custom fragments
> 
> .
>
>  Also, in case you didn't know about it, an easier way to create your
> peptide might be the `fab` function (so long as you don't need to continue
> editing it afterward):
>
>  fab GTHYRD, my_peptide
>
>  Hope that helps!
>
>  Cheers,
> Jared
>
>   --
> Jared Sampson
> Xiangpeng Kong Lab
> NYU Langone Medical Center
> http://kong.med.nyu.edu/
>
>
>   On May 20, 2015, at 8:43 AM, Benjamin Bobay  wrote:
>
>  H
> ​i All,
>
>  I was wondering if someone could point me to the correct notation for
> something.
>
>  When making a peptide from the command line one could type:
>
> for aa in "GTHYRD":cmd._alt(string.lower(aa))
>
>  Let's say that I want to add a methane. The key code is CTRL+SHIFT+M
>
>  I was wondering how to alter the "cmd.​
> _
> ​alt" to be CTRL-SHIFT.
>
>  I've tried ​
> ​"cmd._ctrl+_shift"
>  "cmd._ctrl and _shift"
>  "cmd.(_ctrl and _shift)"​
>  "cmd._ctrl._shift"
>
>  Nothing has worked. I searched the list serve but came up empty on how
> to combine two keys to the "cmd'.
>
>  Any help would be greatly appreciated!
>
>  Thanks
>  Ben
>
> --
>  
> Research Assistant Professor
> North Carolina State University
> Department of Molecular and Structural Biochemistry
> 128 Polk Hall
> Campus Box 7622
> Raleigh, NC 27695
> Phone: (919)-513-0698
> Fax: (919)-515-2047
> http://biochem.ncsu.edu/
> http://biochem.ncsu.edu/faculty/bobay/bobaypage.php
> http://biochem.ncsu.edu/faculty/bobay/index.php
> http://biochem.ncsu.edu/NMR
> 
>
> --
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insig

Re: [PyMOL] Handling of scene specific global settings?

2015-05-20 Thread Thomas Holder
Hi Carsten,

no, the scenes refactoring did not add settings support. This could be a 
feature request for the next version.

Cheers,
  Thomas

On 15 May 2015, at 16:46, Schubert, Carsten [JRDUS]  
wrote:

> Hi,
>  
> with the current refactoring of the scene code was there any consideration 
> given to the handling of scene specific global settings? For instance 
> “cartoon putty” vs. “cartoon automatic” or settings like “sphere_scale” are 
> only applied once on a global scope and carry over to all scenes, even though 
> in my script they have been defined individually for different scenes.
> Right now I am using 1.7.3, but was wondering if anything has changed in 
> 1.7.6 in that regard? The issue is not new, but it would be nice if there 
> would be a feature like this implemented.
>  
> Cheers, 
> Carsten

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
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


[PyMOL] Bug report: cmd.fab() with existing object name produces unexpected results and downstream segfault

2015-05-20 Thread Sampson, Jared
In the process of investigating Ben Bobay's 
question about 
keyboard shortcuts for adding a methyl group, I may have found a bug, or at 
least unexpected behavior, in cmd.fab().

When first creating a peptide, it works fine:

fab , pep

However, if I call it again with a different (or the same) sequence,

fab , pep

The new residues are overlaid right on top of the initial ones, and 
interspersed in the sequence order (overlapping sticks, 
Screenshot1).
  This breaks cartoon representation, as Ala1 and Ala2 are no longer contiguous 
in the sequence (`as cartoon` leaves nothing drawn, 
Screenshot2).

Also, something happens when switching representations (e.g. from cartoon to 
sticks) that segfaults with certain sequences.  I can semi-reproducibly produce 
a segfault (perhaps 2/3 of the time) with the following commands in Open Source 
PyMOL (1.7.4.0), PyMOLX11Hybrid (1.7.6.0), and MacPyMOL (1.7.6.0).

reinitialize
fab , pep
fab ADAA, pep
as cartoon
as sticks
# sometimes it takes an extra line or two
#fab AADA, pep
#as sticks

I believe this happens specifically when some residues are the same and some 
are different: I haven't been able to produce a segfault using "" as the 
second sequence, but adding the third sequence (second to last line) 
reintroduces the segfault.

I would expect calling `fab` with an existing object name to perform one of the 
following actions (from most to least preferable):

1. Append the residues to the C-terminus of the existing object with sensible 
geometry, similar to `editor.attach_fragment()`.
2. Add a new state to the object with the new sequence, as with 
`cmd.load(state=0)`.
3. Overwrite the existing object (probably not a good idea).

It may also be helpful to have additional arguments to fab, such as append=1 or 
state=0, depending on which of the above options might be implemented.

I'm adding this as a bug report on SourceForge as well.

Cheers,
Jared
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
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

[PyMOL] how to highlight some residues and make other residues being as background?

2015-05-20 Thread sunyeping
Dear all,In order to emphasize local interactions of several residues within a 
protein, I want to highlight these studied residues but make other residues 
vague and being as background. The setting "set fog, on" doesn't help much 
because the constrast between the studied residues and other residues is not 
strong. Could you help me with this problem? With many thanks.Yeping Sun
Institute of Microbiology, Chinese Academy of Sciences--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
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