Skip to content

Commit

Permalink
Merge pull request #41 from jvalegre/ddg_branch
Browse files Browse the repository at this point in the history
1. Update v1.1.1
  • Loading branch information
jvalegre authored Jul 31, 2024
2 parents 703d589 + 87f5909 commit f80ede8
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 46 deletions.
5 changes: 3 additions & 2 deletions docs/Examples/full_workflow/smiles_vaskas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Reproducibility warning

.. warning::

**Update to AQME v1.6.0 or higher to obtain fully reproducible results!** Otherwise, it may not be possible to exactly
reproduce the results due to subtle differences in the generated xTB descriptors (0.1% changes in most cases).
**Update to AQME v1.6.0 or higher to obtain fully reproducible results!** You can do it with :code:`pip install aqme --upgrade`.
Otherwise, it may not be possible to exactly reproduce the results due to subtle differences in the
generated xTB descriptors (0.1% changes in most cases).

Required inputs
+++++++++++++++
Expand Down
5 changes: 3 additions & 2 deletions docs/Examples/full_workflow/smiles_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Reproducibility warning

.. warning::

**Update to AQME v1.6.0 or higher to obtain fully reproducible results!** Otherwise, it may not be possible to exactly
reproduce the results due to subtle differences in the generated xTB descriptors (0.1% changes in most cases).
**Update to AQME v1.6.0 or higher to obtain fully reproducible results!** You can do it with :code:`pip install aqme --upgrade`.
Otherwise, it may not be possible to exactly reproduce the results due to subtle differences in the
generated xTB descriptors (0.1% changes in most cases).

Required inputs
+++++++++++++++
Expand Down
18 changes: 14 additions & 4 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,24 @@ it also works for other Python versions (i.e., 3.7, 3.9 and 3.11):
conda install -c conda-forge robert
pip install scikit-learn-intelex
**3.** Install GLib to avoid errors when creating the PDF report:
**3.** Update ROBERT to the latest version (do not skip this step!):

.. code-block:: shell
pip install robert --upgrade
**4.** Install GLib and mscorefonts to avoid errors when creating the PDF report:

.. code-block:: shell
conda install -c conda-forge glib
conda install -c conda-forge mscorefonts
.. warning::

In some computers, you might see lots of pop-up windows with errors when installing GLib. Just press "Accept" in all the windows and finish the process until you see "Done" in the terminal.

**4.** If the installation of steps 1-3 with conda-forge are too slow, users might install ROBERT using pip instead. Then, install the libraries required for report.py and the intelex accelerator (only if your system is compatible with intelex):
**(Alternative installation).** If the installation of steps 2-4 with conda-forge are too slow, users might install ROBERT using pip instead. Then, install the libraries required for report.py and the intelex accelerator (only if your system is compatible with intelex):

.. code-block:: shell
Expand Down Expand Up @@ -173,10 +180,13 @@ you can install `Miniconda with Python 3 <https://docs.conda.io/projects/minicon
**7.** Update ROBERT to the latest version (do not skip this step!) (:code:`pip install robert --upgrade`).


**8.** Go to the folder with your CSV database (using the "cd" command, i.e. :code:`cd C:/Users/test_robert`).
**8.** Install GLib and mscorefonts to avoid errors when creating the PDF report (:code:`conda install -c conda-forge glib` and :code:`conda install -c conda-forge mscorefonts`).


**9.** Go to the folder with your CSV database (using the "cd" command, i.e. :code:`cd C:/Users/test_robert`).


**9.** Run ROBERT as explained in the Examples section.
**10.** Run ROBERT as explained in the Examples section.

.. note-end
Expand Down
70 changes: 37 additions & 33 deletions robert/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def get_repro(self,modules):
citation_dat += f"""<p style="text-align: justify;"><br>{version_n_date}</p>
<p style="text-align: justify; margin-top: -8px;"><span style="font-weight:bold;">How to cite:</span> {citation}</p>"""

aqme_workflow = False
aqme_workflow,aqme_updated = False,True
crest_workflow = False
if '--aqme' in command_line:
original_command = command_line
Expand Down Expand Up @@ -442,30 +442,43 @@ def get_repro(self,modules):
repro_dat += f"""{reduced_line}{space}- External test set ({self.args.csv_test})</p>"""

if aqme_workflow:
repro_dat += f"""{reduced_line}{space}<i>Warning! SMILES workflows might not be reproduced exactly due to subtle changes in xTB descriptors (&plusmn;0.1%):</i></p>"""
repro_dat += f"""{reduced_line}{space}To obtain the same results, download the descriptor database (AQME-ROBERT_{self.args.csv_name}) and run:</p>"""
repro_line = []
original_command = original_command.replace(self.args.csv_name,f'AQME-ROBERT_{self.args.csv_name}')
for i,keyword in enumerate(original_command.split('"')):
if i == 0:
if '--aqme' not in keyword and '--qdescp_keywords' not in keyword and '--csearch_keywords' not in keyword:
repro_line.append(keyword)
else:
repro_line.append('python -m robert ')
if i > 0:
if '--qdescp_keywords' not in original_command.split('"')[i-1] and '--csearch_keywords' not in original_command.split('"')[i-1]:
if '--aqme' not in keyword and '--qdescp_keywords' not in keyword and '--csearch_keywords' not in keyword and keyword != '\n':
repro_line.append(keyword)
repro_line = '"'.join(repro_line)
repro_line += '"'
if '--names ' not in repro_line:
repro_line += ' --names "code_name"'
repro_line = f'{reduced_line}{space}- Run: {repro_line}'
repro_line = format_lines(repro_line,cmd_line=True)
repro_dat += f"""{reduced_line}{repro_line}</p>"""

if aqme_workflow:
try:
path_aqme = Path(f'{os.getcwd()}/AQME/CSEARCH_data.dat')
datfile = open(path_aqme, 'r', errors="replace")
outlines = datfile.readlines()
aqme_version = outlines[0].split()[2]
datfile.close()
find_aqme = True
except:
find_aqme = False
aqme_version = '0.0' # dummy number
if int(aqme_version.split('.')[0]) in [0,1] and int(aqme_version.split('.')[1]) < 6:
aqme_updated = False
repro_dat += f"""{reduced_line}{space}<i>Warning! This workflow might not be exactly reproducible, update to AQME v1.6.0+ (pip install aqme --upgrade)</i></p>"""
repro_dat += f"""{reduced_line}{space}To obtain the same results, download the descriptor database (AQME-ROBERT_{self.args.csv_name}) and run:</p>"""
repro_line = []
original_command = original_command.replace(self.args.csv_name,f'AQME-ROBERT_{self.args.csv_name}')
for i,keyword in enumerate(original_command.split('"')):
if i == 0:
if '--aqme' not in keyword and '--qdescp_keywords' not in keyword and '--csearch_keywords' not in keyword:
repro_line.append(keyword)
else:
repro_line.append('python -m robert ')
if i > 0:
if '--qdescp_keywords' not in original_command.split('"')[i-1] and '--csearch_keywords' not in original_command.split('"')[i-1]:
if '--aqme' not in keyword and '--qdescp_keywords' not in keyword and '--csearch_keywords' not in keyword and keyword != '\n':
repro_line.append(keyword)
repro_line = '"'.join(repro_line)
repro_line += '"'
if '--names ' not in repro_line:
repro_line += ' --names "code_name"'
repro_line = f'{reduced_line}{space}- Run: {repro_line}'
repro_line = format_lines(repro_line,cmd_line=True)
repro_dat += f"""{reduced_line}{repro_line}</p>"""

if aqme_workflow and not aqme_updated:
# I use a very reduced line in this title because the formatted command_line comes with an extra blank line
# (if AQME is not updated the PDF contains a reproducibility warning)
repro_dat += f"""<p style="text-align: justify; margin-top: -44px;"><br><strong>2. Install and adjust the versions of the following Python modules:</strong></p>"""
else:
repro_dat += f"""{first_line}<br><strong>2. Install and adjust the versions of the following Python modules:</strong></p>"""
Expand All @@ -480,15 +493,6 @@ def get_repro(self,modules):
repro_dat += f"""{reduced_line}{space}<i>(if scikit-learn-intelex is installed, slightly different results might be obtained)</i></p>"""

if aqme_workflow:
try:
path_aqme = Path(f'{os.getcwd()}/AQME/CSEARCH_data.dat')
datfile = open(path_aqme, 'r', errors="replace")
outlines = datfile.readlines()
aqme_version = outlines[0].split()[2]
datfile.close()
find_aqme = True
except:
find_aqme = False
if not find_aqme:
repro_dat += f"""{reduced_line}{space}- AQME is required, but no version was found:</p>"""
repro_dat += f"""{reduced_line}{space}- Install AQME and its dependencies: conda install -c conda-forge aqme</p>"""
Expand Down
4 changes: 3 additions & 1 deletion robert/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import warnings # this avoids warnings from sklearn
warnings.filterwarnings("ignore")

robert_version = "1.1.0"
robert_version = "1.1.1"
time_run = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())
robert_ref = "Dalmau, D.; Alegre Requena, J. V. ChemRxiv, 2023, DOI: 10.26434/chemrxiv-2023-k994h"

Expand Down Expand Up @@ -1047,6 +1047,8 @@ def calc_ci_n_sd(self,loaded_model,data,set_mapie):
# Check if 1/alpha is lower than the number of samples
if 1 / self.args.alpha >= len(data[f'X_{set_mapie}_scaled']):
self.args.alpha = 0.1
if 1 / self.args.alpha >= len(data[f'X_{set_mapie}_scaled']):
self.args.alpha = 0.5

# Predict test set and obtain prediction intervals
y_pred, y_pis = mapie.predict(data[f'X_{set_mapie}_scaled'], alpha=[self.args.alpha])
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from setuptools import setup, find_packages
version="1.1.0"
version="1.1.1"
setup(
name="robert",
packages=find_packages(exclude=["tests"]),
Expand Down Expand Up @@ -33,16 +33,16 @@
],
install_requires=[
"PyYAML",
"matplotlib>=3.7,<3.8",
"pandas==2.2.2",
"progress",
"numpy==1.26.4",
"matplotlib>=3.7,<3.8",
"progress",
"seaborn",
"scipy",
"scikit-learn==1.5.1", # fixed to make ROBERT reproducible when using the same version
"hyperopt",
"numba==0.60.0",
"shap==0.46.0",
"shap==0.45.1",
"mapie==0.8.6"
# requires also "conda install -c conda-forge gtk3 glib weasyprint pango" for report.py
# optionally, the intelex accelerator might be installed "pip install scikit-learn-intelex"
Expand Down

0 comments on commit f80ede8

Please sign in to comment.