Hello,
I have successfully colored the surface of a PDB by b factors I replaced by
modifying the loadBfacts script. However, my color bar is only showing up as
white instead of accurately showing the blue-white-red color scheme of my PDB
(I've attached a picture). This is my script:
from pymol import cmd, stored, math
def loadBfacts (mol,startaa=1,source="newBfactors.txt"):
"""
Replaces B-factors with a list of values contained in a plain txt file
usage: loadBfacts mol, [startaa, [source, [visual]]]
mol = any object selection (within one single object though)
startaa = number of first amino acid in 'new B-factors' file (default=1)
source = name of the file containing new B-factor values
(default=newBfactors.txt)
example: loadBfacts 1LVM and chain A
"""
obj=cmd.get_object_list(mol)[0]
cmd.alter(mol,"b=-1.0")
inFile = open(source, 'r')
counter=int(startaa)
bfacts=[]
for line in inFile.readlines():
bfact=float(line)
bfacts.append(bfact)
cmd.alter("%s and resi %s"%(mol,counter), "b=%s"%bfact)
counter=counter+1
minval = min(bfacts)
maxval = max(bfacts)
cmd.show_as("surface",mol)
cmd.spectrum("b","blue_white_red", "%s and n. CA"%mol, minimum=minval,
maximum=maxval)
cmd.create("ca_obj", mol + " and n. ca")
cmd.ramp_new("ramp_obj", "ca_obj", range=[minval, maxval],
color="[blue_white_red]")
cmd.set("surface_color", "ramp_obj", mol)
cmd.extend("loadBfacts", loadBfacts);
Any insight into why this is occurring and how to fix it would be greatly
appreciated.
Thank you!
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net