pyopsin 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyopsin-0.2.4/MANIFEST.in +1 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/PKG-INFO +1 -1
- pyopsin-0.2.4/pyopsin/__init__.py +2 -0
- pyopsin-0.2.4/pyopsin/opsin_cli.jar +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin/pyopsin.py +13 -4
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/PKG-INFO +1 -1
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/SOURCES.txt +2 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/setup.py +2 -1
- pyopsin-0.2.2/pyopsin/__init__.py +0 -2
- {pyopsin-0.2.2 → pyopsin-0.2.4}/LICENSE +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/README.md +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/dependency_links.txt +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/entry_points.txt +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/requires.txt +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/pyopsin.egg-info/top_level.txt +0 -0
- {pyopsin-0.2.2 → pyopsin-0.2.4}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include pyopsin/opsin_cli.jar
|
|
Binary file
|
|
@@ -12,6 +12,7 @@ class PyOpsin:
|
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
def __init__(self, path: str = None,
|
|
15
|
+
exit_on_error: bool = True,
|
|
15
16
|
allowUninterpretableStereo: bool = False,
|
|
16
17
|
allowRadicals: bool = False,
|
|
17
18
|
wildcardRadicals: bool = False,
|
|
@@ -28,6 +29,8 @@ class PyOpsin:
|
|
|
28
29
|
Raises:
|
|
29
30
|
FileNotFoundError: No opsin cli .jar file was found.
|
|
30
31
|
"""
|
|
32
|
+
|
|
33
|
+
self.exit_on_error = exit_on_error
|
|
31
34
|
|
|
32
35
|
if not path:
|
|
33
36
|
path = resource_filename(__name__, "opsin_cli.jar")
|
|
@@ -77,7 +80,6 @@ class PyOpsin:
|
|
|
77
80
|
raise ValueError(
|
|
78
81
|
"Input name must be a string or a list of strings.")
|
|
79
82
|
|
|
80
|
-
|
|
81
83
|
def to_smiles_single(self, name: str) -> str:
|
|
82
84
|
"""compute a single SMILES of a molecule for its IUPAC name
|
|
83
85
|
|
|
@@ -87,9 +89,16 @@ class PyOpsin:
|
|
|
87
89
|
Returns:
|
|
88
90
|
str: SMILES of the molecule
|
|
89
91
|
"""
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
try:
|
|
93
|
+
results = self.nts.parseChemicalName(name, self.config)
|
|
94
|
+
except Exception as e:
|
|
95
|
+
if self.exit_on_error:
|
|
96
|
+
raise ValueError(f"Failed to parse the name: {name} due to exception {e}") from e
|
|
97
|
+
else:
|
|
98
|
+
print(f"Failed to parse the name: {name} due to exception {e}")
|
|
99
|
+
return None
|
|
100
|
+
smiles = results.getSmiles()
|
|
101
|
+
return str(smiles) if smiles else None
|
|
93
102
|
|
|
94
103
|
def to_cml(self, name: str) -> str:
|
|
95
104
|
"""compute CML of a molecule from its IUPAC name
|
|
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name='pyopsin',
|
|
9
|
-
version='0.2.
|
|
9
|
+
version='0.2.4',
|
|
10
10
|
author='Dingyun Huang',
|
|
11
11
|
author_email='dh582@cam.ac.uk',
|
|
12
12
|
description='A simple python wrapper for OPSIN: Open Parser for Systematic IUPAC nomenclature.',
|
|
@@ -14,6 +14,7 @@ setup(
|
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
15
15
|
url="https://github.com/Dingyun-Huang/pyopsin",
|
|
16
16
|
packages=setuptools.find_packages(),
|
|
17
|
+
include_package_data=True,
|
|
17
18
|
python_requires='>=3.9',
|
|
18
19
|
install_requires=[
|
|
19
20
|
'jpype1>=1.2.0',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|