Skip to content
forked from nezix/QuickSES

SiESTA-Surf a python interface for GPU-based solvent excluded surface generation

License

Notifications You must be signed in to change notification settings

miemiemmmm/SiESTA

 
 

Repository files navigation

SiESTA-Surf

License: MIT DOI

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.

Installation

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.

PyPI (Will be available soon) ⚠️

pip install siesta-surf

Install via Source Distribution

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 

Manual Installation

git clone https://github.com/miemiemmmm/SiESTA.git
cd SiESTA
make install 

Quick test

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

Usage

Python API

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.

siesta.pdb_to_xyzr(pdb_file_name:str) -> np.ndarray

Compute the xyzr array from pdb file

Parameters:
  • pdb_file_name: str
Returns:
  • 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.

siesta.pdb_to_file(pdb_file_name:str, output_file_name:str, format:str='ply') -> None

Generate the surface to file from pdb file

Parameters:
  • pdb_file_name: str
  • output_file_name: str
  • format: str, optional, default: 'ply'
Returns:
  • None

siesta.pdb_to_string(pdb_file_name:str, format:str='ply') -> str

Get the string of surface mesh from pdb file

Parameters:
  • pdb_file_name: str
  • format: str, optional, default: 'ply'
Returns: surface_string: str
  • surface_string: str

siesta.pdb_to_surf(pdb_file_name:str) -> tuple(vertices, faces)

Compute the vertices and faces from pdb file

Parameters:
  • pdb_file_name: str
Returns:
  • surface_tuple: tuple(vertices, faces)

siesta.xyzr_to_file(np.array xyzr, str output_file_name, format:str='ply') -> None

Generate the surface file from xyzr array

Parameters:
  • xyzr: np.ndarray shaped (N,4)
  • output_file_name: str
  • format: str, optional, default: 'ply'
Returns:
  • None

siesta.xyzr_to_string(np.array xyzr, format:str='ply') -> str

Generate surface object as string from xyzr array

Parameters:
  • xyzr: np.ndarray shaped (N,4)
  • format: str, optional, default: 'ply'
Returns:
  • surface_string: str

siesta.xyzr_to_surf(np.array xyzr) -> tuple(vertices, faces)

Compute the vertices and faces from xyzr array

Parameters:
  • xyzr: np.ndarray shaped (N,4)
Returns:
  • surface_tuple: tuple(vertices, faces)

QuickSES mini-program

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.


viewobj mini-program

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

Acknowledgments

Without the following open source projects, this project would not be possible:

About

SiESTA-Surf a python interface for GPU-based solvent excluded surface generation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 56.8%
  • Cuda 32.0%
  • Python 9.7%
  • Other 1.5%