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 <jared.samp...@nyumc.org>
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 <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
>
>
>


-- 
____________________________________________
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

Reply via email to