Module 6: Visualizing Anything#
Welcome back, Apprentice Master. In the preceding modules, you learned how MolSysMT unifies molecular data containers (Forms), data properties (Attributes), hierarchical levels (Elements), native objects (Native Forms), and multi-file trajectories (Combined Forms).
Now we arrive at the primary visual portal of MolSysMT: msm.view().
Molecular structural biology is inherently spatial and visual. If you cannot inspect your system 3D geometry, you are working blind. The power of MolSysMT is that msm.view() is completely form-agnostic: whether your system is a remote PDB string, a local trajectory file, a native MolSys object, or a list of multi-forms, the visualization interface remains identical.
Glossary: Visualization
Visualization in MolSysMT is the unified 3D rendering of molecular systems using msm.view(). It seamlessly bridges remote database identifiers (pdb_id:), local disk files, native objects, and multi-form trajectory lists without requiring viewer-specific code. See the user-foundations guide for details on visualization backends.
Learning Outcomes
By the end of this module, you will be able to:
Render remote database entries directly using
msm.view('pdb_id:').Visualize local files, native objects, and multi-form trajectory lists (
[topology, trajectory]).Focus 3D views using selective filtering.
Understand how
msm.view()integrates native and third-party visualization backends.
1. Remote & Cloud Systems: msm.view('pdb_id:')#
Let’s begin by importing MolSysMT.
import molsysmt as msm
from molsysmt import systems
You can visualize any system directly from its RCSB PDB identifier using the 'pdb_id:' format string. MolSysMT automatically fetches the structure and renders it interactively in a single command:
# Visualize SARS-CoV-2 Main Protease directly from the PDB Cloud
msm.view('pdb_id:6LU7')
WARNING: Cross-chain covalent bonds were detected. (Hint: Verify whether these bonds are expected in your system. Docs: https://www.uibcdf.org/MolSysMT)
WARNING: Cross-chain covalent bonds were detected. (Hint: Verify whether these bonds are expected in your system. Docs: https://www.uibcdf.org/MolSysMT)
WARNING: Cross-chain covalent bonds were detected. (Hint: Verify whether these bonds are expected in your system. Docs: https://www.uibcdf.org/MolSysMT)
WARNING: Cross-chain covalent bonds were detected. (Hint: Verify whether these bonds are expected in your system. Docs: https://www.uibcdf.org/MolSysMT)
2. Local Files & Native Objects: msm.view(system)#
Whether your system is stored in a local PDB file, an H5MSM file, or an in-memory native molsysmt.MolSys object, msm.view() accepts any valid form directly:
# Load our demonstration T4 Lysozyme system
lysozyme = systems['T4 lysozyme L99A']['181l.bcif.gz']
# Render the local file
msm.view(lysozyme)
Hint
msm.view(): Universal 3D rendering engine for molecular systems. Accepts files, PDB IDs, native objects, or multi-form lists. See API doc: molsysmt.basic.view().
3. Multi-Forms & Trajectories: msm.view([topology, trajectory])#
As you learned in Module 5: Combined Forms, a molecular system can be represented by a list of complementary forms (such as a separate topology file and a trajectory file).
When you pass a trajectory or a multi-form system list to msm.view(), it automatically provides interactive animation controls and a trajectory slider to step through structures:
# Load Villin Headpiece topology and trajectory
villin_traj = systems['chicken villin HP35']['traj_chicken_villin_HP35_solvated.dcd']
villin_topo = systems['chicken villin HP35']['chicken_villin_HP35_solvated.h5msm']
# Render composite multi-form trajectory list
msm.view([villin_topo, villin_traj])
4. Selective Focus & Viewer Backends#
Complex systems with thousands of solvent molecules or ions can obscure important structural features. You can pass a selection parameter to msm.view() to focus the visual scene on specific components:
# Render only the protein component, hiding water molecules and ions
msm.view(lysozyme, selection='molecule_type=="protein"')
Note
Selection Preview: Selection queries allow you to filter atoms, groups, and molecules by property. We will explore the full power of MolSysMT’s Selection Language in Module 7: Selection Language Basics and Module 8: Interactive Selection.
🏆 Challenge 6: The Scene Director#
Load the Barnase-Barstar complex (
systems['Barnase-Barstar']['barnase_barstar.h5msm']).Use
msm.view()to render the full complex.Use
msm.view()withselection='chain_id == "A"'to focus exclusively on Chain A.Rotate the 3D scene and zoom into the binding interface.
With visual inspection mastered, you now have complete clarity over system state. In Module 7: Selection Language Basics, we will master the selection language used to target specific molecular subsets.
See also
API Documentation for Functions in this Module:
molsysmt.basic.view()— Universal form-agnostic 3D rendering engine.
Related Course Modules & Guides:
Previous Module: Module 5: Combined Forms
Next Module: Module 7: Selection Language Basics
User Guide: user-foundations