[Chimera-users] Problem with sum?

Jean Didier Pie Marechal JeanDidier.Marechal at uab.cat
Mon Oct 27 05:47:33 PDT 2008


Hi guys,

I got back to the script on inertia axis calculation and I had the following error when running it on the built of th 15/10/2008 on my linux box:

Traceback (most recent call last):
  File "/home/jd/Desktop/scripts/chimera/inertia_model.py", line 73, in <module>
    axes, d2, center = inertia_ellipsoid(m)
  File "/home/jd/Desktop/scripts/chimera/inertia_model.py", line 13, in inertia_ellipsoid
    mass = sum(amass)
TypeError: 'float' object is not callable

then I just try in the python shell:
i=[1,2,3]
sum(i) 

and I have the same prob. sum(i)

Traceback (most recent call last):
  File "<pyshell#38>", line 1, in <module>
    sum(i)
TypeError: 'float' object is not callable


Some input?

all the best
JD

Dr. Jean-Didier Maréchal
Lecturer
Computational Bioorganic and Bioionorganic Chemistry @ Transmet
Unitat de Química Física
Departament de Química
Universitat Autònoma de Barcelona
Edifici C.n.
08193 Cerdanyola (Barcelona)
Tel: +34.935814936
e-mail: JeanDidier.Marechal at uab.es

----- Missatge original -----
De: chimera-users-request at cgl.ucsf.edu
Data: Dimecres, Març 19, 2008 8:43 pm
Assumpte: Chimera-users Digest, Vol 59, Issue 19

> Send Chimera-users mailing list submissions to
> 	chimera-users at cgl.ucsf.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> or, via email, send a message with subject or body 'help' to
> 	chimera-users-request at cgl.ucsf.edu
> 
> You can reach the person managing the list at
> 	chimera-users-owner at cgl.ucsf.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Chimera-users digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Principal axis of inertia (Tom Goddard)
>   2. problem with 17/03 build linux 64 (Jean-Didier Mar?chal)
>   3. Un-tile (Jim Nettles)
> 
> 
> --------------------------------------------------------------------
> --
> 
> Message: 1
> Date: Wed, 19 Mar 2008 12:00:33 -0700
> From: Tom Goddard <goddard at cgl.ucsf.edu>
> Subject: Re: [Chimera-users] Principal axis of inertia
> To: Eric Pettersen <pett at cgl.ucsf.edu>
> Cc: 'Chimera BB' <chimera-users at cgl.ucsf.edu>
> Message-ID: <47E162D1.5070108 at cgl.ucsf.edu>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi Eric,
> 
>  Just ignorance -- didn't know Chimera could tell me the atomic 
> mass.  
> Attached is the same script only using atomic mass instead of 
> atomic number.
> 
>    Tom
> 
> Eric Pettersen wrote:
> > Just wondering why you weighted by atomic number rather than mass 
> 
> > (a.element.mass)?
> >
> > --Eric
> >   
> 
> -------------- next part --------------
> An embedded and charset-unspecified text was scrubbed...
> Name: inertiapdb.py
> Url: http://www.cgl.ucsf.edu/pipermail/chimera-
> users/attachments/20080319/049d4e60/attachment-0001.ksh 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 19 Mar 2008 20:35:44 +0100
> From: Jean-Didier Mar?chal <jeandidier.marechal at uab.es>
> Subject: [Chimera-users] problem with 17/03 build linux 64
> To: chimera-users at cgl.ucsf.edu
> Message-ID: <1205955344.6758.9.camel at AMD3800>
> Content-Type: text/plain; charset=UTF-8
> 
> Hi guys,
> 
> thanks a lot for the different answers. I wanted to test Elaine's
> suggestion and I install the last linux 64 build. 
> 
> When running chimera I have:
> Traceback (most recent call last):
>  File "/usr/local/chimera/share/__main__.py", line 65, in <module>
>    value = chimeraInit.init(sys.argv)
>  File "/usr/local/chimera/share/chimeraInit.py", line 304, in init
>    from chimera import tkgui
>  File "CHIMERA/share/chimera/tkgui.py", line 80, in <module>
>  File "CHIMERA/share/chimera/printer.py", line 444, in <module>
> AttributeError: 'module' object has no attribute 'No'
> 
> Some problem in my installation ?
> 
> All the best
> JD
> 
> El mi?, 19-03-2008 a las 12:00 -0700, chimera-users-
> request at cgl.ucsf.eduescribi?:
> > Send Chimera-users mailing list submissions to
> > 	chimera-users at cgl.ucsf.edu
> > 
> > To subscribe or unsubscribe via the World Wide Web, visit
> > 	http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> > or, via email, send a message with subject or body 'help' to
> > 	chimera-users-request at cgl.ucsf.edu
> > 
> > You can reach the person managing the list at
> > 	chimera-users-owner at cgl.ucsf.edu
> > 
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Chimera-users digest..."
> > 
> > 
> > Today's Topics:
> > 
> >    1. Re: Principal axis of inertia (Eric Pettersen)
> > 
> > 
> > ------------------------------------------------------------------
> ----
> > 
> > Message: 1
> > Date: Wed, 19 Mar 2008 11:47:51 -0700
> > From: Eric Pettersen <pett at cgl.ucsf.edu>
> > Subject: Re: [Chimera-users] Principal axis of inertia
> > To: "'Chimera BB'" <chimera-users at cgl.ucsf.edu>
> > Message-ID: <DDE1C65B-AD42-48C1-9414-91625662D812 at cgl.ucsf.edu>
> > Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; 
> format=flowed> 
> > Just wondering why you weighted by atomic number rather than mass 
> 
> > (a.element.mass)?
> > 
> > --Eric
> > 
> > On Mar 19, 2008, at 11:42 AM, Tom Goddard wrote:
> > 
> > > Hi JD,
> > >
> > >  Attached is a script that computes the inertia axes of 
> molecules.   
> > > Open a molecule, then open the script.  It will print the axes 
> in  
> > > the reply log and show an inertia ellipsoid.  It is weighting 
> the  
> > > atoms by their atomic number, not by the average isotopic mass. 
>  
> > > Tested in Chimera 1.2498.  Should work in older Chimera versions.
> > >
> > >    Tom
> > >
> > > Jean-Didier Mar?chal wrote:
> > >> Hi everyone,
> > >>
> > >> I was wondering if there is a method available to calculate the
> > >> principal axis of inertia of a protein (or a part of a 
> protein) in
> > >> chimera?
> > >>
> > >> If not what would be the easiest way to move forward?
> > >>
> > >> All the best,
> > >>
> > >> JD
> > >>
> > >>
> > >
> > >
> > > #  
> > > ----------------------------------------------------------------
> ------ 
> > > -------
> > > # Compute inertia tensor principle axes for molecule.
> > > #
> > > def inertia_ellipsoid(m):
> > >
> > >   atoms = m.atoms
> > >   n = len(atoms)
> > >   from _multiscale import get_atom_coordinates
> > >   xyz = get_atom_coordinates(atoms)
> > >   anum = [a.element.number for a in atoms]
> > >   from numpy import array, dot, outer, argsort, linalg
> > >   wxyz = array(anum).reshape((n,1)) * xyz
> > >   mass = sum(anum)
> > >
> > >   c = wxyz.sum(axis = 0) / mass    # Center of mass
> > >   v33 = dot(xyz.transpose(), wxyz) / mass - outer(c,c)
> > >   eval, evect = linalg.eigh(v33)
> > >
> > >   # Sort by eigenvalue size.
> > >   order = argsort(eval)
> > >   seval = eval[order]
> > >   sevect = evect[:,order]
> > >
> > >   return sevect, seval, c
> > >
> > > #  
> > > ----------------------------------------------------------------
> ------ 
> > > -------
> > > #
> > > def ellipsoid_surface(center, axes, lengths, color = 
> (.7,.7,.7,1)):> >
> > >   from Icosahedron import icosahedron_triangulation
> > >   varray, tarray = icosahedron_triangulation(subdivision_levels 
> = 3,
> > >                                              sphere_factor = 1.0)
> > >   from numpy import dot, multiply
> > >   es = dot(varray, axes)
> > >   ee = multiply(es, lengths)
> > >   ev = dot(ee, axes.transpose())
> > >   ev += center
> > >
> > >   import _surface
> > >   sm = _surface.SurfaceModel()
> > >   sm.addPiece(ev, tarray, color)
> > >   return sm
> > >
> > > #  
> > > ----------------------------------------------------------------
> ------ 
> > > -------
> > > #
> > > def show_ellipsoid(axes, d2, center, model):
> > >
> > >   from math import sqrt
> > >   d = [sqrt(e) for e in d2]
> > >   sm = ellipsoid_surface(center, axes, d)
> > >   sm.name = 'inertia ellipsoid for %s' % m.name
> > >   from chimera import openModels as om
> > >   om.add([sm], sameAs = model)
> > >
> > > #  
> > > ----------------------------------------------------------------
> ------ 
> > > -------
> > > #
> > > def print_axes(axes, d2, m):
> > >
> > >   from math import sqrt
> > >   paxes = ['\tv%d = %6.3f %6.3f %6.3f   d%d = %6.3f' %
> > >            (a+1, axes[a][0], axes[a][1], axes[a][2], a+1, 
> sqrt(d2[a]))> >            for a in range(3)]
> > >   from chimera.replyobj import info
> > >   info('Inertia axes for %s\n%s\n' % (m.name, '\n'.join(paxes)))
> > >   from Accelerators.standard_accelerators import show_reply_log
> > >   show_reply_log()
> > >
> > > #  
> > > ----------------------------------------------------------------
> ------ 
> > > -------
> > > #
> > > from chimera import openModels as om, Molecule
> > > mlist = om.list(modelTypes = [Molecule])
> > > for m in mlist:
> > >   axes, d2, center = inertia_ellipsoid(m)
> > >   print_axes(axes, d2, m)
> > >   show_ellipsoid(axes, d2, center, m)
> > > _______________________________________________
> > > Chimera-users mailing list
> > > Chimera-users at cgl.ucsf.edu
> > > http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> > 
> > 
> > 
> > ------------------------------
> > 
> > _______________________________________________
> > Chimera-users mailing list
> > Chimera-users at cgl.ucsf.edu
> > http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> > 
> > 
> > End of Chimera-users Digest, Vol 59, Issue 18
> > *********************************************
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 19 Mar 2008 15:43:34 -0400
> From: Jim Nettles <jnettle at emory.edu>
> Subject: [Chimera-users] Un-tile
> To: chimera-users at cgl.ucsf.edu
> Message-ID: <5464F6BF-1FA4-4DC6-B676-AEC6CCCBA3CF at emory.edu>
> Content-Type: text/plain; charset="us-ascii"
> 
> Thanks that is a useful function I hadn't explored.
> 
> However, how to you un-tile to go back to a previously aligned system?
> 
> Thanks,
> 
> Jim
> 
> 
> >
> > Message: 4
> > Date: Wed, 19 Mar 2008 16:53:11 +0530
> > From: "Bharat Yadav" <bharatbioinformaticshau at gmail.com>
> > Subject: [Chimera-users] Requesting to solve my poblem
> > To: chimera-users at cgl.ucsf.edu
> > Message-ID:
> > 	<e162fe4e0803190423k5651193amf41e192251b613c3 at mail.gmail.com>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Hello Sir / Madam
> >
> > Good Evening
> >
> > My name is Bharat Yadav and I am perusing Master's Degree in
> > Bioinformatics from Chaudhary Charan Singh Haryana Agriculrual
> > University - Hisar (India). I am working here on Molecular Modeling.
> > With a long time I am using UCSF Chimera. It is the one of wonderful
> > Molecular visiualization software haivng some very peculear 
> features.> Respected Sir / Madam, In my present work I am facing a 
> bit problem.
> > Hoping form you to help regarding this. My problem is as follows. I
> > have generated five models of protein. when I open all these modles
> > these were overlapping each other. I want to view all these five
> > models in a single panel non overlapping. I mean I want to view 
> these> 3D models in panel as follows
> > -----------------------------------------
> > |                     |                 |
> > |                     |                 |
> > |   Model 1       |  Model 2   |
> > |                     |                 |
> > -----------------------------------------
> > |                     |                 |
> > |                     |                 |
> > |   Model 3       |  Model 4   |
> > |                     |                 |
> > -----------------------------------------
> > |                     |                 |
> > |                     |                 |
> > |   Model 5       |  Model 6   |
> > |                     |                 |
> > -----------------------------------------
> >
> > Hope that you now easily understand what actually I want. Please 
> Help> me regarding this and mail me its solution or steps or 
> commands for
> > this task. Please free to ask any question.
> >
> > Thanks in anticipation
> >
> > Warm regards from Bharat Yadav
> >
> >
> > ------------------------------
> >
> > Message: 5
> > Date: Wed, 19 Mar 2008 10:11:52 -0700
> > From: Elaine Meng <meng at cgl.ucsf.edu>
> > Subject: Re: [Chimera-users] Requesting to solve my poblem
> > To: "Bharat Yadav" <bharatbioinformaticshau at gmail.com>
> > Cc: chimera-users at cgl.ucsf.edu
> > Message-ID: <37BB555C-E967-43BB-B6EA-5CD8A75853FD at cgl.ucsf.edu>
> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> >
> > Hi Bharat,
> >
> > Thanks for your kind words!  I think you just need to use "tile" in
> > the Model Panel.  Open Model Panel (Favorites... Model Panel).  In
> > there, choose all 5 models on the left side.  Then, on the right,
> > change the menu from "frequently used" to "infrequently used" - now
> > there should be a "tile" button on the right - try using that.
> >
> > I hope this helps,
> > Elaine
> > -----
> > Elaine C. Meng, Ph.D.                          meng at cgl.ucsf.edu
> > UCSF Computer Graphics Lab and Babbitt Lab
> > Department of Pharmaceutical Chemistry
> > University of California, San Francisco
> >                       http://www.cgl.ucsf.edu/home/meng/index.html
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.cgl.ucsf.edu/pipermail/chimera-
> users/attachments/20080319/21246941/attachment.html 
> 
> ------------------------------
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 
> 
> End of Chimera-users Digest, Vol 59, Issue 19
> *********************************************
> 




More information about the Chimera-users mailing list