[Chimera-users] Assigning pre-calculated attribute to B-factor column of pdb

Eric Pettersen pett at cgl.ucsf.edu
Tue Aug 26 11:39:34 PDT 2014


As Elaine says, there is no command equivalent.  However, a tiny Python script will do it:

from chimera import openModels, Molecule
for m in openModels.list(modelTypes=[Molecule]):
	for a in m.atoms:
		a.bfactor = a.residue.ramaProb

If you put the above in a file ending in '.py', you can open it in Chimera with the "open" command to run it and therefore can just put that open command in your script/alias.  Indentation is important in Python, so preserve the indentation when you create the .py file.

--Eric

On Aug 26, 2014, at 11:33 AM, Elaine Meng <meng at cgl.ucsf.edu> wrote:

> There isn't a Chimera command implementation of Attribute Calculator, sorry! 
> 
> Elaine
> 
> On Aug 26, 2014, at 11:28 AM, Oliver Clarke <olibclarke at gmail.com> wrote:
> 
>> That works well, thanks Eric. Is there any way to reassign the ramaProbs to the bfactor column on the command line, without using the attribute calculator? That way I can set the whole sequence of commands as an alias.
>> 
>> Cheers,
>> Oliver.
>> On Aug 26, 2014, at 1:45 PM, Eric Pettersen <pett at cgl.ucsf.edu> wrote:
>> 
>>> On Aug 26, 2014, at 10:27 AM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
>>> 
>>>> Hi Oliver,
>>>> The more direct way I tried used Attribute Calculator (in menu under Tools.. Structure Analysis) to calculate attribute "bfactor" for "atoms" using the formula:
>>>> 
>>>> residue.ramaProb
>>>> 
>>>> (after assignment using Ramachandran).  It currently generates an error, which seems buglike.  I could create a new atom attribute with that formula, but not overwrite "bfactor". We'll look into that .
>>> 
>>> The problem here is that bfactors must be numeric, but some residues have a ramaProb of "None" (e.g. they are terminal residues or non-peptides and lack either a phi or a psi).  You can assign such residues a ramaProb of -1.0 with this command:
>>> 
>>> setattr r ramaProb -1.0 :/^ramaProb
>>> 
>>> You could then use the Attribute Calculator to assign the ramaProbs to the bfactors.
>>> 
>>> --Eric
>>> 
>>>                        Eric Pettersen
>>>                        UCSF Computer Graphics Lab
>>>                        http://www.cgl.ucsf.edu
>>> 
>>> 
>> 
>> _______________________________________________
>> Chimera-users mailing list
>> Chimera-users at cgl.ucsf.edu
>> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users




More information about the Chimera-users mailing list