Adding models as a group/subgroup using Python
I tried to read the Programming API but was unable to find out. Right now: I created surface A1,A2,B1,B2,D1,D2, etc.. I added these surfaces in a list surfs = [] surfs.append(A1) surfs.append(A2) ... surfs.append(D2) session.models.add_group(surfs, name="All surface") This make A1,A2 as models #1.1,#1.2 etc Interestingly, I cannot even find the document for add_group. I learned this from ChimeraX recipes. Anyway, I want to organize the data a bit better to have it like this #1; Surface ---> #1.1 Surf A -------> #1.1.1 A1 -------> #1.1.2 A2 ---> #1.2 Surf B -------> #1.2.1 B1 -------> #1.2.2 B1 How can we do that? Best,
Hi, This code would produce the hierarchy you described: from chimerax.core.models import Model top = Model(“Surface”, session) session.models.add([top]) session.models.add_group([A1, A2], name=“Surf A”, parent=top) session.models.add_group([B1, B2], name=“Surf B”, parent=top) Alternatively you could use the “rename” command to reorganize your models into a hierarchy. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Dec 14, 2025, at 9:09 PM, huybk81--- via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
I tried to read the Programming API but was unable to find out.
Right now: I created surface A1,A2,B1,B2,D1,D2, etc.. I added these surfaces in a list surfs = [] surfs.append(A1) surfs.append(A2) ... surfs.append(D2) session.models.add_group(surfs, name="All surface")
This make A1,A2 as models #1.1,#1.2 etc Interestingly, I cannot even find the document for add_group. I learned this from ChimeraX recipes.
Anyway, I want to organize the data a bit better to have it like this #1; Surface ---> #1.1 Surf A -------> #1.1.1 A1 -------> #1.1.2 A2 ---> #1.2 Surf B -------> #1.2.1 B1 -------> #1.2.2 B1
How can we do that? Best, _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
Eric Pettersen -
huybk81@gmail.com