# first, load your protein... # then issue "run example.pym" in PyMOL # load the ".seqsel" file file=open("example.seqsel","r") lines=file.readlines() file.close() # transform the data into a convenient form lines=map(string.strip,lines) lines=map(string.split,lines) lines=map(lambda x:map(int,x),lines) lines=filter(lambda x:x!=[],lines) # define the colors (using 9 digit RGB triplet as the name) for line in lines: cmd.set_color("%03d%03d%03d"%tuple(line[2:5]), [line[2]/255.0,line[3]/255.0,line[4]/255.0]) # now apply the colors to residues with the given ID for line in lines: cmd.color("%03d%03d%03d"%tuple(line[2:5]), "resi %d"%line[0])