prettymol

Badge showing usage of MDAnalysis as a python package powering the add-on Badge showing usage of bpy as a python package powering the add-on Badge showing usage of molecularnodes as a python package powering the add-on

Quick start

Prerequisites

  • pixi. Manages the environment.
  • Blender the core viz engine.

Up and running

git clone https://github.com/zachcp/prettymol &&  cd prettymol
pixi run remove  # removes Blender's python
pixi run jupyter # starts Blender AND IPYTHON

Complete Minimal Example

%load_ext autoreload
%autoreload 2


from prettymol import draw, load_pdb StructureSelector, Repltools, MaterialCreator, StyleCreator, LightingCreator

# setup the repl
rt = Repltools()

# Load and process structure
structure = load_pdb("7xbu")
polymer = StructureSelector(structure).amino_acids().get_selection()
ligand = StructureSelector(structure).resname("MYN").get_selection()

# Create materials
surface_material =  MaterialCreator.new()
cartoon_material =  MaterialCreator.new()

sticks_material =  MaterialCreator.new().update_properties(
        **{'base_color': [0.15, 1, 0.15, 1],
           "emission_strength": 1,                  # try changing this
           "emission_color": [0.15, 1, 0.15, 1]})   # try changing this


# print(sticks_material)

# Draw and position
draw(structure, StyleCreator.cartoon(), MaterialCreator.new())
draw(ligand, StyleCreator.spheres(), sticks_material)

rt.view_set_axis(distance=0.1)  # try changing this
rt.view_render()