Total number of atoms in all submodels

Dear Chimera users, When I fetch a biological unit into Chimera from PDB, the symmetry related units are placed into separate submodels. I would like to find the total number of atoms in all submodels that make up the biological unit within a python script. Constructs (and variations that I've tried) such as the following only give the number of atoms in each sub model: numAtoms = len(openModels.list(modelTypes=[Molecule])[0].atoms) Is there some way to get the grand total of atoms? Alternatively, if the script could find the total number (or list) of the submodels, I could probably still handle it. My example is the virus capsid 1ej6. Thanks for any suggestions. -- Phillip Cruz, Ph.D. Contractor, Medical Science & Computing Computational Structural Biologist Computational Biology Section Bioinformatics and Computational Biosciences Branch (BCBB) OCICB/OSMO/OD/NIAID/NIH 31 Center Dr., Room 3B62 Bethesda, MD 20892-0485 Office: 301-451-1089 http://bioinformatics.niaid.nih.gov<http://bioinformatics.niaid.nih.gov/> (Within NIH) http://exon.niaid.nih.gov<http://exon.niaid.nih.gov/> (Public) Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.

On Mar 19, 2015, at 1:16 PM, "Cruz, Phil (NIH/NIAID) [C]" <phil.cruz@nih.gov> wrote:
numAtoms = len(openModels.list(modelTypes=[Molecule])[0].atoms)
Because of the "[0]" subscript in the above, you are only getting the first Molecule model in the list. Try this: numAtoms = sum([len(m.atoms) for m in openModels.list(modelTypes=[Molecule])]) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

Eric, Thanks, that works perfectly. Phil -- Phillip Cruz, Ph.D. Contractor, Medical Science & Computing Computational Structural Biologist Computational Biology Section Bioinformatics and Computational Biosciences Branch (BCBB) OCICB/OSMO/OD/NIAID/NIH 31 Center Dr., Room 3B62 Bethesda, MD 20892-0485 Office: 301-451-1089 http://bioinformatics.niaid.nih.gov<http://bioinformatics.niaid.nih.gov/> (Within NIH) http://exon.niaid.nih.gov<http://exon.niaid.nih.gov/> (Public) Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives. From: Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> Reply-To: "chimera-users@cgl.ucsf.edu<mailto:chimera-users@cgl.ucsf.edu> Mailing List" <chimera-users@cgl.ucsf.edu<mailto:chimera-users@cgl.ucsf.edu>> Date: Thursday, March 19, 2015 4:23 PM To: "Cruz, Phil (NIH/NIAID) [C]" <phil.cruz@nih.gov<mailto:phil.cruz@nih.gov>> Cc: "chimera-users@cgl.ucsf.edu<mailto:chimera-users@cgl.ucsf.edu> Mailing List" <chimera-users@cgl.ucsf.edu<mailto:chimera-users@cgl.ucsf.edu>> Subject: Re: [Chimera-users] Total number of atoms in all submodels On Mar 19, 2015, at 1:16 PM, "Cruz, Phil (NIH/NIAID) [C]" <phil.cruz@nih.gov<mailto:phil.cruz@nih.gov>> wrote: numAtoms = len(openModels.list(modelTypes=[Molecule])[0].atoms) Because of the "[0]" subscript in the above, you are only getting the first Molecule model in the list. Try this: numAtoms = sum([len(m.atoms) for m in openModels.list(modelTypes=[Molecule])]) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (2)
-
Cruz, Phil (NIH/NIAID) [C]
-
Eric Pettersen