Re: [PyMOL] Record and load coordinates

2018-01-10 Thread Thomas Holder
Hi Ben,

The coordinates argument must have a Nx3 shape, that means:
len(coordinates) = number of atoms
len(coordinates[0]) = 3

You can use numpy's reshape() function:

import numpy
coordinates = numpy.asfarray(coordinates).reshape((-1,3))
cmd.load_coords(coordinates, '%prot')

I recommend to prefix the object name with "%" to unambiguously address a named 
object or selection. I mention this because I just ran into a common selection 
language ambiguity problem myself: I named my object "obj01" and then pasted 
your code without changing the object name. The error message was "atom count 
mismatch" instead of "invalid selection name". Why? Because "prot" was 
evaluated as the selection keyword "protected", so it was a valid (but empty) 
selection expression.

Cheers,
  Thomas

> On Jan 11, 2018, at 7:43 AM, Benjamin Bailly  wrote:
> 
> Hi everyone,
> 
> I have been scratching my head quite a bit on this one, I am sure there must 
> be a simple solution but I can't seem to figure it out.
> 
> In short, I would like to record the spacial coordinates of a protein so that 
> when I run my script I can fetch it from the PDB and place it exactly where I 
> would like it to be.
> 
> I used this command to obtain the coordinates, and here is the output I get:
> 
> PyMOL>print cmd.get_coords('prot')
> [[159.402 258.709 204.556]
>  [159.932 259.514 204.223]
>  [158.951 258.206 203.792]
>  ...
>  [117.662 263.108 309.314]
>  [115.591 265.038 307.88 ]
>  [116.386 259.713 306.195]]
> 
> To load the position in my script I know that I should be able to use the 
> following command however I can not figure out the format required:
> 
> cmd.load_coords(coordinates, 'prot')
> 
> I tried to use all the floats the ones after the other like [1.1, 2.2, 
> 3.3,...] and I was close to making it work, but it said the numbers of atoms 
> did not match. I read that I should probably used a numpy array but I am not 
> sure of its format.
> 
> Your help would be much appreciated,
> 
> Many thanks
> 
> Ben

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


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
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

[PyMOL] Record and load coordinates

2018-01-10 Thread Benjamin Bailly
Hi everyone,

I have been scratching my head quite a bit on this one, I am sure there
must be a simple solution but I can't seem to figure it out.

In short, I would like to record the spacial coordinates of a protein so
that when I run my script I can fetch it from the PDB and place it exactly
where I would like it to be.

I used this command to obtain the coordinates, and here is the output I get:

PyMOL>print cmd.get_coords('prot')
[[159.402 258.709 204.556]
 [159.932 259.514 204.223]
 [158.951 258.206 203.792]
 ...
 [117.662 263.108 309.314]
 [115.591 265.038 307.88 ]
 [116.386 259.713 306.195]]

To load the position in my script I know that I should be able to use the
following command however I can not figure out the format required:

cmd.load_coords(coordinates, 'prot')

I tried to use all the floats the ones after the other like [1.1, 2.2,
3.3,...] and I was close to making it work, but it said the numbers of
atoms did not match. I read that I should probably used a numpy array but I
am not sure of its format.

Your help would be much appreciated,

Many thanks

Ben
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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] pymol software

2018-01-10 Thread Jared Sampson
Hi Rex -

Open-Source PyMOL is freely available.  You can find installation instructions 
on the PyMOL Wiki: 

https://pymolwiki.org/index.php/Linux_Install 
https://pymolwiki.org/index.php/MAC_Install 
https://pymolwiki.org/index.php/Windows_Install

Hope that helps,

Cheers,
Jared

On January 10, 2018 at 12:13:26 PM, Rex Palmer (rex.pal...@btinternet.com) 
wrote:

As a retired member of academic staff (Birlbeck College, London) I would like 
to know
if it is possible for me to obtain a free copy of the Pymol software.
This would be of great help in my research on high resolution protein 
structures.
I have recently published a 0.9A X-ray study of Human Recombinant Insulin.
Best wishes 
 
Rex Palmer
http://www.bbk.ac.uk/biology/our-staff/emeritus-staff
http://www.springer.com/978-1-4641-3954-7
--  
Check out the vibrant tech community on one of the world's most  
engaging tech sites, Slashdot.org! 
http://sdm.link/slashdot___  
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--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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

[PyMOL] pymol software

2018-01-10 Thread Rex Palmer
As a retired member of academic staff (Birlbeck College, London) I would like 
to knowif it is possible for me to obtain a free copy of the Pymol 
software.This would be of great help in my research on high resolution protein 
structures.I have recently published a 0.9A X-ray study of Human Recombinant 
Insulin.Best wishes  Rex Palmer
http://www.bbk.ac.uk/biology/our-staff/emeritus-staff
http://www.springer.com/978-1-4641-3954-7--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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