Usually, people have to draw the protein structure according to folding, titration or relaxation experiments; especially for NMR people. PyMOL supports this function by using less “used” b-factor column of the PDB file. Robert Campbell has a color_b.py python script on his PyMOL homepage that you can use.
However, I am showing another way to color the structure without using any scripts. I found it from PyMOLWIKI (http://www.pymolwiki.org/index.php/Color#Reassigning_B-Factors_and_Coloring)
The steps are copied to this blog and the example I made is also showing here. I use 1XQ8.pdb to show it’s hydrophobicity (by Kyte-Doolittle’s method).

The updated B-factors can be saved by saving a new molecule. The hydrophobicities were saved for CA b-factors, here is the example: cat 1XQ8.pdb |grep CA ATOM 2 CA MET A 1 250.631 34.877 0.809 1.00 0.67 C ATOM 21 CA ASP A 2 246.860 35.394 1.143 1.00 0.02 C ATOM 33 CA VAL A 3 246.085 36.822 -2.313 1.00 0.61 C ATOM 49 CA PHE A 4 243.374 38.718 -0.399 1.00 -0.29 C ATOM 69 CA MET A 5 245.745 40.728 1.827 1.00 -0.99 C ATOM 86 CA LYS A 6 247.572 41.993 -1.282 1.00 -1.24 C ATOM 108 CA GLY A 7 244.331 43.152 -2.944 1.00 -0.34 C ATOM 115 CA LEU A 8 243.551 44.864 0.384 1.00 0.17 C ATOM 134 CA SER A 9 246.922 46.620 0.797 1.00 -0.06 C ATOM 145 CA LYS A 10 246.614 47.601 -2.883 1.00 0.23 C ATOM 167 CA ALA A 11 243.302 49.441 -2.385 1.00 0.87 C ATOM 177 CA LYS A 12 244.578 51.340 0.678 1.00 0.28 C
----------------------------
# load the protein cmd.load("protA.pdb") # open the file of new values (just 1 column of numbers, one for each alpha carbon) inFile = open("newBFactors", 'r') # create the global, stored array stored.newB = [] # read the new B factors from file for line in inFile.readlines(): stored.newB.append( float(line) ) # close the input file inFile.close() # clear out the old B Factors alter protA, b=0.0 # update the B Factors with new properties alter protA and n. CA, b=stored.newB.pop(0) # color the protein based on the new B Factors of the alpha carbons cmd.spectrum("b", "protA and n. CA")
