Hi Cedric,
The first part is numeric inaccuracy. You get all atomic rmsds in the range
of 0 - 1e-12 or so. Spectrum colors according to the extent of this range.
For the other one, note that the RMSD (mean sum of MSDs) is pretty low.
Usually, it's due to a few residues that don't align perfectly, giving a
pretty skewed RMSD distribution. Make sure to show lines or sticks for all
atoms that were used in the alignment. Especially when doing the alignment
on the whole protein and showing only the cartoon, you'll certainly miss
the atoms contributing most to the total RMSD.
Cheers,
Tsjerk
On Mon, Oct 6, 2014 at 10:01 PM, Cedric patrick.coss...@inbox.com wrote:
Hi Tsjerk,
Thank you-gorgeous idea.
I have a quick question, I took a pdb, made a copy of it and called it
1.pdb.
Loaded 3CCD.pdb + 1.pdb (which are identical of course).
Called your command, the structure appeared in all the colors of the
rainbow.
Now I load another structure with an overall RMSD of 0.4A to 3CCD, now
when I call your aommand its only blue.
Could you explain more? Also I didn't see the atomic rmsd being written to
the file.
I will admit my knowledge is very limited so I might be doing something
wrong.
Thank you
-Original Message-
*From:* tsje...@gmail.com
*Sent:* Mon, 6 Oct 2014 20:53:41 +0200
*To:* pymol-users@lists.sourceforge.net
*Subject:* [PyMOL] Color according to RMSD
Hey :)
In response to an earlier question regarding coloring objects according to
per residue RMSD, I wrote a small routine to color according to atom RMSD,
after an alignment. Maybe it'll be of any use to someone...
The script performs an alignment and then gets the corresponding atoms,
for which the RMSDs are calculated. These are written to the b-factor
fields of the atoms in both objects and the structures are colored.
Any improvements are welcomed.
Enjoy,
Tsjerk
###
import numpy
from pymol import cmd
def rmsd2b(selection1, selection2, cycles=5, scheme=rainbow):
Align structures and write pairwise RMSDs to b-factor fields
Author: Tsjerk A. Wassenaar
cmd.align(selection1,selection2,cycles=int(cycles))
# I would like to have a better way for this...
# Find the element in the session list that corresponds to the object
_align1
# which is an object generated by cmd.align (likewise for _align2)
# The list contains a number of things. The fifth element is the list
of
# IDs of atoms that are aligned to those in the other structure.
aln1 = [i for i in cmd.get_session()[names] if i and i[0] ==
_align1][0][5][0][1]
aln2 = [i for i in cmd.get_session()[names] if i and i[0] ==
_align2][0][5][0][1]
m1 = numpy.array(cmd.get_model(selection1).get_coord_list())
m2 = numpy.array(cmd.get_model(selection2).get_coord_list())
# RMSD per atom in the alignment
d = numpy.sqrt( ((m1[aln1,:]-m2[aln2,:])**2).sum(axis=1) )
b1 = numpy.zeros(m1.shape[0])
b2 = numpy.zeros(m2.shape[0])
b1[aln1] = d
b2[aln2] = d
b1 = b1.tolist()
b2 = b2.tolist()
cmd.alter(selection1,b=b1.pop(0),space=locals())
cmd.alter(selection2,b=b2.pop(0),space=locals())
cmd.spectrum(b,scheme, (%s) or (%s)%(selection1, selection2))
cmd.extend(rmsd2b,rmsd2b)
--
Tsjerk A. Wassenaar, Ph.D.
--
Free Online Photosharing - Share your photos online with your friends
and family!
Visit http://www.inbox.com/photosharing to find out more!
--
Tsjerk A. Wassenaar, Ph.D.
--
Slashdot TV. Videos for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/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