## Monday, June 4, 2012

### Coloring residues by chemical shift errors

I wrote a quick script to replace the b-factor column in my .pdb files with the error in C-alpha chemical shifts (between experimental values and CamShift prediction of that same structure). This was the easy part.
At first PyMol would color the ensemble snapshots with the b-factor values of the first structure. The trick was to load the ensemble object with discrete=1, which loads an individual set b-factors for each structure. The last thing to be adjusted are the minimum and maximum values for spectrum-coloring.

reinitialize
import glob

native_pdb_file = "/home/andersx/color/1PGB.pdb"

for x in glob.glob("/home/andersx/color/1PGB_opls_colorensemble/col_sample_*.pdb"):

cmd.align("ensemble", "native")
cmd.hide("all")
cmd.center("all")

cmd.show("sticks", "ensemble")
cmd.hide("sticks", "ensemble &! n. n+ca+c+o+h")

cmd.show("lines", "native")
cmd.hide("lines", "native &! n. n+ca+c+o+h02")

cmd.spectrum( "b", "blue_red", minimum=0, maximum=8)

cmd.color("grey", "native")

cmd.bg_color("white")