Find Residues From Specified Residue Numbers Help
Dear ChimeraX Users,
I'm learning how to use the Python API and I found the set of ChimeraX recipes and am trying to use the code featured on the "Find Residues From Specified Residue Numbers" page. I've run into the following issue: NameError: name 'structure' is not defined.
I'm not sure what I should be using as an input for the "structure.residues" argument so I have not changed that input. What "structure" should I be specifying? Any help would be greatly appreciated.
Shosholoza,
Jonathan Myers
Hi Jonathan,
I added some Python code to that example
https://rbvi.github.io/chimerax-recipes/residues/residues.html https://rbvi.github.io/chimerax-recipes/residues/residues.html
to get the currently open atomic structures
from chimerax.atomic import all_structures structures = all_structures(session)
Another way to get the structures is
from chimerax.atomic import Structure structures = session.models.list(type = Structure)
More info about the Python functions in ChimeraX is in the programmer's manual
https://www.rbvi.ucsf.edu/chimerax/docs/devel/index.html https://www.rbvi.ucsf.edu/chimerax/docs/devel/index.html
for instance the all_structures() function is under the atomic module. But that has hundreds of functions so it can certainly be hard to find
https://www.rbvi.ucsf.edu/chimerax/docs/devel/bundles/atomic/src/atomic.html https://www.rbvi.ucsf.edu/chimerax/docs/devel/bundles/atomic/src/atomic.html
Tom
On Aug 5, 2022, at 4:15 PM, Myers, Jonathan via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Dear ChimeraX Users,
I'm learning how to use the Python API and I found the set of ChimeraX recipes and am trying to use the code featured on the "Find Residues From Specified Residue Numbers" page. I've run into the following issue: NameError: name 'structure' is not defined.
I'm not sure what I should be using as an input for the "structure.residues" argument so I have not changed that input. What "structure" should I be specifying? Any help would be greatly appreciated.
Shosholoza, Jonathan Myers
ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu mailto:ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
participants (2)
-
Myers, Jonathan
-
Tom Goddard