Hi Thomas,

Thanks for your reply.

So if I am correct, for my protein get_coords fetches a very large matrix
of thousands and thousands of rows. This could prove very impractical if I
want to stores those coordinates in a script.

To circumvent this issue I tried the following but it did not seem to work:

print cmd.get_object_matrix('%prot')   # to obtain my coordinates in a 4X4
format

PyMOL>cmd.transform_selection("su", [[1.0,0.0,0.0,0.0], [0.0,1.0,0.0,0.0],
[0.0,0.0,1.0,0.0], [0.0,0.0,0.0,1.0]], homogenous=1)
CmdTransformSelection-DEBUG: bad matrix

PyMOL>cmd.transform_selection("su", [1.0,0.0,0.0,0.0,0.0,1.0,0.0,
0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0], homogenous=1)  # In that case nothing
happens

What do you think I am doing wrong?

Many thanks,

Ben

--

Dr Benjamin Bailly | Research Scientist – von Itzstein group

Institute for Glycomics
Griffith University | Gold Coast campus | QLD 4222 | Institute for
Glycomics (G26) Room 4.30



_______________________

*Benjamin Bailly*
+61 479 17 66 34 (Australia)

On 11 January 2018 at 17:26, Thomas Holder <thomas.hol...@schrodinger.com>
wrote:

> 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 <bbai...@gmail.com> 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

Reply via email to