From a72fadca6d5551457c4e5cbe2740b40eeec2ce8b Mon Sep 17 00:00:00 2001 From: TieuLongPhan Date: Mon, 15 Apr 2024 12:43:29 +0200 Subject: [PATCH] fix bug and update readme --- README.md | 47 ++++++++--------------------------- synrbl/SynUtils/chem_utils.py | 3 ++- synrbl/SynVis/rxnpdf.py | 1 + 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 5903b88..1853ee1 100644 --- a/README.md +++ b/README.md @@ -6,41 +6,12 @@ SynRBL is a toolkit tailored for computational chemistry, aimed at correcting im ## Table of Contents -- [Repository Structure](#repository-structure) - [Installation](#installation) - [Usage](#usage) - [Contributing](#contributing) - [License](#license) - [Acknowledgments](#acknowledgments) -## Repository Structure - -SynRBL is organized into several key components, each dedicated to a specific aspect of chemical data processing: - -### Main Components - -- `SynRBL/`: Main package directory - - `SynProcessor/`: Data processing module - - `SynRuleImputer/`: Rule-based imputation module - - `SynMCSImputer/`: MCS-based imputation module - - `SynChemImputer/`: MCS-based imputation module - - `SynVis/`: Data visualization module - -### Test Suite - -- `tests/`: Test scripts and related files - - `SynProcessor/`: Tests for SynExtract module - - `SynRuleImputer/`: Tests for SynRuleImpute module - - `SynMCSImputer/`: Tests for MCS-based imputation module - - `SynChemImputer/`: Tests for MCS-based imputation module - - `SynVis/`: Tests for SynVis module - -### Additional Resources - -- `License`: License document -- `README.md`: Overview and documentation -- `setup.py`: Installation -- `.gitignore`: Configuration for ignoring certain files and directories ## Installation @@ -77,13 +48,11 @@ To install and set up the SynRBL framework, follow these steps. Please ensure yo conda activate synrbl-env ``` -3. **Cloning and Installing SynRBL:** +3. **Install with pip:** Clone the SynRBL repository from GitHub and install it: ```bash - git clone https://github.com/TieuLongPhan/SynRBL.git - cd SynRBL - pip install . + pip install synrbl ``` 4. **Verify Installation:** @@ -94,13 +63,19 @@ To install and set up the SynRBL framework, follow these steps. Please ensure yo ``` ## Usage - +1. **Jupyter Notebook:** ```python from synrbl import Balancer ``` +2. **Command line** + ```bash + python -m synrbl run --help + ``` - -TODO +3. **Reproduce the experiment** + ```bash + python -m synrbl run -o validation_results.csv -p 4 ./Data/Validation_set/validation_set.csv + ``` ## Contributing - [Tieu-Long Phan](https://tieulongphan.github.io/) diff --git a/synrbl/SynUtils/chem_utils.py b/synrbl/SynUtils/chem_utils.py index b5e797a..1d3bc45 100644 --- a/synrbl/SynUtils/chem_utils.py +++ b/synrbl/SynUtils/chem_utils.py @@ -7,6 +7,7 @@ import rdkit.Chem.AllChem as AllChem import rdkit.Chem.rdmolfiles as rdmolfiles + from typing import List, Dict from typing import Union @@ -202,7 +203,7 @@ def _fp(mol1, mol2): fp2 = ffpgen.GetSparseCountFingerprint(mol2) sim = DataStructs.DiceSimilarity(fp1, fp2) else: - raise ArgumentError("'{}' is not a valid similarity method.".format(method)) + raise ValueError("'{}' is not a valid similarity method.".format(method)) return sim exp = normalize_smiles(expected_smiles) diff --git a/synrbl/SynVis/rxnpdf.py b/synrbl/SynVis/rxnpdf.py index a6edc59..d966d61 100644 --- a/synrbl/SynVis/rxnpdf.py +++ b/synrbl/SynVis/rxnpdf.py @@ -8,6 +8,7 @@ from reportlab.lib.pagesizes import landscape, letter from synrbl.SynVis.reaction_visualizer import ReactionVisualizer + def save_reactions_to_pdf( data: List[Dict[str, str]], old_reaction_col: str,