|
From: Benjamin B. <bg...@nc...> - 2015-05-20 12:43:30
|
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 ____________________________________________ |
|
From: Sampson, J. <Jar...@ny...> - 2015-05-20 16:49:59
|
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<http://www.pymolwiki.org/index.php?title=Modeling_and_Editing_Structures#Adding_and_using_your_own_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 <bg...@nc...<mailto:bg...@nc...>> 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 (PyM...@li...)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pym...@li...
|
|
From: Benjamin B. <bg...@nc...> - 2015-05-20 17:22:45
|
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 <Jar...@ny...>
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
> <http://www.pymolwiki.org/index.php?title=Modeling_and_Editing_Structures#Adding_and_using_your_own_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 <bg...@nc...> 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 (PyM...@li...)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pym...@li...
>
>
>
--
____________________________________________
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
____________________________________________
|
|
From: Sampson, J. <Jar...@ny...> - 2015-05-20 18:22:50
|
In the process of investigating Ben Bobay's question<https://sourceforge.net/p/pymol/mailman/message/34128680/> 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 AAAA, pep However, if I call it again with a different (or the same) sequence, fab DDDD, pep The new residues are overlaid right on top of the initial ones, and interspersed in the sequence order (overlapping sticks, Screenshot1<https://www.dropbox.com/s/e6hmr0vb8jlfq6q/Screenshot%202015-05-20%2013.00.36.png?dl=0>). This breaks cartoon representation, as Ala1 and Ala2 are no longer contiguous in the sequence (`as cartoon` leaves nothing drawn, Screenshot2<https://www.dropbox.com/s/p85bsftrgi54pq3/Screenshot%202015-05-20%2013.00.49.png?dl=0>). 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 AAAA, 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 "DDDD" 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 |