[chimera-dev] Coloring chains from Python

Eric Pettersen pett at cgl.ucsf.edu
Mon Feb 3 11:19:17 PST 2020


Hi Jan,
	As far as I know, there is no way to use those special characters as chain IDs — there is no #1:12.’@‘.  I don’t know if this helps or not, but Chimera reads columns 73-76 as a “segment ID” and assigns that as an atom attribute (really should probably be a residue attribute).  Anyway, if you have values in those columns, the atom spec for segment ID “xyzw” would be:  @/pdbSegment=xyzw.

—Eric

> On Jan 31, 2020, at 3:16 PM, jan.kosinski at embl.de wrote:
> 
> Hi Eric,
> 
> OK, this way I know if course, I've just thought I'm missing a way that doesn't require iteraitng through the atoms. 
> 
> For the 'color' command or stom spec, is there a universal way of escaping any  special characters as chain ids such as , (comma) , @, =, : etc? Double quote works only for some of them. Yes, we trying to get a PDB file with 80sth chains working in the Xlink Analyzer 😉
> 
> Best, 
> Jan
> 
> On Jan 31, 2020 10:16 PM, Eric Pettersen <pett at cgl.ucsf.edu> wrote:
> 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:
> 	if a.residue.id <http://a.residue.id/>.chainId == ‘A’:
> 		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
> 
> On Jan 31, 2020, at 5:54 AM, Jan Kosinski <jan.kosinski at embl.de <mailto:jan.kosinski at 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 at cgl.ucsf.edu <mailto:Chimera-dev at cgl.ucsf.edu>
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
> 
> 
> 
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20200203/40ea4407/attachment-0001.html>


More information about the Chimera-dev mailing list