Molecules to grid (mol2grid)
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.
Metadata
Release files for mol2grid 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 710.3 kB
Release files / mol2grid-0.1.4-cp39-cp39-win_amd64.whl
| Download URL | mol2grid-0.1.4-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 44.1 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c0214cc0b1b650a38d8dc7b1a605d61d63d1e5e2cbf02793d4c02930ad6f3be6
|
|
BLAKE2b-256 checksum How to use checksums |
f75d76af87457d285849c4c7e9d6f1441c96a308fa20cc2307f0b6338ecabc8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / mol2grid-0.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
| Download URL | mol2grid-0.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl |
|---|---|
| Size | 149.4 kB |
| Tags | CPython 3.9 Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
984500bdbd8ffadee776e6db64e6cfdc7c6f6da2d5b062cdc6544eaf31a25bcb
|
|
BLAKE2b-256 checksum How to use checksums |
17723c02ee746c788c252df26ee076872f8b11fcd7c9fa0a0ade08728f4cf43f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / mol2grid-0.1.4-cp39-cp39-macosx_10_14_x86_64.whl
| Download URL | mol2grid-0.1.4-cp39-cp39-macosx_10_14_x86_64.whl |
|---|---|
| Size | 43.1 kB |
| Tags | CPython 3.9 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1c282f6cbe4f9b295d34242e8fcf101bf16c49351073f6833ede45b5ab943c0
|
|
BLAKE2b-256 checksum How to use checksums |
fea6a3bc591714925d77298577d3aeb31c63545c0e54fb950413e811473ee9db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / mol2grid-0.1.4-cp38-cp38-win_amd64.whl
| Download URL | mol2grid-0.1.4-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 44.1 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d29635b9894683e1ce6939871de853762fc9eeedfcadf63ade089abf584eef58
|
|
BLAKE2b-256 checksum How to use checksums |
ec841d4659b30a188360165ffdc7c4bd796a8caa7802f3f7521aa1319e05a931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Release files / mol2grid-0.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
| Download URL | mol2grid-0.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl |
|---|---|
| Size | 149.5 kB |
| Tags | CPython 3.8 Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
cbbb1a6827d3d7ceb3fc4ca8c4bacfbb31c9ea185f72d172cc9b2e07dc656756
|
|
BLAKE2b-256 checksum How to use checksums |
396356a0a29024c1e9534ff2623d37abea1e5fad15396a1146cf90f7bed3d08e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / mol2grid-0.1.4-cp38-cp38-macosx_10_14_x86_64.whl
| Download URL | mol2grid-0.1.4-cp38-cp38-macosx_10_14_x86_64.whl |
|---|---|
| Size | 43.6 kB |
| Tags | CPython 3.8 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
aadba81efb097d17938fe138f6350961630cbb13e0b379e024d4ea34d3b24edb
|
|
BLAKE2b-256 checksum How to use checksums |
199d87109aa4d0c38fb9b291a3a58a62690d9a406d78f91f87dc67a5ff0b0007
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Release files / mol2grid-0.1.4-cp37-cp37m-win_amd64.whl
| Download URL | mol2grid-0.1.4-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 44.0 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3c19a75f14a8aae5b4f7ae187ff8e26ae731f352208729aef01a242941174d73
|
|
BLAKE2b-256 checksum How to use checksums |
17e54987350fdc8e53cc7e7cdfb3c762dff0788a996c317f6c5533d3c81f64b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9
|
Release files / mol2grid-0.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
| Download URL | mol2grid-0.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl |
|---|---|
| Size | 148.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1153665266c380f8da10ff68b35c075fc3791fd2ad80fc54f4451c0586dabdd4
|
|
BLAKE2b-256 checksum How to use checksums |
52a2a58cebd65ed67e2154a8ab77832689b8cc63473c8dc6b454977bddb11a59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / mol2grid-0.1.4-cp37-cp37m-macosx_10_14_x86_64.whl
| Download URL | mol2grid-0.1.4-cp37-cp37m-macosx_10_14_x86_64.whl |
|---|---|
| Size | 43.5 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
65aac1b7932b091c697e378aa08024264a35f7ce29736a3751463fd4427359b1
|
|
BLAKE2b-256 checksum How to use checksums |
1926818f4d36cd0ff8034b71ddd2df4b8ea0fff81102c99dfa6a594456e566ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10
|