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 IDfor a in m.atoms:if a.residue.id.chainId == ‘A’:a.color = colorAll polymer atoms in that chainseq = m.sequence(‘A’)for r in seq.residues:if r:for a in r.atoms:a.color = colorChimera 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 PettersenUCSF Computer Graphics LabOn Jan 31, 2020, at 5:54 AM, Jan Kosinski <jan.kosinski@embl.de> wrote: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.edu
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev