Hi Jan! Depending on whether you want to color all atoms with a particular chain ID, or atoms in the peptide/nucleic acid chain with that ID but not waters, etc. there are two routes:
In the code below I am going to assume you have your color in a variable named color, and the model in a variable named m and that you are coloring chain A.
All atoms with that chain ID
for a in m.atoms:
a.color = color
All polymer atoms in that chain
seq = m.sequence(‘A’)
for r in seq.residues:
if r:
for a in r.atoms:
a.color = color
Chimera just doesn’t have the data structures to do this efficiently that ChimeraX has. If the chain is being depicted as ribbon, you would actually set the residue’s color rather than the atom colors.
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
Hi,
In the “old” Chimera, is there an efficient way of coloring an entire chain with a single defined color from the Python interface without resorting to runCommand(‘color …') and atom_spec ? The runCommand(‘color …atom_spec ’) makes some issues when special characters are used as chain ids in the atom_spec. I guess I could loop through all atoms of chain but that might be slow for big structures.
Best,
Jan
_______________________________________________
Chimera-dev mailing list
Chimera-dev@cgl.ucsf.eduhttp://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev