[chimerax-users] Accessing Chain IDs

Eric Pettersen pett at cgl.ucsf.edu
Tue Jun 29 13:34:05 PDT 2021


Hi Diana,
	Tristan's answer is 100% accurate.  Just wanted to apologize for how hard it is to find, but it is in there.  The documentation for the Chain class is linked to from Python Classes — ChimeraX 1.3 documentation <https://www.cgl.ucsf.edu/chimerax/docs/devel/classes.html>.  Unfortunately almost all the useful attributes are in Chain's StructureSeq base class, so you have to follow the link to the base class to see them.
	Another trick is that if you're in the Python shell (Tools→General→Shell) and you have an instance of something and you want to know its attributes/methods then dir(something) will list those.

--Eric

	Eric Pettersen
	UCSF Computer Graphics Lab


> On Jun 29, 2021, at 11:59 AM, Tristan Croll via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> Hi Diana,
> 
> If m​ is your model, then the list of polymeric chain IDs is m.chains.chain_ids​. If you want all​ chain IDs including those containing only ligands/water, try m.residues.unique_chain_ids​.
> 
> Best regards,
> Tristan
> From: ChimeraX-users <chimerax-users-bounces at cgl.ucsf.edu> on behalf of Diana Lee via ChimeraX-users <chimerax-users at cgl.ucsf.edu>
> Sent: 29 June 2021 19:44
> To: chimerax-users at cgl.ucsf.edu <chimerax-users at cgl.ucsf.edu>
> Subject: [chimerax-users] Accessing Chain IDs
>  
> 
> 
> Hi team! I have what I hope is an easy question. I'm accessing ChimeraX commands via python script, and I need a list of the Chain IDs. I'm currently getting the number of chains using the num_chains property. I've done quite a bit of digging through documentation and can only find ways to rename, or view interfaces, but I can't seem to find any specific command to list them. I feel as though it must be so basic, no one has needed to ask. :)
> 
> 
> 
> 
> Thanks for your help, 
> Diana Lee
> 
> Graduate Student
> Luque Lab, SDSU VII
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210629/a233a35e/attachment.html>


More information about the ChimeraX-users mailing list