From 774cb19b54b3c57b25725f950ae48af9a947e07d Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Leon Date: Sat, 25 Nov 2023 23:41:49 +0100 Subject: [PATCH] improve docs --- docs/notebooks/how_to.ipynb | 9 +++++---- docs/source/api.rst | 4 ++-- docs/source/installation.rst | 32 +++++++++++++++++++++++++------- src/moldrug/utils.py | 14 +++++++------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/docs/notebooks/how_to.ipynb b/docs/notebooks/how_to.ipynb index 61378f3..fa31190 100644 --- a/docs/notebooks/how_to.ipynb +++ b/docs/notebooks/how_to.ipynb @@ -164,7 +164,8 @@ } ], "source": [ - "inspect.getfullargspec(utils.Local.__init__).args" + "inspect.getfullargspec(utils.Local.__init__).args\n", + "# The sam can be done for GA: inspect.getfullargspec(utils.Local.__init__).args" ] }, { @@ -195,7 +196,7 @@ " costfunc: Cost\n", " costfunc_kwargs:\n", " vina_executable: vina\n", - " receptor_path: /tmp/your_tmp_dir/x0161.pdbqt\n", + " receptor_pdbqt_path: /tmp/your_tmp_dir/x0161.pdbqt\n", " boxcenter:\n", " - 12.11\n", " - 1.84\n", @@ -236,7 +237,7 @@ "```yaml\n", " costfunc_kwargs:\n", " vina_executable: vina\n", - " receptor_path: /tmp/your_tmp_dir/x0161.pdbqt\n", + " receptor_pdbqt_path: /tmp/your_tmp_dir/x0161.pdbqt\n", " boxcenter:\n", " - 12.11\n", " - 1.84\n", @@ -576,7 +577,7 @@ "try:\n", " whole_result = utils.decompress_pickle(os.path.join(tmp_path.name, 'custom_fitness', 'local_result.pbz2'))\n", "except Exception as e:\n", - " print(f\"This was the problem: {e}. So we have to add to the system path the directory where CustomMolDrugFitness.py is located.\") \n", + " print(f\"This was the problem: {e}. So we have to add to the system path the directory where CustomMolDrugFitness.py is located.\")\n", " sys.path.append(os.path.join(tmp_path.name, 'custom_fitness'))\n", " whole_result = utils.decompress_pickle(os.path.join(tmp_path.name, 'custom_fitness', 'local_result.pbz2'))\n", "\n", diff --git a/docs/source/api.rst b/docs/source/api.rst index 1988eda..fea97b0 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -4,8 +4,8 @@ Summary Input data ---------- -Currently, **MolDrug** only accepts valid RDKit molecules and valid pdbqt files that -will be processed by Vina. +Currently, **MolDrug** only accepts valid RDKit molecules and a valid pdbqt file that +will be processed in case AutoDock-Vina is used. The idea -------- diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 668e2e5..4dd3762 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -36,11 +36,14 @@ or: pip install -U git+https://github.com/ale94mleon/MolDrug.git@main There are multiple methods to obtain `AutoDock-Vina `_. You can use `conda `_ or download the latest release from the `Vina Repository `_. -We highly recommend using the ast release posted on method `Vina Repository `_, which we will demonstrate here. +We highly recommend using the last release posted on `Vina Repository `_. + +.. note:: + -Getting last Vina -~~~~~~~~~~~~~~~~~ +Getting last AutoDock-Vina +~~~~~~~~~~~~~~~~~~~~~~~~~~ AutoDock-Vina is an ongoing project, and it is advisable to stay up-to-date by regularly checking for the latest `release `_. As of the creation of this documentation, the most recent version is `v1.2.5 `_. @@ -71,10 +74,10 @@ MacOS Windows ^^^^^^^ -Please, download form `release `_. Conda installation may not work. +Please, download from `release `_. Conda installation may not work. Via conda ---------- +^^^^^^^^^ MolDrug is also available through conda. However, the pip installation is the recommended one. @@ -87,17 +90,32 @@ MolDrug is also available through conda. However, the pip installation is the re .. note:: MacOS users may face some problems trying to install because of the AutoDock-Vina dependency. If that is so, please follow the pip instructions. -If some dependencies are missing, please installed through pip. Some of them could be: +If some dependencies are missing, please install them through pip. Some of them could be: .. code-block:: bash pip install meeko crem pyyaml scipy tqdm +Converting pdb to pdbqt +~~~~~~~~~~~~~~~~~~~~~~~ + +This step can be archived through `OpenBabel `__ or through `ADFR `_. We recommend ADFR. Depending on the platform you should be able to access the program `prepare_receptor``. In my case, it lays on `/Users/klimt/ADFRsuite-1.0/bin/prepare_receptor`. Then you can convert your pdb with: + +.. code-block:: bash + + /Users/klimt/ADFRsuite-1.0/bin/prepare_receptor -r your_protein.pdb -o your_protein.pdbqt + +Check `here `_ for more information. + +Getting box information +~~~~~~~~~~~~~~~~~~~~~~~ + +To perform the docking you must provide ``boxcenter`` and ``boxsize`` to the cost functions defined in :mod:`moldrug.fitness` For that two PyMol plugins are useful: `GetBox `_ and/or `autodock `_. Details of their installation and use are not discussed here, please visit their corresponding repositories for more information. Work with a docker container ---------------------------- #. Use the `Docker configuration file on GitHub `__. -#. Vist the `MolDrug `__ docker container. +#. Visit the `MolDrug `__ docker container. Finally ``pip install moldrug`` inside it. diff --git a/src/moldrug/utils.py b/src/moldrug/utils.py index 3793855..ec42cc5 100644 --- a/src/moldrug/utils.py +++ b/src/moldrug/utils.py @@ -1225,8 +1225,8 @@ class GA: The list of average cost for each generations. """ def __init__(self, seed_mol: Union[Chem.rdchem.Mol, Iterable[Chem.rdchem.Mol]], - costfunc: object, costfunc_kwargs: Dict, crem_db_path: str, maxiter: int, popsize: int, - beta: float = 0.001, pc: float = 1, get_similar: bool = False, mutate_crem_kwargs: Dict = None, + costfunc: object, costfunc_kwargs: Dict, crem_db_path: str, maxiter: int = 10, popsize: int = 20, + beta: float = 0.001, pc: float = 1, get_similar: bool = False, mutate_crem_kwargs: Union[None, Dict] = None, save_pop_every_gen: int = 0, checkpoint: bool = False, deffnm: str = 'ga', AddHs: bool = False, randomseed: Union[None, int] = None) -> None: """Constructor @@ -1242,17 +1242,17 @@ def __init__(self, seed_mol: Union[Chem.rdchem.Mol, Iterable[Chem.rdchem.Mol]], The keyword arguments of the selected cost function crem_db_path : str Path to the CReM data base. - maxiter : int - Maximum number of iteration (or generation). - popsize : int - Population size. + maxiter : int, optional + Maximum number of iteration (or generation), by default 10. + popsize : int, optional + Population size, by default 20. beta : float, optional Selection pressure, by default 0.001 pc : float, optional Proportion of children, by default 1 get_similar : bool, optional If True the searching will be bias to similar molecules, by default False - mutate_crem_kwargs : Dict, optional + mutate_crem_kwargs : Union[None, Dict], optional Parameters for mutate_mol of CReM, by default {} save_pop_every_gen : int, optional Frequency to save the population, by default 0