RosettaCommons / pyrosetta_viewer3d

Display PackedPose objects, Pose objects, or PDB files within a Jupyter notebook and Google Colab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where to put rosetta output when showing widgets

ajasja opened this issue · comments

Rosetta is pretty verbose. For example in the bundle preset when sliders are moved output get's printed and moves everything around.

One way is to use -mute all. Another is to use output widget
Not sure if that should be built into the preset directly or used by the end user.

Thanks, this is a great suggestion!

In #11, I've now added a viewer3d.tracer module with a requires_init wrapper that instantiates PyRosetta with -out:level 100 if it has not yet been instantiated. This helps reduce tracer output. I tested out use of the Output widget, specifically the @out.capture() decorator, and it does capture all output but also captures exceptions. Capturing exception stderr output could create confusion for the user if, for example, the user passes in a ResidueIndexSelector object to a module with error_on_out_of_bounds_index="true" and expects an error but doesn't receive it and the coloring wouldn't appear as the user specified. To get around the verbose PyRosetta logging, users should be encouraged to instantiate PyRosetta themselves with appropriate logging levels. In the presets, since modules aren't necessarily passed in, it is fine to use the with out: syntax on small code chunks producing output. Finally, to clear residual logging per notebook cell, self._clear_output is now called during the view.show() method, clearing any logging before the final display anyway.

Sounds good!