luna.interaction.fp.view module¶
- class ShellViewer(show_cartoon=False, bg_color='white', add_directional_arrows=True, show_res_labels=True, inter_color=<luna.util.ColorPallete object>, pse_export_version='1.8')[source]¶
Bases:
luna.wrappers.pymol.PymolSessionManagerClass that inherits from
PymolSessionManagerand implementsset_view()to depict shells (IFP features) and interactions in Pymol and save the view as a Pymol session.This class can be used to visualize multiple complexes into the same Pymol session, for instance, to compare binding modes and analyze similar shells. To do so, it is recommended that the protein structures are in the same coordinate system, i.e., they should be aligned first. This can be achieved with
luna.align.tmalign.align_2struct()or any other tool of your preference.Examples
In the below example, we will assume a LUNA project object named
proj_objalready exists.To visualize shells, we first need to generate them. So, let’s define a
ShellGeneratorobject that will create shells over 2 iterations (levels). At each iteration, the shell radius will be increased by 3 and substructural information will be encoded following EIFP definition. Here, as an example, we will generate shells for the firstAtomGroupsManagerobject atproj_obj.>>> from luna.interaction.fp.shell import ShellGenerator >>> from luna.interaction.fp.type import IFPType >>> num_levels, radius_step = 2, 3 >>> sg = ShellGenerator(num_levels, radius_step, ifp_type=IFPType.EIFP) >>> atm_grps_mngr = list(proj_obj.atm_grps_mngrs)[0] >>> sm = sg.create_shells(atm_grps_mngr)
The function
create_shells()returns aShellManagerobject, which provides built-in methods to access the created shells. Therefore, you can interact with it to select the shells you want to visualize in Pymol. As an example, let’s select all unique shells at the last level:>>> shells = sm.get_shells_by_level(num_levels - 1, unique_shells=True)
Note
Levels are 0-indexed. So, the first level is 0, second is 1, etc. That means if
num_levelsis 5, the last level will be 4.As
ShellViewerexpects a list of tuples, we will define it now. The first item of the tuple is theEntryinstance, which represents a ligand. This can be obtained directly from theAtomGroupsManagerobject. The second item is the list of shells you want to visualize. Finally, the third item can be either a PDB file or a directory. In this example, we will use the PDB directory defined during the LUNA project initialization.>>> shell_tuples = [(atm_grps_mngr.entry, shells, proj_obj.pdb_path)]
To finish, we now create a new
ShellViewerobject and callnew_session(), which will initialize the session, depict shells and interactions, and save the session to an output PSE file.>>> from luna.interaction.fp.view import ShellViewer >>> sv = ShellViewer() >>> sv.new_session(shell_tuples, "example.pse")