import molecularnodes as mn
= mn.Canvas(resolution=(860, 540), transparent=True) cv
Styles
This is how we can add styles or representations of our molecular data, so we can actually see something.
= ["4ozs", "8H1B", "8U8W"]
codes = [
styles
mn.StyleCartoon(),
mn.StyleRibbon(),="Instance", subdivisions=4),
mn.StyleSpheres(geometry
]= [
materials
mn.material.Default(),
mn.material.AmbientOcclusion(),
mn.material.FlatOutline(),
]
for code, style, material in zip(codes, styles, materials):
= mn.Molecule.fetch(code)
mol =material)
mol.add_style(style, material
cv.frame_object(mol)
cv.snapshot() cv.clear()
= (
mol "8H1B")
mn.Molecule.fetch("cartoon", material = mn.material.AmbientOcclusion())
.add_style(
.add_style(="surface",
style=mn.MoleculeSelector().is_peptide(),
selection=(0.6, 0.6, 0.8, 1.0),
color=mn.material.TransparentOutline()
material
)
)
cv.frame_object(mol) cv.snapshot()
0].remove()
mol.styles[ cv.snapshot()
(
mol'ribbon', selection="is_peptide")
.add_style('surface', selection="is_nucleic")
.add_style(
)= mol.styles[1]
style = 1.5
style.backbone_radius = 5
style.quality = mn.material.AmbientOcclusion()
style.material cv.snapshot()
cv.clear()= mn.scene.Cycles(samples=32)
cv.engine = (
mol "9EYM")
mn.Molecule.fetch("cartoon", material = mn.material.AmbientOcclusion(), selection = "is_peptide")
.add_style("ball_and_stick", selection=mn.entities.MoleculeSelector().not_peptide())
.add_style(
)1].bond_find = True
mol.styles[
cv.frame_view(mol) cv.snapshot()
-3.14, 0, 0))
cv.frame_view(mol, ( cv.snapshot()