Please try:

load $TUT/1hpv.pdb

extract chA, chain A

extract chB, chain B

# assign some B values onto chA

from random import random

alter chA////CA, b=random()

# show for later comparison...

iterate chA///1-10/CA, chain,resi,b

# generate an alignment

align chA////CA, chB////CA, object=aln

# 'refresh' forces 'aln' to become available as a selection
# before the next command...


# now we use a Python list, iterate, and alter to copy the
# b factors using the alignment object 'aln'

stored.b = []

iterate chA and aln, stored.b.append(b)


alter chB and aln, b = stored.b.pop()

# confirm transfer

iterate chB///1-10/CA, chain,resi,b


From: Donnie Berkholz []
Sent: Sun 7/12/2009 1:15 PM
To: Jason Vertrees
Subject: Re: [PyMOL] Comparing B-factors of aligned residues

On 10:11 Sun 12 Jul     , Jason Vertrees wrote:
> Donnie Berkholz wrote:
> > I'm trying to compare the B-factors in two homologous proteins I
> > aligned using 'super'. I can create an alignment object mapping
> > residue pairs together, so I think what I want to do should be
> > possible. I'd like to somehow use that to map the *difference*
> > between the two CA B's onto one of the structures, then color it by
> > B-factor and color unaligned residues gray.
> >
> > I can't even figure out how to get at the alignment object or what's
> > in it, much less how to do this. Could anyone help me?
> Donnie, you can find something similar in the interfaceResidues script
> on the PyMOLWiki:
> It shows you how to load something into the B-factors and calculate the
> difference using the q field.  Don't forget you can do
>    super protein1, protein2, object=foo
> and foo will be the alignment differences shown as CGO.  If you could
> extract the values of the lengths of those CGO lines you'd be done.

Yeah, that's a nice use of the occupancy field. The problem is that I
can't even figure out which subtractions to do without some way to
access the residue mapping between the two nonidentical sequences that I
know is calculated during alignment. In my original email, I mentioned
that I'd discovered how to create that alignment object, I just can't
figure out how to iterate over the residue numbers it's connecting.

I might have to do something annoying like threading one of the
sequences onto the other structure so I can hack around this
residue-mapping problem.


Donnie Berkholz
P. Andrew Karplus lab
Oregon State University

Enter the BlackBerry Developer Challenge 
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at:
PyMOL-users mailing list (
Info Page: