I'm new to PyMol (and StackExchange!) and working on my first project. I have the structure of a protein as an object, called PolyA-M, and the idea is that the residues of it are shown as spheres of differing sizes based on a calcualted conservation value. I want to label each sphere with it's amino acid, but to have the label size corresponding to sphere size. Here is a sample of the code that might be used to label one amino acid.
alter ( resid 138 ), resn = "Q135" alter ( name CB and resid 138 ), vdw = vdw * 0.8 * 0.679934640522875 set_color col138, [ 1.0, 0.181, 0.181 ] show spheres, name CB and resi 138 show sticks, ( name CA or name CB ) and resid 138 set label_size, 14, PolyA-M label PolyA-M and name CB and resid 138, "Q" color col138, name CB and resi 138
In this case, residue 138 is medium sized sphere with a size 14 label Q that fits well. However, if later on in the code another residue is labelled as so:
alter ( resid 198 ), resn = "A208" alter ( name CB and resid 198 ), vdw = vdw * 0.8 * 0.359803921568627 set_color col198, [ 1.0, 0.601, 0.601 ] show spheres, name CB and resi 198 show sticks, ( name CA or name CB ) and resid 198 set label_size, 8, PolyA-M label PolyA-M and name CB and resid 198, "A" color col198, name CB and resi 198
This will label residue 198 with a small A to fit the small sphere. However, this will also change the earlier label to size 8 as well, making it too small for the sphere.
Is there any way for me to prevent this, such that each residue keeps its own label size?
I know that one way is to create multiple identical objects and keep all labels of the same size restricted to the same object (For example, PolyA-M_10 contains all residues with label size 10, polyA-M_14 all residues with label size 14) but I was wondeirng if there is a more efficient way?
Thank you for any help! This is my first Stack Exchange question so any feedback would be appreciated :)