Skip to main content

Python package to insert a ligand in a 3D grid, created based on its respective receptor, considering each atom type as an integer

Project description

PyPI version shields.io PyPI pyversions PyPI license

Python package to insert a molecule in a 3D grid, considering each atom type as an integer.

See also:

Requirements

  • Python 3.7+

  • NumPy 1.19.5+

  • toml 0.10.2+

Installation

To install the latest release on PyPI, run:

pip install mol2grid

To install the latest developmental version, run:

git clone https://github.com/LBC-LNBio/mol2grid.git
pip install mol2grid

Usage

First, save the ligand and receptor structures to PDB-formatted files.

>>> ligand = 'path/to/ligand.pdb' # path to a target ligand
>>> receptor = 'path/to/receptor.pdb' # path to a target receptor

The lig2grid function takes a ligand and a receptor PDB-formatted files and inserts this ligand to a 3D grid created based on the receptor, a padding and a grid spacing (step).

>>> from mol2grid import lig2grid
>>> lig = lig2grid(ligand, receptor, padding=4.0, step=0.6, file=None, vdw=None, catalog=None, ignore_h=True)

The rec2grid function takes a receptor PDB-formatted file and inserts this receptor to a 3D grid created based on the receptor, a padding and a grid spacing (step).

>>> from mol2grid import rec2grid
>>> rec = rec2grid(receptor, padding=4.0, step=0.6, file=None, vdw=None, catalog=None, ignore_h=True)

The pair2grid function takes a ligand and a receptor PDB-formatted files and inserts this ligand and receptor to 3D grids created based on the receptor, a padding and a grid spacing (step).

>>> from mol2grid import pair2grid
>>> lig, rec = pair2grid(ligand, receptor, padding=4.0, step=0.6, file=None, vdw=None, catalog=None, ignore_h=True)

API

mol2grid.lig2grid

Inserts a target receptor to a 3D grid, created based on the receptor, a padding and a grid spacing (step).

mol2grid.lig2grid(ligand: str, receptor: str, padding: float, step: float = 0.6, file: Optional[str] = None, vdw: Optional[str] = None, catalog: Optional[str] = None, ignore_h: bool = True, nthreads: int = os.cpu_count() - 1, verbose: bool = False)  numpy.ndarray
Args:
  • ligand (str) – A path to a PDB-formatted file of a target ligand

  • receptor (str) – A path to a PDB-formatted file of a target receptor

  • padding (float) – A length to be added in each direction of the 3D grid

  • step (float, optional) – Grid spacing (A), by default 0.6

  • file (str, optional) – A path to a PDB-formatted file to write the grid points where atoms lay on and the barcodes are mapped on the B-values, by default None

  • vdw (str, optional) – A path to a custom van der Waals radii file, by default None

  • catalog (str, optional) – A path to a custom catalog file, by default None

  • ignore_h (bool, optional) – Whether to ignore hydrogen atoms, by default True

  • nthreads (int, optional) – Number of threads, by default {os.cpu_count()-1}

  • verbose (bool, optional) – Whether to print extra information to standard output, by default False

Returns:

A numpy.ndarray with grid points corresponding to the atom barcodes of the receptor

Return type:

numpy.ndarray

Note:

Greater barcodes have priority in the 3D grid when atoms overlap

mol2grid.rec2grid

Inserts a target receptor to a 3D grid, created based on the receptor, a padding and a grid spacing (step).

mol2grid.rec2grid(receptor: str, padding: float, step: float = 0.6, file: Optional[str] = None, vdw: Optional[str] = None, catalog: Optional[str] = None, ignore_h: bool = True, nthreads: int = os.cpu_count() - 1, verbose: bool = False)  numpy.ndarray
Args:
  • receptor (str) – A path to a PDB-formatted file of a target receptor

  • padding (float) – A length to be added in each direction of the 3D grid

  • step (float, optional) – Grid spacing (A), by default 0.6

  • file (str, optional) – A path to a PDB-formatted file to write the grid points where atoms lay on and the barcodes are mapped on the B-values, by default None

  • vdw (str, optional) – A path to a custom van der Waals radii file, by default None

  • catalog (str, optional) – A path to a custom catalog file, by default None

  • ignore_h (bool, optional) – Whether to ignore hydrogen atoms, by default True

  • nthreads (int, optional) – Number of threads, by default {os.cpu_count()-1}

  • verbose (bool, optional) – Whether to print extra information to standard output, by default False

Returns:

A numpy.ndarray with grid points corresponding to the atom barcodes of the ligand

Return type:

numpy.ndarray

Note:

Greater barcodes have priority in the 3D grid when atoms overlap

mol2grid.pair2grid

Inserts a target receptor to a 3D grid, created based on the receptor, a padding and a grid spacing (step).

mol2grid.pair2grid(ligand: str, receptor: str, padding: float, step: float = 0.6, ligfile: Optional[str] = None, recfile: Optional[str] = None, vdw: Optional[str] = None, catalog: Optional[str] = None, ignore_h: bool = True, nthreads: int = os.cpu_count() - 1, verbose: bool = False)  Tuple[numpy.ndarray,numpy.ndarray]
Args:
  • ligand (str) – A path to a PDB-formatted file of a target ligand

  • receptor (str) – A path to a PDB-formatted file of a target receptor

  • padding (float) – A length to be added in each direction of the 3D grid

  • step (float, optional) – Grid spacing (A), by default 0.6

  • ligfile (str, optional) – A path to a PDB-formatted file to write the grid points where atoms of the ligand lay on and the barcodes are mapped on the B-values, by default None

  • recfile (str, optional) – A path to a PDB-formatted file to write the grid points where atoms of the receptor lay on and the barcodes are mapped on the B-values, by default None

  • vdw (str, optional) – A path to a custom van der Waals radii file, by default None

  • catalog (str, optional) – A path to a custom catalog file, by default None

  • ignore_h (bool, optional) – Whether to ignore hydrogen atoms, by default True

  • nthreads (int, optional) – Number of threads, by default {os.cpu_count()-1}

  • verbose (bool, optional) – Whether to print extra information to standard output, by default False

Returns:

A tuple with numpy.ndarrays with grid points corresponding to the atom barcodes of the ligand and the receptor

Return type:

numpy.ndarray

Note:

Greater barcodes have priority in the 3D grid when atoms overlap

License

The software is licensed under the terms of the GNU General Public License version 3 (GPL3) and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

mol2grid-0.1.4-cp39-cp39-win_amd64.whl (44.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

mol2grid-0.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (149.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

mol2grid-0.1.4-cp39-cp39-macosx_10_14_x86_64.whl (43.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

mol2grid-0.1.4-cp38-cp38-win_amd64.whl (44.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

mol2grid-0.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (149.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

mol2grid-0.1.4-cp38-cp38-macosx_10_14_x86_64.whl (43.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

mol2grid-0.1.4-cp37-cp37m-win_amd64.whl (44.0 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

mol2grid-0.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (148.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

mol2grid-0.1.4-cp37-cp37m-macosx_10_14_x86_64.whl (43.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

Supported by

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