Skip to content

Testing pass - hierarchy_on_peptides.ipynb #7

@mrshirts

Description

@mrshirts
  • hierarchy_on_peptides.ipynb

First graph (with the five amino acids) is generated correctly. I think there is something going on when it tries to iterate over the children, with this error:

---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
Cell In[5], line 23
     20     for atomprim in resprim.children: # also color-code children correspondingly
     21         atomprim.metadata['color'] = rescolor
---> 23 plot_pointlike_primitive(
     24     universe_prim,
     25     ax,
     26     z_coord=sum(z_gaps),
     27     z_steps=iter(z_gaps),
     28     plot_arrows=plot_arrows,
     29     arrow_color=arrow_color,
     30 )
     31 plt.show()

Cell In[3], line 40, in plot_pointlike_primitive(prim, ax, z_steps, z_coord, z_eps, label, default_color, plot_arrows, arrow_color)
     38 # plot child primitive nodes
     39 for handle, childprim in prim.children_by_handle.items():
---> 40     child_pos = plot_pointlike_primitive(
     41         childprim,
     42         ax,
     43         z_coord=(z_coord - z_step),
     44         z_steps=tee(z_steps)[0], # need to tee to avoid sibling from exhausting next levels step
     45         z_eps=z_eps,
     46         label=(handle[1] if childprim.is_atom else handle[0]),
     47         default_color=default_color,
     48         plot_arrows=plot_arrows,
     49         arrow_color=arrow_color,
     50     )
     51     child_positions[handle] = child_pos
     52     if plot_arrows:

Cell In[3], line 40, in plot_pointlike_primitive(prim, ax, z_steps, z_coord, z_eps, label, default_color, plot_arrows, arrow_color)
     38 # plot child primitive nodes
     39 for handle, childprim in prim.children_by_handle.items():
---> 40     child_pos = plot_pointlike_primitive(
     41         childprim,
     42         ax,
     43         z_coord=(z_coord - z_step),
     44         z_steps=tee(z_steps)[0], # need to tee to avoid sibling from exhausting next levels step
     45         z_eps=z_eps,
     46         label=(handle[1] if childprim.is_atom else handle[0]),
     47         default_color=default_color,
     48         plot_arrows=plot_arrows,
     49         arrow_color=arrow_color,
     50     )
     51     child_positions[handle] = child_pos
     52     if plot_arrows:

Cell In[3], line 35, in plot_pointlike_primitive(prim, ax, z_steps, z_coord, z_eps, label, default_color, plot_arrows, arrow_color)
     32 ax.text(*(prim_pos + delta_z_eps), label, fontsize=12)
     34 if prim.has_children:
---> 35     z_step = next(z_steps)
     36     child_positions : dict[PrimitiveHandle, np.ndarray] = dict()
     38     # plot child primitive nodes

StopIteration: 
Image

and in the picture, seems to stop after drawing the Trp residue, as there are no children for Leu or other atoms posted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexamples

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions