Skip to main content

Compute and visualize biomolecular tunnels.

Project description

TunnelWiz

TunnelWiz is a small Python package for computing biomolecular tunnels from structural data and visualizing the tunnel axis and tunnel-lining atoms.

It contains two modules:

  • builder — tunnel geometry computation (axis + atom selection + coordinate transforms)
  • visual — interactive visualization and plotting utilities

Dependencies

Core scientific stack:

  • NumPy
  • SciPy
  • MDAnalysis

Visualization and analysis utilities:

  • Pandas
  • Plotly
  • NGLView
  • RDKit (currently used to guess charges from a PDB; this may change in future versions)

API Overview

get_axis(universe, endpoints, endpoint_type)

Compute a tunnel axis and a local reference frame along that axis.

Parameters

  • universe (MDAnalysis.Universe): structure loaded with MDAnalysis
  • endpoints (list): two endpoints defining the tunnel. Supported formats depend on endpoint_type:
    • residue IDs (resid)
    • atom IDs (atomid)
    • Cartesian coordinates ([x, y, z])
  • endpoint_type (str): how to interpret endpoints (e.g. "resid", "atomid", "coords")

Returns

  • axis (np.ndarray): sampled axis points along the tunnel, shape (N, 3)
  • t (np.ndarray): tangent vectors, shape (N, 3)
  • n (np.ndarray): normal vectors, shape (N, 3)
  • b (np.ndarray): binormal vectors, shape (N, 3)

get_atoms(universe, axes)

Select atoms near the tunnel axis (i.e., tunnel-lining atoms).

Parameters

  • universe (MDAnalysis.Universe)
  • axes: output of get_axis() (axis + frame vectors)

Returns

  • atoms (MDAnalysis.core.groups.AtomGroup or MDAnalysis.Universe depending on implementation): atoms selected around the tunnel axis

get_projection(points, axes)

Project Cartesian coordinates into the tunnel coordinate system and return cylindrical coordinates.

Parameters

  • points (np.ndarray): Cartesian coordinates, shape (M, 3)
  • axes: output of get_axis()

Returns

  • z (np.ndarray): position along the tunnel axis
  • theta (np.ndarray): angular coordinate around the tunnel axis
  • r (np.ndarray): radial distance from the tunnel axis

construct_tunnel(universe, endpoints, endpoint_type="resid")

Convenience function that runs the full computation pipeline.

What it does

  1. Compute the tunnel axis (get_axis)
  2. Select tunnel-lining atoms (get_atoms)
  3. Project those atoms into cylindrical coordinates (get_projection)

Returns

  • atoms: tunnel-lining atoms
  • cyl: cylindrical coordinates of those atoms (z, theta, r)

Visualization & Plotting

show_tunnel(universe, axes)

Visualize the tunnel axis inside the structure using NGLView.

Parameters

  • universe (MDAnalysis.Universe)
  • axes: output of get_axis()

Returns

  • an nglview.NGLWidget (interactive viewer)

write_df(universe, cyl, pdb_path)

Create a Pandas DataFrame for downstream plotting.

Parameters

  • universe: atoms for which cylindrical coordinates were computed
  • cyl: cylindrical coordinates from get_projection() / construct_tunnel()
  • pdb_path (str or path): PDB file used to infer charges via RDKit (temporary approach)

Returns

  • df (pandas.DataFrame): structured table for plotting and aggregation

show_scatter(df, color_by)

Interactive scatter plot of tunnel-lining atoms in cylindrical space.

Parameters

  • df: DataFrame created by write_df()
  • color_by (str): column name used for coloring points, e.g.:
    • "Chain", "Charge", "R", "Type", "ResName"

show_heatmap(df, value)

Heatmap of a chosen property in tunnel coordinates.

Parameters

  • df: DataFrame created by write_df()
  • value (str): currently supported: "Charge"

Typical Pipeline

  1. Load a structure using MDAnalysis:
    import MDAnalysis as mda
    u = mda.Universe("structure.pdb")
    
  2. Compute tunnel geometry and tunnel-lining atoms
    atoms, cyl = construct_tunnel(u, endpoints=[10, 250], endpoint_type="resid")
    
  3. Build a DataFrame for plotting
    df = write_df(atoms, cyl, pdb_path="structure.pdb")
    
  4. Visualize and plot
    show_scatter(df, color_by="Chain")
    show_heatmap(df, value="Charge")
    

Notes

Charge computation via RDKit + PDB is currently a placeholder and may change in future release.

Selection of the tunnel-lining atoms is done by spherical selection. In future release this is intended to be improved.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tunnelwiz-1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tunnelwiz-1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file tunnelwiz-1.0.tar.gz.

File metadata

  • Download URL: tunnelwiz-1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tunnelwiz-1.0.tar.gz
Algorithm Hash digest
SHA256 202d6a36cddef997d391a6f9adf055e1d1f847f3a1ad183a5a76b580a2e5b712
MD5 bd468c948513e2c264978d452fc192fe
BLAKE2b-256 cda29f03e74c3f884b5cd6e10e99a18161268c21437c50595a19f4b7ebabee33

See more details on using hashes here.

File details

Details for the file tunnelwiz-1.0-py3-none-any.whl.

File metadata

  • Download URL: tunnelwiz-1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tunnelwiz-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c915aabd37218eeb079b8a28763a67e5479129fcdb3727d08e7d437c32aed289
MD5 0e86fe67c50ae4694ddf6037d6c8e731
BLAKE2b-256 adc98584cbe88db440be451405fbe08a3b76aaae82dee67aee8a9c734db8c707

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page