SiESTA-Surf is a Python API to utilizes CUDA for GPU-based computation of molecular solvent excluded surface (SES). This repository is developed based on QuickSES. It features a 3D uniform grid for constant-time access to atom neighbors and incorporates a CUDA-implemented Marching Cubes algorithm, as well as a GPU-based method for welding mesh vertices.
The nvcc compiler from the NVIDIA CUDA toolkit is required to successfully compile SiESTA-Surf. SiESTA-Surf contains a python package siesta and two console programs:
- QuickSES to generate surface mesh (in OBJ format) from a PDB structure.
- viewobj to view simple structures (as ball+stick model), objects surface meshes or point clouds.
pip install siesta-surf
wget https://github.com/miemiemmmm/SiESTA/releases/download/v0.0.2/siesta-surf-v0.0.2.tar.gz
pip install -v siesta-surf-v0.0.2.tar.gz
git clone https://github.com/miemiemmmm/SiESTA.git
cd SiESTA
make install
After installation, you can test the installation by running the following commands in the terminal.
wget https://files.rcsb.org/download/4bso.pdb
python3 -c """import siesta;
xyzr = siesta.pdb_to_xyzr('4bso.pdb'); print('Test1: Converted PDB to XYZR array: ', xyzr.shape);
siesta.pdb_to_file('4bso.pdb', '4bso_pysurf.obj', output_format='obj', grid_size=0.3);
print('Test2: Surface mesh saved to 4bso_pysurf.obj');
ply_str = siesta.pdb_to_string('4bso.pdb');
print('Test3: Generated the surface mesh string from PDB file: ', len(ply_str), [ply for ply in ply_str.split('\n') if 'element' in ply])
siesta.xyzr_to_file(xyzr, '4bso_pysurf.ply', output_format='ply', grid_size=0.25);
print('Test4: Surface mesh computed from the previously computed XYZR array saved to 4bso_pysurf.ply');
"""
# QuickSES console program
QuickSES -i 4bso.pdb -o 4bso_surface.obj -v 0.2
# viewobj console program (requires Open3D)
viewobj 4bso_pysurf.obj 4bso_pysurf.ply # View the python generated surface mesh
viewobj 4bso_surface.obj 4bso.pdb -w 1 # View the QuickSES generated surface mesh
This API focuses on converting any structural file formats (e.g. PDB, sdf, mol2 etc.) to 3D surface triangle mesh. You could either use the API to convert the structures to vertices and faces as numpy array. You could also directly convert it to 3D surface triangle mesh. Currently supported object file formats are ply and obj.
Compute the xyzr array from pdb file
- pdb_file_name: str
- xyzr: np.ndarray shaped (N,4)
The following surface generation functions accept "grid_size", "smooth_step", "slice_number" as optional arguments to control the quality of mesh.
Generate the surface to file from pdb file
- pdb_file_name: str
- output_file_name: str
- format: str, optional, default: 'ply'
- None
Get the string of surface mesh from pdb file
- pdb_file_name: str
- format: str, optional, default: 'ply'
- surface_string: str
Compute the vertices and faces from pdb file
- pdb_file_name: str
- surface_tuple: tuple(vertices, faces)
Generate the surface file from xyzr array
- xyzr: np.ndarray shaped (N,4)
- output_file_name: str
- format: str, optional, default: 'ply'
- None
Generate surface object as string from xyzr array
- xyzr: np.ndarray shaped (N,4)
- format: str, optional, default: 'ply'
- surface_string: str
Compute the vertices and faces from xyzr array
- xyzr: np.ndarray shaped (N,4)
- surface_tuple: tuple(vertices, faces)
QuickSES -h # view help
QuickSES -i 4bso.pdb -o 4bso_surface.obj -v 0.2
The default resolution is set to 0.5 Å but can be changed at runtime using -v argument. The size of the slice that defines how much memory QuickSES uses can be changed using -s argument. For the other usage of QuickSES, please refer to its original repository QuickSES.
If you have Open3D installed in your python environment, you can use viewobj to visualize the surface mesh and some commonlu used structure files.
viewobj -h # view help
viewobj 4bso_surface.obj -w 1 # show the surface mesh as wireframe
Current supported format includes:
Structural formats | |
Protein Data Bank (PDB) format | .pdb |
Sybyl Mol2 | .mol2 |
MDL SDF | .sdf |
Coord+Radius (XYZR) | .xyzr |
Mesh formats | |
Polygon File Format (Default output format) | .ply |
Wavefront OBJ format | .obj |
Object File Format | .off |
Without the following open source projects, this project would not be possible:
- This project is developed based on QuickSES by Xavier Martinez. Original publication and the surface computation algorithm.
- CPDB is used for parsing PDB files.
- Pybind11 is used for wrapping C++/CUDA code to Python API.
- The LOGO is designed by DALL·E 3.