Obtaining the path to a currently loaded model or volume

Hi, I am trying to write an extension for a tool that requires PDB files or MRC structures as input. I would like to be able to pass the model or volume that is currently loaded in Chimera to this separate executable, but for this I need to get the file path to the model's object. Is this possible to do from the Python API? Thanks in advance, Ricardo Avila

Hi Ricardo, Every opened model in Chimera has an ‘openedAs’ attribute which is either None or a 4-tuple. For models that were directly opened from a single file on the file system (rather than fetched to a file for instance), openedAs will be a tuple whose first component is the full path to that file. If you need more that that (e.g. fetched files too, which is more complicated), let me know and I can provide those details. —Eric Eric Pettersen UCSF Computer Graphics Lab
On Apr 10, 2019, at 12:49 PM, Ricardo Avila <ravila@protonmail.com> wrote:
Hi,
I am trying to write an extension for a tool that requires PDB files or MRC structures as input. I would like to be able to pass the model or volume that is currently loaded in Chimera to this separate executable, but for this I need to get the file path to the model's object. Is this possible to do from the Python API?
Thanks in advance,
Ricardo Avila _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thank you Eric. I was able to implement the feature I wanted for PDBs opened from a single file. I think it would be nice to be able to do it for fetched files too, so I would appreciate some help on that. I was also wondering if opened volumes have the same 'openedAs' attribute. Best, Ricardo ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, April 11, 2019 2:49 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Ricardo, Every opened model in Chimera has an ‘openedAs’ attribute which is either None or a 4-tuple. For models that were directly opened from a single file on the file system (rather than fetched to a file for instance), openedAs will be a tuple whose first component is the full path to that file. If you need more that that (e.g. fetched files too, which is more complicated), let me know and I can provide those details.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Apr 10, 2019, at 12:49 PM, Ricardo Avila <ravila@protonmail.com> wrote:
Hi,
I am trying to write an extension for a tool that requires PDB files or MRC structures as input. I would like to be able to pass the model or volume that is currently loaded in Chimera to this separate executable, but for this I need to get the file path to the model's object. Is this possible to do from the Python API?
Thanks in advance,
Ricardo Avila _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Hi Ricardo, Volume models also have an ‘openedAs’ attribute. For PDB files, if the first component of the openedAs attribute isn’t an existing file, and it’s exactly 4 characters long and the second component of the tuple is ‘PDB’, then it’s probably a fetched PDB file. For that case, use this code to try to get the path: from chimera.fetch import FETCH_PREFERENCES, FETCH_DIRECTORY import preferences cache_dir = preferences.get(FETCH_PREFERENCES, FETCH_DIRECTORY) id_code = openedAs[0].upper() if cache_dir: from OpenSave import tildeExpand cache_dir = tildeExpand(cache_dir) from os.path import join, isfile path = join(cache_dir, ‘PDB’, id_code + “.pdb”) if not isfile(path): # PDB fetch falls back to mmCIF fetch, check for that path = join(cache_dir, ‘PDB’, id_code + ‘.cif’) if not isfile(path): path = None else: path = None —Eric
On Apr 12, 2019, at 9:20 AM, Ricardo Avila <ravila@protonmail.com> wrote:
Thank you Eric.
I was able to implement the feature I wanted for PDBs opened from a single file. I think it would be nice to be able to do it for fetched files too, so I would appreciate some help on that. I was also wondering if opened volumes have the same 'openedAs' attribute.
Best,
Ricardo
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, April 11, 2019 2:49 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Ricardo, Every opened model in Chimera has an ‘openedAs’ attribute which is either None or a 4-tuple. For models that were directly opened from a single file on the file system (rather than fetched to a file for instance), openedAs will be a tuple whose first component is the full path to that file. If you need more that that (e.g. fetched files too, which is more complicated), let me know and I can provide those details.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Apr 10, 2019, at 12:49 PM, Ricardo Avila <ravila@protonmail.com <mailto:ravila@protonmail.com>> wrote:
Hi,
I am trying to write an extension for a tool that requires PDB files or MRC structures as input. I would like to be able to pass the model or volume that is currently loaded in Chimera to this separate executable, but for this I need to get the file path to the model's object. Is this possible to do from the Python API?
Thanks in advance,
Ricardo Avila _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Hi, I want to get rmsd of an interface (constituted by 4 chains in heterotetramer protein) in bound and unbound conformations. so far I am trying to do this by using 'rmsd' command, but i am not sure if its the c-alfa or backbone or the full rmsd. I get a different rmsd value when I just open the sequences, perform structure association and then select sequence to get rmsd. Is there a command to select residues of different chains (the quaternary interface in my case) and perform either backbone or full rmsd??? thanks a lot. best, arvind.

Hi Arvind, The “rmsd” command uses whatever atoms you specify in the command. If you specify only residues but not atom names, that means all of their atoms. The following measure RMSD between residues 6-10 chain A of model #0 vs. model #1, based on all atoms, CA only, backbone only (N,CA,C,O), respectively: rmsd #0:6-10.a #1:6-10.a rmsd #0:6-10.a@ca #1:6-10.a@ca rmsd #0:6-10.a@n,ca,c,o #1:6-10.a@n,ca,c,o The pain is figuring out all the residue numbers you want to list. If you don’t know exactly which numbers in which chains, but you know how to select them, you could use menu: Actions… Write List to report which residues are selected. The specifications could include residues from multiple chains, e.g. :26-28.a,45.b@ca <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/atom_spec.html#hierarchy> In Multalign Viewer, the values reported in the RMSD column of the Region Browser are CA-only. <http://www.rbvi.ucsf.edu/chimera/docs/ContributedSoftware/multalignviewer/multalignviewer.html#regionbrowser> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Apr 13, 2019, at 9:22 AM, Arvind SHARMA <arvind.sharma@pasteur.fr> wrote:
Hi, I want to get rmsd of an interface (constituted by 4 chains in heterotetramer protein) in bound and unbound conformations. so far I am trying to do this by using 'rmsd' command, but i am not sure if its the c-alfa or backbone or the full rmsd. I get a different rmsd value when I just open the sequences, perform structure association and then select sequence to get rmsd.
Is there a command to select residues of different chains (the quaternary interface in my case) and perform either backbone or full rmsd??? thanks a lot. best, arvind.

Thanks a lot Elaine. Its greatly helpful. Have a lovely weekend Arvind ________________________________ From: Elaine Meng <meng@cgl.ucsf.edu> Sent: Saturday, April 13, 2019 6:45:59 PM To: Arvind SHARMA Cc: chimera-users@cgl.ucsf.edu BB Subject: Re: [Chimera-users] rmsd of selected region: multiple chains Hi Arvind, The “rmsd” command uses whatever atoms you specify in the command. If you specify only residues but not atom names, that means all of their atoms. The following measure RMSD between residues 6-10 chain A of model #0 vs. model #1, based on all atoms, CA only, backbone only (N,CA,C,O), respectively: rmsd #0:6-10.a #1:6-10.a rmsd #0:6-10.a@ca #1:6-10.a@ca rmsd #0:6-10.a@n,ca,c,o #1:6-10.a@n,ca,c,o The pain is figuring out all the residue numbers you want to list. If you don’t know exactly which numbers in which chains, but you know how to select them, you could use menu: Actions… Write List to report which residues are selected. The specifications could include residues from multiple chains, e.g. :26-28.a,45.b@ca <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/atom_spec.html#hierarchy> In Multalign Viewer, the values reported in the RMSD column of the Region Browser are CA-only. <http://www.rbvi.ucsf.edu/chimera/docs/ContributedSoftware/multalignviewer/multalignviewer.html#regionbrowser> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Apr 13, 2019, at 9:22 AM, Arvind SHARMA <arvind.sharma@pasteur.fr> wrote:
Hi, I want to get rmsd of an interface (constituted by 4 chains in heterotetramer protein) in bound and unbound conformations. so far I am trying to do this by using 'rmsd' command, but i am not sure if its the c-alfa or backbone or the full rmsd. I get a different rmsd value when I just open the sequences, perform structure association and then select sequence to get rmsd.
Is there a command to select residues of different chains (the quaternary interface in my case) and perform either backbone or full rmsd??? thanks a lot. best, arvind.
participants (4)
-
Arvind SHARMA
-
Elaine Meng
-
Eric Pettersen
-
Ricardo Avila