Skip to content

Commit

Permalink
Merge pull request #15 from TieuLongPhan/main
Browse files Browse the repository at this point in the history
v0.0.5
  • Loading branch information
klausweinbauer authored Apr 11, 2024
2 parents 0b99c74 + 2e23e6c commit fb097cc
Show file tree
Hide file tree
Showing 105 changed files with 275 additions and 146 deletions.
Binary file removed .DS_Store
Binary file not shown.
166 changes: 158 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,168 @@
.DS_Store
*.pyc
.vscode

.DS_Store
.jukit/


venv/
*.pdf
.coverage
tmp/
out/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

Data/Validation_set/validation_set_result.csv
Data/Run/
# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
6 changes: 3 additions & 3 deletions Docs/Paper_fig/figures.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matplotlib.pyplot as plt

from SynRBL.SynVis import ReactionVisualizer
from SynRBL.rsmi_utils import load_database
from SynRBL.SynUtils.chem_utils import remove_atom_mapping
from synrbl.SynVis import ReactionVisualizer
from synrbl.rsmi_utils import load_database
from synrbl.SynUtils.chem_utils import remove_atom_mapping


def clear_atom_nums(dataset):
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ To install and set up the SynRBL framework, follow these steps. Please ensure yo
After installation, you can verify that SynRBL is correctly installed by running a simple test or checking the package version.

```python
python -c "import SynRBL; print(SynRBL.__version__)"
python -c "import synrbl; print(synrbl.__version__)"
```

## Usage

```python
from SynRBL import SynRBL
from synrbl import Balancer
```


Expand Down
4 changes: 2 additions & 2 deletions Scripts/result_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import rdkit.Chem.rdChemReactions as rdChemReactions
import rdkit.Chem.Draw.rdMolDraw2D as rdMolDraw2D
from PIL import Image
from SynRBL.SynUtils.chem_utils import normalize_smiles, remove_atom_mapping
from synrbl.SynUtils.chem_utils import normalize_smiles, remove_atom_mapping

import Scripts.validation_set_interface as db
import scripts.validation_set_interface as db


def get_reaction_img(smiles):
Expand Down
4 changes: 2 additions & 2 deletions synrbl_pilot.py → Scripts/synrbl_pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os
import logging
import traceback
from SynRBL import Balancer
from SynRBL.rsmi_utils import load_database, save_database
from synrbl import Balancer
from synrbl.rsmi_utils import load_database, save_database


def setup_logging(log_file=None):
Expand Down
2 changes: 1 addition & 1 deletion Scripts/validation_set_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import pandas as pd

from SynRBL.SynUtils.chem_utils import normalize_smiles
from synrbl.SynUtils.chem_utils import normalize_smiles

_FILE_NAME = "dataset"

Expand Down
2 changes: 1 addition & 1 deletion Test/SynChemImputer/test_appeal_reaction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from SynRBL.SynChemImputer.appel_reaction import (
from synrbl.SynChemImputer.appel_reaction import (
AppelReaction,
) # Make sure to import your class correctly

Expand Down
2 changes: 1 addition & 1 deletion Test/SynChemImputer/test_peroxide_imputer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from SynRBL.SynChemImputer.peroxide_imputer import (
from synrbl.SynChemImputer.peroxide_imputer import (
PeroxidGroupImputer,
) # Replace with the actual module name

Expand Down
2 changes: 1 addition & 1 deletion Test/SynMCSImputer/MissingGraph/test_find_graph_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from rdkit import Chem
from SynRBL.SynMCSImputer.MissingGraph.find_graph_dict import (
from synrbl.SynMCSImputer.MissingGraph.find_graph_dict import (
find_single_graph,
find_single_graph_parallel,
convert_smiles_to_mols,
Expand Down
4 changes: 2 additions & 2 deletions Test/SynMCSImputer/MissingGraph/test_find_missing_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import copy

from rdkit import Chem
from SynRBL.SynMCSImputer.SubStructure.substructure_analyzer import SubstructureAnalyzer
from SynRBL.SynMCSImputer.MissingGraph.find_missing_graphs import FindMissingGraphs
from synrbl.SynMCSImputer.SubStructure.substructure_analyzer import SubstructureAnalyzer
from synrbl.SynMCSImputer.MissingGraph.find_missing_graphs import FindMissingGraphs


class TestFindMissingGraphs(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Test/SynMCSImputer/MissingGraph/test_molcurator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from rdkit import Chem

from SynRBL.SynMCSImputer.MissingGraph.molcurator import MoleculeCurator
from synrbl.SynMCSImputer.MissingGraph.molcurator import MoleculeCurator


class TestMoleculeCurator(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Test/SynMCSImputer/MissingGraph/test_uncertainty_graph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from SynRBL.SynMCSImputer.MissingGraph.uncertainty_graph import GraphMissingUncertainty
from synrbl.SynMCSImputer.MissingGraph.uncertainty_graph import GraphMissingUncertainty


class TestGraphMissingUncertainty(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Test/SynMCSImputer/SubStructure/test_extract_common_mcs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from SynRBL.SynMCSImputer.SubStructure.extract_common_mcs import ExtractMCS
from synrbl.SynMCSImputer.SubStructure.extract_common_mcs import ExtractMCS


class TestExtractMCS(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Test/SynMCSImputer/SubStructure/test_mcs_graph_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from rdkit import Chem

from SynRBL.SynMCSImputer.SubStructure.mcs_graph_detector import MCSMissingGraphAnalyzer
from synrbl.SynMCSImputer.SubStructure.mcs_graph_detector import MCSMissingGraphAnalyzer


class TestMCSMissingGraphAnalyzer(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions Test/SynMCSImputer/SubStructure/test_mcs_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

from unittest.mock import patch
from SynRBL.SynMCSImputer.SubStructure.mcs_process import single_mcs
from synrbl.SynMCSImputer.SubStructure.mcs_process import single_mcs


class TestMCSFunctions(unittest.TestCase):
Expand All @@ -26,7 +26,7 @@ def setUp(self):
]

@patch(
"SynRBL.SynMCSImputer.SubStructure.mcs_graph_detector.MCSMissingGraphAnalyzer.fit"
"synrbl.SynMCSImputer.SubStructure.mcs_graph_detector.MCSMissingGraphAnalyzer.fit"
)
def test_single_mcs(self, mock_fit):
# Mocking MCSMissingGraphAnalyzer.fit to return predefined values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from SynRBL.SynMCSImputer.SubStructure.substructure_analyzer import SubstructureAnalyzer
from synrbl.SynMCSImputer.SubStructure.substructure_analyzer import SubstructureAnalyzer
from rdkit import Chem


Expand Down
10 changes: 5 additions & 5 deletions Test/SynMCSImputer/test_merge.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest
import unittest.mock as mock

import SynRBL.SynMCSImputer.merge as merge
from SynRBL.SynMCSImputer.structure import Compound, CompoundSet
import synrbl.SynMCSImputer.merge as merge
from synrbl.SynMCSImputer.structure import Compound, CompoundSet


class DummyMergeRule:
Expand All @@ -28,7 +28,7 @@ def apply(self):


class TestMergeBoundary(unittest.TestCase):
@mock.patch("SynRBL.SynMCSImputer.merge.MergeRule")
@mock.patch("synrbl.SynMCSImputer.merge.MergeRule")
def test_no_rule_found(self, m_MergeRule):
rule = mock.MagicMock()
rule.can_apply.return_value = False
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_phosphor_bond3(self):


class TestExpansion(unittest.TestCase):
@mock.patch("SynRBL.SynMCSImputer.merge.ExpandRule")
@mock.patch("synrbl.SynMCSImputer.merge.ExpandRule")
def test_simple_expansion(self, m_ExpandRule):
m_ExpandRule.get_all = mock.MagicMock(return_value=[DummyExpandRule()])
c = Compound("C")
Expand All @@ -98,7 +98,7 @@ def test_simple_expansion(self, m_ExpandRule):
self.assertEqual("O", cm.smiles) # type: ignore
self.assertEqual(1, len(cm.boundaries)) # type: ignore

@mock.patch("SynRBL.SynMCSImputer.merge.ExpandRule")
@mock.patch("synrbl.SynMCSImputer.merge.ExpandRule")
def test_rule_apply_check(self, m_ExpandRule):
m_ExpandRule.get_all = mock.MagicMock(
return_value=[
Expand Down
Loading

0 comments on commit fb097cc

Please sign in to comment.