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 MDAnalysisendpoints(list): two endpoints defining the tunnel. Supported formats depend onendpoint_type:- residue IDs (
resid) - atom IDs (
atomid) - Cartesian coordinates (
[x, y, z])
- residue IDs (
endpoint_type(str): how to interpretendpoints(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 ofget_axis()(axis + frame vectors)
Returns
atoms(MDAnalysis.core.groups.AtomGrouporMDAnalysis.Universedepending 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 ofget_axis()
Returns
z(np.ndarray): position along the tunnel axistheta(np.ndarray): angular coordinate around the tunnel axisr(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
- Compute the tunnel axis (
get_axis) - Select tunnel-lining atoms (
get_atoms) - Project those atoms into cylindrical coordinates (
get_projection)
Returns
atoms: tunnel-lining atomscyl: 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 ofget_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 computedcyl: cylindrical coordinates fromget_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 bywrite_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 bywrite_df()value(str): currently supported:"Charge"
Typical Pipeline
- Load a structure using MDAnalysis:
import MDAnalysis as mda u = mda.Universe("structure.pdb")
- Compute tunnel geometry and tunnel-lining atoms
atoms, cyl = construct_tunnel(u, endpoints=[10, 250], endpoint_type="resid")
- Build a DataFrame for plotting
df = write_df(atoms, cyl, pdb_path="structure.pdb")
- 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
202d6a36cddef997d391a6f9adf055e1d1f847f3a1ad183a5a76b580a2e5b712
|
|
| MD5 |
bd468c948513e2c264978d452fc192fe
|
|
| BLAKE2b-256 |
cda29f03e74c3f884b5cd6e10e99a18161268c21437c50595a19f4b7ebabee33
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c915aabd37218eeb079b8a28763a67e5479129fcdb3727d08e7d437c32aed289
|
|
| MD5 |
0e86fe67c50ae4694ddf6037d6c8e731
|
|
| BLAKE2b-256 |
adc98584cbe88db440be451405fbe08a3b76aaae82dee67aee8a9c734db8c707
|