Hi Damien,

The following code bins particles and makes a grid of pseudoatoms, putting
the count in the b-factor field and as radius. You should be able to
convert these to cubes using the script (but doing scaled spheres, and
coloring according to count is nifty too).

import numpy

def griddify(selection='all', bins=24, name="grrrrid"):
    """Count particles in grid cells and generate pseudatoms for cell
centers"""
    X=numpy.array(cmd.get_model().get_coord_list())
    lo = X.min()
    up = X.max()
    rng = up-lo
    bins2 = bins*bins
    Y = ((bins-1e-8)*(X-lo)/rng).astype('int')
    Y[:,1] *= bins
    Y[:,2] *= bins2
    B = numpy.bincount( Y.sum(axis=1) )
    for a,b in enumerate(B):
        if b:
            x = l + rng*(a%bins+0.5)/bins
            y = l + rng*((a%(bins2))/bins+0.5)/bins
            z = l + rng*(a/(bins2)+0.5)/bins
            cmd.pseudoatom(name,pos=(x,y,z), b=b,vdw=b)


Hope it helps,

Tsjerk


On Fri, Dec 11, 2015 at 6:50 PM, Damien Clavel <dcla...@ibs.fr> wrote:

> Hi Tsjerk,
>
> As a matter of fact the replacement of atoms by cubes is possible with
> cubes.py. However, this applet doesn't suit my project.
> Indeed, I would like to get a script that describe your second guess!
>
> D
> Le 11/12/15 17:12, Tsjerk Wassenaar a écrit :
>
>
> Hi Damien,
>
> Do you mean replacing the atoms by cubes, or by binning the atoms on a 3D
> grid and show these cubes if filled?
>
> Cheers,
>
> Tsjerk
>
> On Fri, Dec 11, 2015 at 4:51 PM, Damien Clavel <dcla...@ibs.fr> wrote:
>
>> Good evening pymol users,
>>
>> I would like to represent a protein with a superimposed 3D grid of cubes.
>> I tried the applet cubes.py but it is not appropriate for me...
>>
>> So my goal is to control the size of the cubes that will be part of such
>> grid.
>> In addition, it will be really great if I could even control the color
>> (shaded) of each cubes.
>>
>> Does anyone could help me?
>>
>> --
>> *Damien CLAVEL*
>> Cellphone +33 7 81 66 61 70
>> Landline   +33 4 57 42 87 35
>> PhD student at Laboratoire Chimie Physique (UP Sud)
>>                 and Institut de Biologie Structurale (EPN Campus)
>> --------------------------------------------------------------------------
>>     Laboratoire de Chimie Physique
>> <http://www.lcp.u-psud.fr/rubrique.php3?id_rubrique=266/>    Institut de
>> Biologie Structurale <http://www.ibs.fr/spip.php?lang=en>
>>     Bul. 350 Campus Orsay                 EPN Campus
>>     15, Av. Jean Perrin                         6, rue Jules Horowitz
>>     F-91405 ORSAY Cedex                 F-38000 GRENOBLE
>>
>>    [image: Image and video hosting by TinyPic]
>> <http://tinypic.com?ref=28s7yvd>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Tsjerk A. Wassenaar, Ph.D.
>
>
> --
> *Damien CLAVEL*
> Cellphone +33 7 81 66 61 70
> Landline   +33 4 57 42 87 35
> PhD student at Laboratoire Chimie Physique (UP Sud)
>                 and Institut de Biologie Structurale (EPN Campus)
> --------------------------------------------------------------------------
>     Laboratoire de Chimie Physique
> <http://www.lcp.u-psud.fr/rubrique.php3?id_rubrique=266/>    Institut de
> Biologie Structurale <http://www.ibs.fr/spip.php?lang=en>
>     Bul. 350 Campus Orsay                 EPN Campus
>     15, Av. Jean Perrin                         6, rue Jules Horowitz
>     F-91405 ORSAY Cedex                 F-38000 GRENOBLE
>
>    [image: Image and video hosting by TinyPic]
> <http://tinypic.com?ref=28s7yvd>
>



-- 
Tsjerk A. Wassenaar, Ph.D.
------------------------------------------------------------------------------
_______________________________________________
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