Re: [PyMOL] Write map from list of coordinates.

2014-06-12 Thread Gianluca Santoni
Hi everyone,
I was following this instructions to load a nparray as a map, but I get 
the error:
class Brick has no attribute 'from_numpy'

Is it a new feature in chempy, or am I missing something?
Cheers,
Gian


On 2/3/14 3:01 AM, Thomas Holder wrote:
 Hi Esben,

 On 02 Feb 2014, at 12:27, Esben Jannik Bjerrum esbenjan...@rocketmail.com 
 wrote:
 ... I also found a nifty example from brick01.py in the examples directory, 
 but to get it to render in linux, numpy needs to be compiled into PyMOL, 
 does this also hold for Your solution Thomas?

 yes, PyMOL needs to be compiled with numpy for chempy.brick support. 
 Incentive PyMOL ships with numpy support, and open-source PyMOL has numpy 
 support if it can import numpy during compilation.

 Cheers,
Thomas



-- 
Gianluca Santoni,
Dynamop Group
Institut de Biologie Structurale
6 rue Jules Horowitz
38027 Grenoble Cedex 1  
France  
_
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
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


Re: [PyMOL] Write map from list of coordinates.

2014-06-12 Thread Thomas Holder
Hi Gian,

yes, the from_numpy method is new in PyMOL 1.7. But the underlying import 
functionality is not new, so you could basically copy the code from that method 
and create a valid brick instance yourself. Have a look at:

https://sourceforge.net/p/pymol/code/HEAD/tree/trunk/pymol/modules/chempy/brick.py#l28

Cheers,
 Thomas

On 12 Jun 2014, at 16:40, Gianluca Santoni gianluca.sant...@ibs.fr wrote:

 Hi everyone,
 I was following this instructions to load a nparray as a map, but I get 
 the error:
 class Brick has no attribute 'from_numpy'
 
 Is it a new feature in chempy, or am I missing something?
 Cheers,
 Gian
 
 On 2/3/14 3:01 AM, Thomas Holder wrote:
 Hi Esben,
 
 On 02 Feb 2014, at 12:27, Esben Jannik Bjerrum esbenjan...@rocketmail.com 
 wrote:
 ... I also found a nifty example from brick01.py in the examples directory, 
 but to get it to render in linux, numpy needs to be compiled into PyMOL, 
 does this also hold for Your solution Thomas?
 
 yes, PyMOL needs to be compiled with numpy for chempy.brick support. 
 Incentive PyMOL ships with numpy support, and open-source PyMOL has numpy 
 support if it can import numpy during compilation.
 
 Cheers,
   Thomas
 
 -- 
 Gianluca Santoni,
 Dynamop Group
 Institut de Biologie Structurale
 6 rue Jules Horowitz  
 38027 Grenoble Cedex 1
 France

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


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
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


Re: [PyMOL] Write map from list of coordinates.

2014-02-02 Thread Esben Jannik Bjerrum
Hi Jason and Thomas,
  Thx for you suggestions, Maps are definitely the way to go, and I already 
have the data it in a numpy array. I also found a nifty example from brick01.py 
in the examples directory, but to get it to render in linux, numpy needs to be 
compiled into PyMOL, does this also hold for Your solution Thomas? Loading 
directly from Python is the way to go in the future.

In the meantime I solved my problem by writing a small script that dumps the 
data in dx file format, which can subsequently be loaded into PyMOL.

#!/usr/bin/python
# Esben Jannik Bjerrum 2014
#Write DX format
import math

nx,ny,nz = 100,100,100 # Number of grid point in X,y,z dim
xmin,ymin,zmin = 0,0,0 # coordinate of grid lowest corner.
hx = hy = hz = 0.2 #Spacing between grid points

f = open(tester.dx,w)
f.write(#Comment\n)
f.write(object 1 class gridpositions counts %s %s %s\n% (nx,ny,nz))
f.write(origin %s %s %s\n% (xmin,ymin,zmin))
f.write(delta %s 0.0 0.0\ndelta 0.0 %s 0.0\ndelta 0.0 0.0 %s\n%(hx,hy,hz))
f.write(object 2 class gridconnections counts %s %s %s\n%(nx,ny,nz))
f.write(object 3 class array type double rank 0 times %s\n%(nx*ny*nz))
#The data with Z increasing first, then Y, then X.
i = 0 
for x in range(nx):
    for y in range(ny):
        for z in range(nz):
            #Generation of sample data
            mx=1.5*(x-nx/2.)
            my=2*(y-nx/2.)
            mz=3*(z-nz/2.)
            #Write values of point number (x,y,z)
            f.write(%e %(1.-2./math.exp(math.sqrt(mx*mx+my*my+mz*mz)/10.0)))
            #f.write((%s,%s,%s)%(x,y,z))
            if i == 2:
                f.write(\n)
                i = 0
            else: i += 1
f.write(\n)
f.close()

Best Regards
Esben





On Thursday, January 30, 2014 11:45 PM, Thomas Holder 
thomas.hol...@schrodinger.com wrote:
 
Hi Esben,

I just pushed a change to the open-source SVN repo which makes loading maps 
with a script a little easier. If you have your map in a numpy array, you can 
do:

yourdata = ... # array with shape (a,b,c)
yourgridspacing = (0.2, 0.2, 0.2) # grid spacing

from chempy.brick import Brick
b = Brick.from_numpy(yourdata, yourgridspacing)
cmd.load_brick(b, 'yourmap')

Hope that helps.

Cheers,
  Thomas

On 30 Jan 2014, at 16:24, Jason Vertrees jason.vertr...@schrodinger.com wrote:

 Hi Esben,
 
 I have a list of coordinates on a regular grid with associated floating point 
 values from a calculation that I want to visualise in PyMOL. Is it nescessary 
 to write this to an Xplor/CNS/CCP4 file format and subsequently load it, or 
 can it be loaded directly into a map object via some fancy python code?
 
 It depends on how you want to visualize the data. If dots/points or other 
 discrete representations are okay then you can use a XYZ or a modified 
 structure file. If you want the benefit of a field (volume, gradient, 
 isosurface) then I suggest the map.
 
 If you already have the data in a well-formatted brick, check out the asCCP4 
 function in http://www.pymolwiki.org/index.php/Tiff2ccp4. That writes the 
 CCP4 header and data (of a TIFF file, but you can modify that for your 
 needs). 
 
 If you want, send me a copy of your data. Or, I also have a very poorly 
 written script that will convert raw volumes of data to CCP4 maps, similar to 
 the aforementioned script. Email me personally and I can send you a copy if 
 you prefer (but it's really ugly code).
 
 Cheers,
 
 -- Jason
 
 
 On Wed, Jan 29, 2014 at 8:02 AM, Esben Jannik Bjerrum 
 esbenjan...@rocketmail.com wrote:
 
  Hi All-knowing Pymol'ers.
 
  I wonder if anyone had a couple of tips/ pointers / script snippets.
 
  I have a list of coordinates on a regular grid with associated floating 
  point values from a calculation that I want to visualise in PyMOL. Is it 
  nescessary to write this to an Xplor/CNS/CCP4 file format and subsequently 
  load it, or can it be loaded directly into a map object via some fancy 
  python code?
 
  Best Regards
  Esben Jannik Bjerrum


-- 
Thomas Holder
PyMOL Developer

Schrödinger, Inc.--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk___
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

Re: [PyMOL] Write map from list of coordinates.

2014-02-02 Thread Thomas Holder
Hi Esben,

On 02 Feb 2014, at 12:27, Esben Jannik Bjerrum esbenjan...@rocketmail.com 
wrote:
 ... I also found a nifty example from brick01.py in the examples directory, 
 but to get it to render in linux, numpy needs to be compiled into PyMOL, does 
 this also hold for Your solution Thomas?

yes, PyMOL needs to be compiled with numpy for chempy.brick support. Incentive 
PyMOL ships with numpy support, and open-source PyMOL has numpy support if it 
can import numpy during compilation.

Cheers,
  Thomas

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


--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk
___
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


Re: [PyMOL] Write map from list of coordinates.

2014-01-30 Thread Jason Vertrees
Hi Esben,

I have a list of coordinates on a regular grid with associated floating
 point values from a calculation that I want to visualise in PyMOL. Is it
 nescessary to write this to an Xplor/CNS/CCP4 file format and subsequently
 load it, or can it be loaded directly into a map object via some fancy
 python code?


It depends on how you want to visualize the data. If dots/points or other
discrete representations are okay then you can use a XYZ or a modified
structure file. If you want the benefit of a field (volume, gradient,
isosurface) then I suggest the map.

If you already have the data in a well-formatted brick, check out the
asCCP4 function in http://www.pymolwiki.org/index.php/Tiff2ccp4. That
writes the CCP4 header and data (of a TIFF file, but you can modify that
for your needs).

If you want, send me a copy of your data. Or, I also have a very poorly
written script that will convert raw volumes of data to CCP4 maps, similar
to the aforementioned script. Email me personally and I can send you a copy
if you prefer (but it's really ugly code).

Cheers,

-- Jason


On Wed, Jan 29, 2014 at 8:02 AM, Esben Jannik Bjerrum 
esbenjan...@rocketmail.com wrote:

 Hi All-knowing Pymol'ers.

 I wonder if anyone had a couple of tips/ pointers / script snippets.

 I have a list of coordinates on a regular grid with associated floating
point values from a calculation that I want to visualise in PyMOL. Is it
nescessary to write this to an Xplor/CNS/CCP4 file format and subsequently
load it, or can it be loaded directly into a map object via some fancy
python code?

 Best Regards
 Esben Jannik Bjerrum


--
 WatchGuard Dimension instantly turns raw network data into actionable
 security intelligence. It gives you real-time visual feedback on key
 security issues and trends.  Skip the complicated setup - simply import
 a virtual appliance and go from zero to informed in seconds.

http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk
 ___
 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




-- 
Jason Vertrees, PhD
Director of Core Modeling Products
Schrödinger, Inc.

(e) jason.vertr...@schrodinger.com
(o) +1 (603) 374-7120
--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk___
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

Re: [PyMOL] Write map from list of coordinates.

2014-01-30 Thread Thomas Holder
Hi Esben,

I just pushed a change to the open-source SVN repo which makes loading maps 
with a script a little easier. If you have your map in a numpy array, you can 
do:

yourdata = ... # array with shape (a,b,c)
yourgridspacing = (0.2, 0.2, 0.2) # grid spacing

from chempy.brick import Brick
b = Brick.from_numpy(yourdata, yourgridspacing)
cmd.load_brick(b, 'yourmap')

Hope that helps.

Cheers,
  Thomas

On 30 Jan 2014, at 16:24, Jason Vertrees jason.vertr...@schrodinger.com wrote:

 Hi Esben,
 
 I have a list of coordinates on a regular grid with associated floating point 
 values from a calculation that I want to visualise in PyMOL. Is it nescessary 
 to write this to an Xplor/CNS/CCP4 file format and subsequently load it, or 
 can it be loaded directly into a map object via some fancy python code?
 
 It depends on how you want to visualize the data. If dots/points or other 
 discrete representations are okay then you can use a XYZ or a modified 
 structure file. If you want the benefit of a field (volume, gradient, 
 isosurface) then I suggest the map.
 
 If you already have the data in a well-formatted brick, check out the asCCP4 
 function in http://www.pymolwiki.org/index.php/Tiff2ccp4. That writes the 
 CCP4 header and data (of a TIFF file, but you can modify that for your 
 needs). 
 
 If you want, send me a copy of your data. Or, I also have a very poorly 
 written script that will convert raw volumes of data to CCP4 maps, similar to 
 the aforementioned script. Email me personally and I can send you a copy if 
 you prefer (but it's really ugly code).
 
 Cheers,
 
 -- Jason
 
 
 On Wed, Jan 29, 2014 at 8:02 AM, Esben Jannik Bjerrum 
 esbenjan...@rocketmail.com wrote:
 
  Hi All-knowing Pymol'ers.
 
  I wonder if anyone had a couple of tips/ pointers / script snippets.
 
  I have a list of coordinates on a regular grid with associated floating 
  point values from a calculation that I want to visualise in PyMOL. Is it 
  nescessary to write this to an Xplor/CNS/CCP4 file format and subsequently 
  load it, or can it be loaded directly into a map object via some fancy 
  python code?
 
  Best Regards
  Esben Jannik Bjerrum


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


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991iu=/4140/ostg.clktrk
___
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