[chimerax-users] scalemol extension not working

André Graça andre.graca at umu.se
Thu Jan 19 03:13:38 PST 2023


Hi everyone,

I hope to at least get a reply from Tom, but this may need a bit of troubleshooting (?).

I looked into a very old post of yours, Tom,  about rescaling an atomic model (see it at the end of my email).
I put everything in place but I get an  error and I wonder if anything has changed with the PDB format since 2005, or some incompatibility with new chimera versions...

If there is actually a way of doing the same with ChimeraX, that would be incredible =)

Cheers!
André

Error and forwarded message comes now:
__________________________________________________
AttributeError Exception in Tk callback
  Function: <bound method MidasUI.processCommand of <Midas.midas_ui.MidasUI instance at 0x00000000079092C8>> (type: <type 'instancemethod'>)
  Module: <module 'Midas.midas_ui' from 'C:\Program Files\Chimera 1.16\share\Midas\midas_ui.pyc'> (line: 618)
  Args: (<Tkinter.Event instance at 0x00000000198D8AC8>,)
  Event type: KeyPress (type num: 2)
Traceback (innermost last):
  File "C:\Program Files\Chimera 1.16\bin\lib\site-packages\Pmw\Pmw_1_3_3\lib\PmwBase.py", line 1747, in __call__
    return apply(self.func, args)
  File "C:\Program Files\Chimera 1.16\share\Midas\midas_ui.py", line 628, in processCommand
    midas_text.makeCommand(cmdText)
  File "C:\Program Files\Chimera 1.16\share\Midas\midas_text.py", line 69, in makeCommand
    f(c, args)
  File "C:\Program Files\Chimera 1.16\share\scalemol\ChimeraExtension.py", line 23, in scale_molecule
    x, y, z = a.coord().xyz.data()
AttributeError: '_chimera.Point' object has no attribute 'xyz'

================================================
  Event contents:
    char:
    delta: 0
    height: ??
    keycode: 13
    keysym: Return
    keysym_num: 65293
    num: ??
    serial: 14638
    state: 8
    time: 154527203
    type: 2
    widget: .121252488L.126915336L.428746824L.428747592L.428747720L
    width: ??
    x: 228
    x_root: 288
    y: -22
    y_root: 941
______________________________________________________________________
















------- Start of forwarded message -------



Date: Wed, 27 Apr 2005 11:05:55 -0700 (PDT)

From: Thomas Goddard <goddard at cgl.ucsf.edu<http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>>



Hi Jinghua,



  By "virus cage pdb file" I guess you mean you placed atoms at

icosahedral positions, and want to show them connected up to show some

icosahedral pattern.



  I think the easiest approach is to open your old session, run a

command to change the diameter of the cage, then save a new session.

Below is some Python code that provides a "scalemol" Chimera command.

Make a directory chimera/share/scalemol in your Chimera distribution

and put the code below in file chimera/share/scalemol/ChimeraExtension.py.

Then start Chimera, open the cage PDB model, use menu entry

Favorites/Command line, and type a command:



        scalemol 0 1.5



to make model number 0 bigger by a factor of 1.5.  If you have more than

one model open you can see the model numbers using Favorites / Model Panel,

the model number is shown in the left hand column.



    Tom





- ----

scalemol/ChimeraExtension.py code follows:





# -----------------------------------------------------------------------------

#

def scale_molecule(cmdname, args):



    from Midas.midas_text import error



    fields = args.split()

    try:

        model_num = int(fields[0])

        factor = float(fields[1])

    except:

        error('Syntax error: scalemol <model-number> <factor>')

        return



    import chimera

    mlist = chimera.openModels.list(id = model_num)

    if len(mlist) == 0:

        error('scalemol: No model number %d' % model_num)

        return



    for model in mlist:

        for a in model.atoms:

            x, y, z = a.coord().xyz.data()

            c = chimera.Coord()

            c.x, c.y, c.z = (factor*x, factor*y, factor*z)

            a.setCoord(c)



# -----------------------------------------------------------------------------

#

import Midas.midas_text

Midas.midas_text.addCommand('scalemol', scale_molecule)



------- End of forwarded message -------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20230119/1ba690a7/attachment.html>


More information about the ChimeraX-users mailing list