Skip to content

Commit

Permalink
change test data files structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ale94mleon committed Dec 6, 2023
1 parent ae8d528 commit 6d38b0e
Show file tree
Hide file tree
Showing 21 changed files with 8,544 additions and 8,533 deletions.
4,208 changes: 2,110 additions & 2,098 deletions docs/notebooks/advance_topics.ipynb

Large diffs are not rendered by default.

382 changes: 187 additions & 195 deletions docs/notebooks/constraint_docking.ipynb

Large diffs are not rendered by default.

139 changes: 69 additions & 70 deletions docs/notebooks/how_to.ipynb

Large diffs are not rendered by default.

468 changes: 233 additions & 235 deletions docs/notebooks/quickstart.ipynb

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/source/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Use `random.random` instead `numpy.random.rand` function for some small cases.
- `AllChem.MMFFOptimizeMolecule` is only used internally for `moldrug.utils.confgen` and `moldrug.constraintconf.gen_aligned_conf` if `randomseed` is not set and with `maxIters = 500`.
- `pickle` module is replaced by `dill`. It is better to handle user custom fitness functions.
- `pickle` module is replaced by `dill`. It is better to handle users' custom fitness functions.
- Data now is retrieved with `moldrug``.data.get_data` function.
- Is not needed to input the whole desirability definition if only is intended to change one part of the default desirability used internally by the cost functions of `moldrug.fitness`. For example, if you would like to change the `Target` value of `vina_score` from its default value.

Before:
Expand Down Expand Up @@ -101,8 +102,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Small bug when the population has Individuals with the same cost. Better reproducibility.
- Refactored changes on tutorials.
- Handled properly in case `receptor_pdbqt_path = None`
- Refactored changes.
- Handled properly in case `receptor_pdbqt_path = None`.
- Convert `self.crem_db_path` to absolute path in `moldrug.utils.Local` and `moldrug.utils.GA`.

## [3.5.0] - 2023.10.26
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ include-package-data = true
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
moldrug = [
"LICENSE",
"README.rst",
"data/*/*.yml",
"data/*/*.mol",
"data/*/*.smi",
"data/*/*.pdb",
"data/*/*.pdbqt",

]


[project.scripts]
moldrug = "moldrug.cli:__moldrug_cmd"
Expand Down
8 changes: 8 additions & 0 deletions src/moldrug/data/6lu7/box.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
boxcenter:
- -13.07
- 12.58
- 67.15
boxsize:
- 22.5
- 23.625
- 23.25
1 change: 1 addition & 0 deletions src/moldrug/data/6lu7/ligand.smi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CC(C)C[C@H](NC(=O)[C@@H](NC(=O)[C@H](C)NC(O)C1CC(C)ON1)C(C)C)C(=O)N[C@H](CC[C@H](O)OCC1CCCCC1)C[C@@H]1CCNC1O
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The reference mol blocks ligands for the receptors with PDB id: : 6lu7, x0161.
"""
r_6lu7 = """6lu7
6lu7
RDKit 3D

23 23 0 0 0 0 0 0 0 0999 V2000
Expand Down Expand Up @@ -53,40 +48,4 @@
10 21 1 0
13 22 1 0
14 23 1 0
M END
"""

r_x0161 = """r_x0161
RDKit 3D
14 14 0 0 1 0 0 0 0 0999 V2000
13.8921 -2.4077 24.1269 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4897 -0.2702 23.1446 C 0 0 0 0 0 0 0 0 0 0 0 0
12.8011 1.0351 23.3277 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6117 1.1475 24.0810 C 0 0 0 0 0 0 0 0 0 0 0 0
10.9808 2.3973 24.2401 C 0 0 0 0 0 0 0 0 0 0 0 0
11.5348 3.5418 23.6347 C 0 0 0 0 0 0 0 0 0 0 0 0
12.7111 3.4432 22.8672 C 0 0 0 0 0 0 0 0 0 0 0 0
13.3408 2.1928 22.7264 C 0 0 0 0 0 0 0 0 0 0 0 0
9.4491 5.0959 22.7844 N 0 0 0 0 0 0 0 0 0 0 0 0
13.2656 -1.1348 24.1544 O 0 0 0 0 0 0 0 0 0 0 0 0
14.2110 -0.5201 22.1789 O 0 0 0 0 0 0 0 0 0 0 0 0
11.6894 6.1877 23.4320 O 0 0 0 0 0 0 0 0 0 0 0 0
10.1931 5.1760 25.2380 O 0 0 0 0 0 0 0 0 0 0 0 0
10.7644 5.1384 23.8833 S 0 0 0 0 0 0 0 0 0 0 0 0
1 10 1 0
2 3 1 0
2 10 1 0
2 11 2 0
3 4 2 0
3 8 1 0
4 5 1 0
5 6 2 0
6 7 1 0
6 14 1 0
7 8 2 0
9 14 1 0
12 14 2 0
13 14 2 0
M END
"""
M END
2,883 changes: 1 addition & 2,882 deletions src/moldrug/data/receptor_pdb.py → src/moldrug/data/6lu7/protein.pdb

Large diffs are not rendered by default.

2,880 changes: 1 addition & 2,879 deletions src/moldrug/data/receptor_pdbqt.py → src/moldrug/data/6lu7/protein.pdbqt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/moldrug/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from moldrug.data._get import get_data
import json

if __name__ == "__main__":

print(json.dumps(get_data('6lu7'), indent=3))
57 changes: 57 additions & 0 deletions src/moldrug/data/_get.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import yaml
from moldrug import home
import os

_AVAILABLE_DATA = ['6lu7', 'x0161']


class DataNotFound(Exception):
pass


def get_data(name: str) -> dict:
"""Retrieve MolDrug data
Parameters
----------
name : str
Name of the data directory of MolDrug
Returns
-------
dict
A dictionary with keys:
* box: boxcenter, boxsize
* ligand_3D: absolute path
* smiles: the ligans's SMILES
* protein: pdb, pdbqt
Raises
------
DataNotFound
MolDrug does not contains the data.
"""

root_data = home.home(dataDir=name)

if not os.path.exists(root_data) or not name:
raise DataNotFound(f"MolDrug data does not have '{name}' data set. "
f"Choose from: {_AVAILABLE_DATA}")

with open(os.path.join(root_data, 'box.yml'), 'r') as f:
box = yaml.safe_load(f)

with open(os.path.join(root_data, 'ligand.smi'), 'r') as f:
smiles = f.readline()

data = {
'box': box,
'ligand_3D': os.path.join(root_data, 'ligand_3D.mol'),
'smiles': smiles,
'protein': {
'pdb': os.path.join(root_data, 'protein.pdb'),
'pdbqt': os.path.join(root_data, 'protein.pdbqt'),
}
}
return data
33 changes: 0 additions & 33 deletions src/moldrug/data/boxes.py

This file was deleted.

8 changes: 0 additions & 8 deletions src/moldrug/data/ligands.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/moldrug/data/x0161/box.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
boxcenter:
- 12.11
- 1.84
- 23.56
boxsize:
- 22.5
- 22.5
- 22.5
1 change: 1 addition & 0 deletions src/moldrug/data/x0161/ligand.smi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COC(=O)C=1C=CC(=CC1)S(=O)(=O)N
33 changes: 33 additions & 0 deletions src/moldrug/data/x0161/ligand_3D.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
x0161
RDKit 3D

14 14 0 0 1 0 0 0 0 0999 V2000
13.8921 -2.4077 24.1269 C 0 0 0 0 0 0 0 0 0 0 0 0
13.4897 -0.2702 23.1446 C 0 0 0 0 0 0 0 0 0 0 0 0
12.8011 1.0351 23.3277 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6117 1.1475 24.0810 C 0 0 0 0 0 0 0 0 0 0 0 0
10.9808 2.3973 24.2401 C 0 0 0 0 0 0 0 0 0 0 0 0
11.5348 3.5418 23.6347 C 0 0 0 0 0 0 0 0 0 0 0 0
12.7111 3.4432 22.8672 C 0 0 0 0 0 0 0 0 0 0 0 0
13.3408 2.1928 22.7264 C 0 0 0 0 0 0 0 0 0 0 0 0
9.4491 5.0959 22.7844 N 0 0 0 0 0 0 0 0 0 0 0 0
13.2656 -1.1348 24.1544 O 0 0 0 0 0 0 0 0 0 0 0 0
14.2110 -0.5201 22.1789 O 0 0 0 0 0 0 0 0 0 0 0 0
11.6894 6.1877 23.4320 O 0 0 0 0 0 0 0 0 0 0 0 0
10.1931 5.1760 25.2380 O 0 0 0 0 0 0 0 0 0 0 0 0
10.7644 5.1384 23.8833 S 0 0 0 0 0 0 0 0 0 0 0 0
1 10 1 0
2 3 1 0
2 10 1 0
2 11 2 0
3 4 2 0
3 8 1 0
4 5 1 0
5 6 2 0
6 7 1 0
6 14 1 0
7 8 2 0
9 14 1 0
12 14 2 0
13 14 2 0
M END
Loading

0 comments on commit 6d38b0e

Please sign in to comment.