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.

import glob

def load_structure():

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

  for x in glob.glob("/home/andersx/color/1PGB_opls_colorensemble/col_sample_*.pdb"):
    cmd.load(x, "ensemble",discrete=1)

  cmd.load(native_pdb_file, "native")

  cmd.align("ensemble", "native")
  cmd.h_add"sticks", "ensemble")
  cmd.hide("sticks", "ensemble &! n. n+ca+c+o+h")"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")


The final result looks something like this:


1 comment:

  1. Or you can use this :-)