Hi Albert,

This functionality is not built-in to PyMOL, but is rather simple to implement 
with a script. See attachment. The script adds a "clone_reps" command which 
takes two selections (just like the VMD plugin).

Example:

    run clonerep.py
    fetch 1a00 1hbb, async=0
    as cartoon, 1a00
    spectrum count, rainbow, 1a00

    # clone color and representations
    clone_reps 1a00, 1hbb

    # clone only color
    clone_reps 1a00, 1hbb, props=color

    # clone from chain A to all other chains
    clone_reps 1a00 & chain A, all, match=resi name

Cheers,
  Thomas

from pymol import cmd
@cmd.extend
def clone_reps(fromsele, tosele, match='chain resi name', props='reps color'):
    '''
DESCRIPTION

    Clone color and representation from one selection to another.

ARGUMENTS

    fromsele = str: source selection

    tosele = str: target selection

    match = str: space separated list of atom identifiers to use for
    matching the two selections {default: chain resi name}

    props = str: space separated list of atom properties to clone
    {default: reps color}

EXAMPLE

    fetch 1a00 1hbb, async=0
    as cartoon, 1a00
    spectrum count, rainbow, 1a00
    clone_reps 1a00, 1hbb

SEE ALSO

    scene, iterate, alter
    '''
    match = '(' + ','.join(match.split()) + ')'
    props = '(' + ','.join(props.split()) + ')'
    space = {'_lookup': {}}
    cmd.iterate(fromsele, '_lookup[' + match + '] = ' + props, space=space)
    cmd.alter(tosele, props + ' = _lookup.get(' + match + ', ' + props + ')', space=space)
    cmd.rebuild(tosele)
On 21 Nov 2015, at 10:04, Albert <mailmd2...@gmail.com> wrote:

> Hello:
> 
> I've shown an object as cartoon and displaced sticks with various 
> colors. I am just wondering, can we clone all representation from object 
> 1 to object 2 with some command in Pymol? As far as I known, this is 
> possible in VMD:
> 
> http://www.ks.uiuc.edu/Research/vmd/plugins/clonerep/
> 
> Thank you very much
> 
> Albert

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

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