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

Elaine Meng meng at cgl.ucsf.edu
Tue Aug 26 09:58:15 PDT 2014

Hi Oliver,
In general, you wouldn't need to overwrite B-factor in Chimera.  You can easily define a custom attribute, that is, assign any set of values that you like to atoms or residues.  Your custom attribute can be rendered (color, worm fatness), used as a selection criterion, etc. just like other existing attributes. However, I see you want it as B-factor for use in Coot… more on that below…

If you want to zero out the bfactor values for solvent, ligands, ions (that will not have Ramachandran values to overwrite them), might as well zero out everything first, such as with the command:  setattr a bfactor 0 @*

If you were going to create some arbitrary custom attribute, this is done by making an "attribute defintion file" and reading it in with Define Attribute (in menu under Tools… Structure Analysis) or the command "defattr."  The file is a simple text format, and there are examples:

The file could indicate attribute name "bfactor" to overwrite the existing values, as mentioned in this previous post:

Actually, the Ramachandran tool already creates an attribute.  If you choose the "Ramachandran plot…" function on the right side of the Model Panel, then get a plot, there is an "Assign Residue Probabilities" button that creates a residue attribute named "ramaProb".  Or, you can use the "ramachandran" command with the "assign" keyword to do the same thing. 

You can write out the ramaProb values in the needed format, then manually edit the top two lines of the file to change the name to "bfactor" and the recipient level to "atoms" and read it back in with Define Attribute or command "defattr".  To write out the values, open Render by Attribute (in menu under Tools… Structure Analysis) and then in that tool's menu, choose "File… Save Attributes" to save the attribute of "residues" named "ramaProb".

(First I tried reassignment using the Attribute Calculator tool instead of writing/reading a file, but currently Chimera doesn't allow overwriting "bfactor" by that more direct route.)

THEN, you can write a PDB file with the altered bfactor values.

I hope this helps,
Elaine C. Meng, Ph.D. 
UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab
Department of Pharmaceutical Chemistry
University of California, San Francisco

On Aug 26, 2014, at 8:52 AM, Oliver Clarke <olibclarke at gmail.com> wrote:

> Hi all,
> Is there an easy way to assign a pre-calculated attribute (for example, ramachandran probability) to the b-factor (or occupancy) column of a pdb file using chimera? 
> I’d like to do this so I can color a pdb by ramachandran probability (or other custom attributes, e.g map-model correlation) and use it as a guide while rebuilding in Coot (which has options for coloring by b-factor or occupancy, but no other capacity for custom coloring of molecules).
> Best,
> Oliver.

More information about the Chimera-users mailing list