pymetadata 0.4.1__tar.gz → 0.4.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.

Potentially problematic release.


This version of pymetadata might be problematic. Click here for more details.

Files changed (50) hide show
  1. {pymetadata-0.4.1/src/pymetadata.egg-info → pymetadata-0.4.4}/PKG-INFO +45 -38
  2. {pymetadata-0.4.1 → pymetadata-0.4.4}/README.rst +31 -23
  3. {pymetadata-0.4.1 → pymetadata-0.4.4}/setup.cfg +16 -17
  4. {pymetadata-0.4.1 → pymetadata-0.4.4}/setup.py +1 -1
  5. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/__init__.py +2 -2
  6. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/cache.py +1 -0
  7. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/chebi.py +11 -6
  8. pymetadata-0.4.4/src/pymetadata/examples/cache_path_example.py +15 -0
  9. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/identifiers/registry.py +5 -20
  10. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/metadata/kisao.py +10 -0
  11. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/omex.py +1 -1
  12. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/ontologies/ols.py +14 -12
  13. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/ontologies/ontology.py +1 -1
  14. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/unichem.py +21 -17
  15. {pymetadata-0.4.1 → pymetadata-0.4.4/src/pymetadata.egg-info}/PKG-INFO +45 -38
  16. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata.egg-info/SOURCES.txt +1 -1
  17. pymetadata-0.4.4/src/pymetadata.egg-info/requires.txt +22 -0
  18. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_unichem.py +2 -2
  19. pymetadata-0.4.1/src/pymetadata/resources/identifiers_registry.json +0 -45888
  20. pymetadata-0.4.1/src/pymetadata.egg-info/requires.txt +0 -23
  21. {pymetadata-0.4.1 → pymetadata-0.4.4}/LICENSE +0 -0
  22. {pymetadata-0.4.1 → pymetadata-0.4.4}/MANIFEST.in +0 -0
  23. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/console.py +0 -0
  24. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/core/__init__.py +0 -0
  25. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/core/annotation.py +0 -0
  26. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/core/creator.py +0 -0
  27. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/core/synonym.py +0 -0
  28. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/core/xref.py +0 -0
  29. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/examples/__init__.py +0 -0
  30. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/examples/omex_example.py +0 -0
  31. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/identifiers/__init__.py +0 -0
  32. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/identifiers/miriam.py +0 -0
  33. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/log.py +0 -0
  34. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/metadata/__init__.py +0 -0
  35. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/metadata/eco.py +0 -0
  36. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/metadata/sbo.py +0 -0
  37. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/omex_v2.py +0 -0
  38. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/ontologies/__init__.py +0 -0
  39. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/py.typed +0 -0
  40. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/resources/chebi_webservice_wsdl.xml +0 -0
  41. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata/resources/templates/ontology_enum.pytemplate +0 -0
  42. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata.egg-info/dependency_links.txt +0 -0
  43. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata.egg-info/top_level.txt +0 -0
  44. {pymetadata-0.4.1 → pymetadata-0.4.4}/src/pymetadata.egg-info/zip-safe +0 -0
  45. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_chebi.py +0 -0
  46. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_ols.py +0 -0
  47. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_omex.py +0 -0
  48. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_ontology.py +0 -0
  49. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_registry.py +0 -0
  50. {pymetadata-0.4.1 → pymetadata-0.4.4}/tests/test_sbo_kisao.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymetadata
3
- Version: 0.4.1
3
+ Version: 0.4.4
4
4
  Summary: pymetadata are python utilities for working with metadata.
5
5
  Home-page: https://github.com/matthiaskoenig/pymetadata
6
6
  Download-URL: https://pypi.org/project/pymetadata
@@ -28,27 +28,26 @@ Requires-Python: >=3.9
28
28
  Description-Content-Type: text/x-rst
29
29
  License-File: LICENSE
30
30
  Requires-Dist: depinfo>=1.7
31
- Requires-Dist: uuid>=1.30
32
- Requires-Dist: lxml>=4.9
33
- Requires-Dist: rich>=13.6
31
+ Requires-Dist: lxml>=5.2
32
+ Requires-Dist: rich>=13.7
34
33
  Requires-Dist: requests>=2.31
35
34
  Requires-Dist: zeep>=4.2.1
36
- Requires-Dist: pronto>=2.5.5
37
- Requires-Dist: fastobo>=0.12.2
38
- Requires-Dist: jinja2>=3.1.2
35
+ Requires-Dist: pronto>=2.5.6
36
+ Requires-Dist: fastobo>=0.12.3
37
+ Requires-Dist: jinja2>=3.1
39
38
  Requires-Dist: xmltodict>=0.13.0
40
- Requires-Dist: pydantic>=2.4
39
+ Requires-Dist: pydantic>=2.6
41
40
  Provides-Extra: development
42
- Requires-Dist: pip-tools>6.10; extra == "development"
43
- Requires-Dist: black>=24.1.1; extra == "development"
41
+ Requires-Dist: pip-tools>=7.4.1; extra == "development"
42
+ Requires-Dist: black>=24.3.0; extra == "development"
44
43
  Requires-Dist: bump2version>=1.0.1; extra == "development"
45
44
  Requires-Dist: isort>=5.13.2; extra == "development"
46
- Requires-Dist: tox>=4.12.1; extra == "development"
47
- Requires-Dist: flake8>=6.1.0; extra == "development"
45
+ Requires-Dist: tox>=4.12.2; extra == "development"
46
+ Requires-Dist: flake8>=7.0.0; extra == "development"
48
47
  Requires-Dist: flake8-mypy>=17.8.0; extra == "development"
49
- Requires-Dist: mypy>=1.8.0; extra == "development"
50
- Requires-Dist: pytest>=8.0.0; extra == "development"
51
- Requires-Dist: pytest-cov>=4.1.0; extra == "development"
48
+ Requires-Dist: mypy>=1.9.0; extra == "development"
49
+ Requires-Dist: pytest>=8.1.1; extra == "development"
50
+ Requires-Dist: pytest-cov>=5.0.0; extra == "development"
52
51
 
53
52
  .. image:: https://github.com/matthiaskoenig/pymetadata/raw/develop/docs/images/favicon/pymetadata-100x100-300dpi.png
54
53
  :align: left
@@ -56,36 +55,28 @@ Requires-Dist: pytest-cov>=4.1.0; extra == "development"
56
55
 
57
56
  pymetadata: python utilities for metadata and COMBINE archives
58
57
  ==============================================================
58
+ |icon1| |icon2| |icon3| |icon4| |icon5| |icon6| |icon7|
59
59
 
60
- .. image:: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD/badge.svg
60
+
61
+ .. |icon1| image:: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD/badge.svg
61
62
  :target: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD
62
63
  :alt: GitHub Actions CI/CD Status
63
-
64
- .. image:: https://img.shields.io/pypi/v/pymetadata.svg
64
+ .. |icon2| image:: https://img.shields.io/pypi/v/pymetadata.svg
65
65
  :target: https://pypi.org/project/pymetadata/
66
66
  :alt: Current PyPI Version
67
-
68
- .. image:: https://img.shields.io/pypi/pyversions/pymetadata.svg
67
+ .. |icon3| image:: https://img.shields.io/pypi/pyversions/pymetadata.svg
69
68
  :target: https://pypi.org/project/pymetadata/
70
69
  :alt: Supported Python Versions
71
-
72
- .. image:: https://img.shields.io/pypi/l/pymetadata.svg
70
+ .. |icon4| image:: https://img.shields.io/pypi/l/pymetadata.svg
73
71
  :target: http://opensource.org/licenses/LGPL-3.0
74
72
  :alt: GNU Lesser General Public License 3
75
-
76
- .. image:: https://codecov.io/gh/matthiaskoenig/pymetadata/branch/develop/graph/badge.svg
77
- :target: https://codecov.io/gh/matthiaskoenig/pymetadata
78
- :alt: Codecov
79
-
80
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg
73
+ .. |icon5| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg
81
74
  :target: https://doi.org/10.5281/zenodo.5308801
82
75
  :alt: Zenodo DOI
83
-
84
- .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
76
+ .. |icon6| image:: https://img.shields.io/badge/code%20style-black-000000.svg
85
77
  :target: https://github.com/ambv/black
86
78
  :alt: Black
87
-
88
- .. image:: http://www.mypy-lang.org/static/mypy_badge.svg
79
+ .. |icon7| image:: http://www.mypy-lang.org/static/mypy_badge.svg
89
80
  :target: http://mypy-lang.org/
90
81
  :alt: mypy
91
82
 
@@ -140,11 +131,14 @@ PARTICULAR PURPOSE. See the GNU General Public License for more details.
140
131
 
141
132
  Funding
142
133
  =======
143
- Matthias König is supported by the Federal Ministry of Education and Research (BMBF, Germany)
144
- within the research network Systems Medicine of the Liver (**LiSyM**, grant number 031L0054)
145
- and by the German Research Foundation (DFG) within the Research Unit Programme FOR 5151
146
- "`QuaLiPerF <https://qualiperf.de>`__ (Quantifying Liver Perfusion-Function Relationship in Complex Resection -
147
- A Systems Medicine Approach)" by grant number 436883643 and by grant number 465194077 (Priority Programme SPP 2311, Subproject SimLivA).
134
+ Matthias König (MK) was supported by the Federal Ministry of Education and Research
135
+ (BMBF, Germany) within the research network Systems Medicine of the Liver
136
+ (**LiSyM**, grant number 031L0054). MK is supported by the Federal Ministry of
137
+ Education and Research (BMBF, Germany) within ATLAS by grant number 031L0304B and
138
+ by the German Research Foundation (DFG) within the Research Unit Program FOR 5151
139
+ QuaLiPerF (Quantifying Liver Perfusion-Function Relationship in Complex Resection
140
+ - A Systems Medicine Approach) by grant number 436883643 and by grant number
141
+ 465194077 (Priority Programme SPP 2311, Subproject SimLivA).
148
142
 
149
143
  Installation
150
144
  ============
@@ -165,8 +159,21 @@ Or via cloning the repository and installing via::
165
159
  cd pymetadata
166
160
  pip install -e .
167
161
 
162
+
168
163
  To install for development use::
169
164
 
170
165
  pip install -e .[development]
171
166
 
172
- © 2021-2022 Matthias König
167
+
168
+ Cache path
169
+ ==========
170
+ `pymetadata` caches some information for faster retrieval. The cache path is set to::
171
+
172
+ CACHE_PATH: Path = Path.home() / ".cache" / "pymetadata"
173
+
174
+ To use a custom cache path use::
175
+
176
+ import pymetadata
177
+ pymetadata.CACHE_PATH = <cache_path>
178
+
179
+ © 2021-2024 Matthias König
@@ -4,36 +4,28 @@
4
4
 
5
5
  pymetadata: python utilities for metadata and COMBINE archives
6
6
  ==============================================================
7
+ |icon1| |icon2| |icon3| |icon4| |icon5| |icon6| |icon7|
7
8
 
8
- .. image:: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD/badge.svg
9
+
10
+ .. |icon1| image:: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD/badge.svg
9
11
  :target: https://github.com/matthiaskoenig/pymetadata/workflows/CI-CD
10
12
  :alt: GitHub Actions CI/CD Status
11
-
12
- .. image:: https://img.shields.io/pypi/v/pymetadata.svg
13
+ .. |icon2| image:: https://img.shields.io/pypi/v/pymetadata.svg
13
14
  :target: https://pypi.org/project/pymetadata/
14
15
  :alt: Current PyPI Version
15
-
16
- .. image:: https://img.shields.io/pypi/pyversions/pymetadata.svg
16
+ .. |icon3| image:: https://img.shields.io/pypi/pyversions/pymetadata.svg
17
17
  :target: https://pypi.org/project/pymetadata/
18
18
  :alt: Supported Python Versions
19
-
20
- .. image:: https://img.shields.io/pypi/l/pymetadata.svg
19
+ .. |icon4| image:: https://img.shields.io/pypi/l/pymetadata.svg
21
20
  :target: http://opensource.org/licenses/LGPL-3.0
22
21
  :alt: GNU Lesser General Public License 3
23
-
24
- .. image:: https://codecov.io/gh/matthiaskoenig/pymetadata/branch/develop/graph/badge.svg
25
- :target: https://codecov.io/gh/matthiaskoenig/pymetadata
26
- :alt: Codecov
27
-
28
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg
22
+ .. |icon5| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg
29
23
  :target: https://doi.org/10.5281/zenodo.5308801
30
24
  :alt: Zenodo DOI
31
-
32
- .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
25
+ .. |icon6| image:: https://img.shields.io/badge/code%20style-black-000000.svg
33
26
  :target: https://github.com/ambv/black
34
27
  :alt: Black
35
-
36
- .. image:: http://www.mypy-lang.org/static/mypy_badge.svg
28
+ .. |icon7| image:: http://www.mypy-lang.org/static/mypy_badge.svg
37
29
  :target: http://mypy-lang.org/
38
30
  :alt: mypy
39
31
 
@@ -88,11 +80,14 @@ PARTICULAR PURPOSE. See the GNU General Public License for more details.
88
80
 
89
81
  Funding
90
82
  =======
91
- Matthias König is supported by the Federal Ministry of Education and Research (BMBF, Germany)
92
- within the research network Systems Medicine of the Liver (**LiSyM**, grant number 031L0054)
93
- and by the German Research Foundation (DFG) within the Research Unit Programme FOR 5151
94
- "`QuaLiPerF <https://qualiperf.de>`__ (Quantifying Liver Perfusion-Function Relationship in Complex Resection -
95
- A Systems Medicine Approach)" by grant number 436883643 and by grant number 465194077 (Priority Programme SPP 2311, Subproject SimLivA).
83
+ Matthias König (MK) was supported by the Federal Ministry of Education and Research
84
+ (BMBF, Germany) within the research network Systems Medicine of the Liver
85
+ (**LiSyM**, grant number 031L0054). MK is supported by the Federal Ministry of
86
+ Education and Research (BMBF, Germany) within ATLAS by grant number 031L0304B and
87
+ by the German Research Foundation (DFG) within the Research Unit Program FOR 5151
88
+ QuaLiPerF (Quantifying Liver Perfusion-Function Relationship in Complex Resection
89
+ - A Systems Medicine Approach) by grant number 436883643 and by grant number
90
+ 465194077 (Priority Programme SPP 2311, Subproject SimLivA).
96
91
 
97
92
  Installation
98
93
  ============
@@ -113,8 +108,21 @@ Or via cloning the repository and installing via::
113
108
  cd pymetadata
114
109
  pip install -e .
115
110
 
111
+
116
112
  To install for development use::
117
113
 
118
114
  pip install -e .[development]
119
115
 
120
- © 2021-2022 Matthias König
116
+
117
+ Cache path
118
+ ==========
119
+ `pymetadata` caches some information for faster retrieval. The cache path is set to::
120
+
121
+ CACHE_PATH: Path = Path.home() / ".cache" / "pymetadata"
122
+
123
+ To use a custom cache path use::
124
+
125
+ import pymetadata
126
+ pymetadata.CACHE_PATH = <cache_path>
127
+
128
+ © 2021-2024 Matthias König
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.4.1
2
+ current_version = 0.4.4
3
3
  commit = True
4
4
  tag = True
5
5
  parse = (?P<major>\d+)
@@ -52,19 +52,18 @@ zip_safe = True
52
52
  python_requires = >=3.9
53
53
  install_requires =
54
54
  depinfo>=1.7
55
- uuid>=1.30
56
- lxml>=4.9
57
- rich>=13.6
55
+ lxml>=5.2
56
+ rich>=13.7
58
57
  requests>=2.31
59
58
  zeep>=4.2.1
60
- pronto>=2.5.5
61
- fastobo>=0.12.2
62
- jinja2>=3.1.2
59
+ pronto>=2.5.6
60
+ fastobo>=0.12.3
61
+ jinja2>=3.1
63
62
  xmltodict>=0.13.0
64
- pydantic>=2.4
63
+ pydantic>=2.6
65
64
  tests_require =
66
- tox>=3.27
67
- pytest
65
+ tox>=4.14.2
66
+ pytest>=8.1.1
68
67
  packages = find:
69
68
  package_dir =
70
69
  = src
@@ -81,16 +80,16 @@ where = src
81
80
 
82
81
  [options.extras_require]
83
82
  development =
84
- pip-tools>6.10
85
- black>=24.1.1
83
+ pip-tools>=7.4.1
84
+ black>=24.3.0
86
85
  bump2version>=1.0.1
87
86
  isort>=5.13.2
88
- tox>=4.12.1
89
- flake8>=6.1.0
87
+ tox>=4.12.2
88
+ flake8>=7.0.0
90
89
  flake8-mypy>=17.8.0
91
- mypy>=1.8.0
92
- pytest>=8.0.0
93
- pytest-cov>=4.1.0
90
+ mypy>=1.9.0
91
+ pytest>=8.1.1
92
+ pytest-cov>=5.0.0
94
93
 
95
94
  [bdist_wheel]
96
95
  universal = 1
@@ -4,4 +4,4 @@ from setuptools import setup # type: ignore
4
4
 
5
5
 
6
6
  if __name__ == "__main__":
7
- setup(version="0.4.1")
7
+ setup(version="0.4.4")
@@ -3,7 +3,7 @@
3
3
  from pathlib import Path
4
4
 
5
5
  __author__ = "Matthias Koenig"
6
- __version__ = "0.4.1"
6
+ __version__ = "0.4.4"
7
7
 
8
8
 
9
9
  program_name: str = "pymetadata"
@@ -11,4 +11,4 @@ RESOURCES_DIR: Path = Path(__file__).parent / "resources"
11
11
  ENUM_DIR: Path = Path(__file__).parent / "metadata"
12
12
 
13
13
  CACHE_USE: bool = False
14
- CACHE_PATH: Path = RESOURCES_DIR / "cache"
14
+ CACHE_PATH: Path = Path.home() / ".cache" / "pymetadata"
@@ -43,6 +43,7 @@ def write_json_cache(
43
43
  :param json_encoder: optional JSON encoder
44
44
  :return:
45
45
  """
46
+ cache_path.parent.mkdir(parents=True, exist_ok=True)
46
47
  with open(cache_path, "w") as fp:
47
48
  logger.info(f"Write cache: {cache_path}")
48
49
  if json_encoder:
@@ -2,18 +2,19 @@
2
2
 
3
3
  from pathlib import Path
4
4
  from pprint import pprint
5
- from typing import Any, Dict
5
+ from typing import Any, Dict, Optional
6
6
 
7
7
  from zeep import Client
8
8
 
9
- from pymetadata import CACHE_PATH, CACHE_USE, RESOURCES_DIR, log
9
+ import pymetadata
10
+ from pymetadata import log
10
11
  from pymetadata.cache import DataclassJSONEncoder, read_json_cache, write_json_cache
11
12
 
12
13
 
13
14
  logger = log.get_logger(__name__)
14
15
 
15
- # client = Client('https://www.ebi.ac.uk/webservices/chebi/2.0/webservice?wsdl')
16
- client = Client(str(RESOURCES_DIR / "chebi_webservice_wsdl.xml"))
16
+ # FIXME: copy the file to the cache dir
17
+ client = Client(str(pymetadata.RESOURCES_DIR / "chebi_webservice_wsdl.xml"))
17
18
 
18
19
 
19
20
  class ChebiQuery:
@@ -25,15 +26,19 @@ class ChebiQuery:
25
26
 
26
27
  @staticmethod
27
28
  def query(
28
- chebi: str, cache: bool = CACHE_USE, cache_path: Path = CACHE_PATH
29
+ chebi: str, cache: Optional[bool] = None, cache_path: Optional[Path] = None
29
30
  ) -> Dict:
30
31
  """Query additional ChEBI information."""
31
32
 
32
33
  if not chebi:
33
34
  return dict()
35
+ if cache is None:
36
+ cache = pymetadata.CACHE_USE
37
+ if cache_path is None:
38
+ cache_path = pymetadata.CACHE_PATH
34
39
 
35
40
  # caching
36
- chebi_base_path = cache_path / "chebi"
41
+ chebi_base_path = Path(cache_path) / "chebi"
37
42
  if not chebi_base_path.exists():
38
43
  chebi_base_path.mkdir(parents=True)
39
44
 
@@ -0,0 +1,15 @@
1
+ """Example for customizing the cache path."""
2
+
3
+ from pathlib import Path
4
+
5
+ import pymetadata
6
+ from pymetadata.chebi import ChebiQuery
7
+
8
+
9
+ pymetadata.CACHE_PATH = Path.home() / ".cache" / "pymetadata"
10
+
11
+ if __name__ == "__main__":
12
+
13
+ chebis = ["CHEBI:2668", "CHEBI:138366", "CHEBI:9637", "CHEBI:155897"]
14
+ for chebi in chebis:
15
+ d = ChebiQuery.query(chebi=chebi, cache=True)
@@ -16,7 +16,8 @@ from typing import Any, Dict, List, Optional
16
16
 
17
17
  import requests
18
18
 
19
- from pymetadata import RESOURCES_DIR, log
19
+ import pymetadata
20
+ from pymetadata import CACHE_PATH, log
20
21
  from pymetadata.cache import DataclassJSONEncoder, read_json_cache, write_json_cache
21
22
 
22
23
 
@@ -187,18 +188,6 @@ def ols_namespaces() -> Dict[str, Namespace]:
187
188
  description="MONDO",
188
189
  namespaceEmbeddedInLui=True,
189
190
  ),
190
- Namespace(
191
- id=None,
192
- prefix="stato",
193
- pattern=r"^STATO:\d+$",
194
- name="STATO",
195
- description="STATO is the statistical methods ontology. It contains "
196
- "concepts and properties related to statistical methods, "
197
- "probability distributions and other concepts related to "
198
- "statistical analysis, including relationships to study "
199
- "designs and plots.",
200
- namespaceEmbeddedInLui=True,
201
- ),
202
191
  Namespace(
203
192
  id=None,
204
193
  prefix="atol",
@@ -310,7 +299,6 @@ class Registry:
310
299
 
311
300
  def __init__(
312
301
  self,
313
- registry_path: Path = RESOURCES_DIR / "identifiers_registry.json",
314
302
  cache_duration: int = 24,
315
303
  cache: bool = True,
316
304
  ):
@@ -320,13 +308,13 @@ class Registry:
320
308
  :param cache_duration: Duration of caching in hours.
321
309
  :param cache: boolean flag to stop caching
322
310
  """
323
- self.registry_path = registry_path
311
+ self.registry_path = pymetadata.CACHE_PATH / "identifiers_registry.json"
324
312
 
325
313
  # check if update needed
326
314
  if cache:
327
315
  if os.path.exists(self.registry_path):
328
316
  registry_age = (
329
- time.time() - os.path.getmtime(registry_path)
317
+ time.time() - os.path.getmtime(self.registry_path)
330
318
  ) / 3600 # [hr]
331
319
  update = registry_age > cache_duration
332
320
  else:
@@ -349,7 +337,7 @@ class Registry:
349
337
  registry_path: Optional[Path] = None,
350
338
  ) -> Dict[str, Namespace]:
351
339
  """Update registry from identifiers.org webservice."""
352
- logger.warning(f"Update registry: '{Registry.URL}' -> '{registry_path}'")
340
+ logger.info(f"Update registry from '{Registry.URL}'")
353
341
  response = requests.get(Registry.URL)
354
342
  namespaces = response.json()["payload"]["namespaces"]
355
343
 
@@ -374,9 +362,6 @@ class Registry:
374
362
  ns_dict[ns.prefix] = ns
375
363
 
376
364
  if custom_namespaces is not None:
377
- logger.warning(
378
- f"Adding custom namespaces: {sorted(custom_namespaces.keys())}"
379
- )
380
365
  for key, ns in custom_namespaces.items():
381
366
  if key in ns_dict:
382
367
  logger.error(
@@ -481,6 +481,8 @@ _terms = {
481
481
  "KISAO_0000695": "parameters for",
482
482
  "KISAO_0000696": "steady state root-finding problem",
483
483
  "KISAO_0000697": "SDE solver",
484
+ "KISAO_0000698": "particle coordinates",
485
+ "KISAO_0000699": "DAE Solver",
484
486
  "KISAO_0000800": "systems property",
485
487
  "KISAO_0000801": "concentration control coefficient matrix (unscaled)",
486
488
  "KISAO_0000802": "control coefficient (scaled)",
@@ -2455,6 +2457,14 @@ class KISAO(str, Enum):
2455
2457
  KISAO_0000697 = "KISAO_0000697"
2456
2458
  SDE_SOLVER = "KISAO_0000697"
2457
2459
 
2460
+ # particle coordinates
2461
+ KISAO_0000698 = "KISAO_0000698"
2462
+ PARTICLE_COORDINATES = "KISAO_0000698"
2463
+
2464
+ # DAE Solver
2465
+ KISAO_0000699 = "KISAO_0000699"
2466
+ DAE_SOLVER = "KISAO_0000699"
2467
+
2458
2468
  # systems property
2459
2469
  KISAO_0000800 = "KISAO_0000800"
2460
2470
  SYSTEMS_PROPERTY = "KISAO_0000800"
@@ -33,7 +33,7 @@ logger = log.get_logger(__name__)
33
33
  __all__ = ["EntryFormat", "ManifestEntry", "Manifest", "Omex"]
34
34
 
35
35
 
36
- IDENTIFIERS_PREFIX = "http://identifiers.org/combine.specifications:"
36
+ IDENTIFIERS_PREFIX = "http://identifiers.org/combine.specifications/"
37
37
  PURL_PREFIX = "https://purl.org/NET/mediatypes/"
38
38
 
39
39
 
@@ -12,7 +12,8 @@ from typing import Any, Dict, List, Optional
12
12
 
13
13
  import requests
14
14
 
15
- from pymetadata import CACHE_PATH, CACHE_USE, log
15
+ import pymetadata
16
+ from pymetadata import log
16
17
  from pymetadata.cache import read_json_cache, write_json_cache
17
18
  from pymetadata.identifiers.registry import Registry
18
19
 
@@ -76,17 +77,22 @@ class OLSQuery:
76
77
  def __init__(
77
78
  self,
78
79
  ontologies: List[OLSOntology],
79
- cache_path: Path = CACHE_PATH,
80
- cache: bool = CACHE_USE,
80
+ cache_path: Optional[Path] = None,
81
+ cache: Optional[bool] = None,
81
82
  ):
82
83
  """Initialize OLSQuery."""
83
- self.ontologies = {
84
+ self.ontologies: Dict[str, OLSOntology] = {
84
85
  ontology.name: ontology for ontology in ontologies
85
- } # type: Dict[str, OLSOntology]
86
+ }
87
+ if not cache_path:
88
+ cache_path = pymetadata.CACHE_PATH
89
+ if not cache:
90
+ cache = pymetadata.CACHE_USE
91
+
86
92
  self.cache_path = cache_path / "ols"
87
93
  self.cache = cache
88
94
 
89
- if not self.cache_path.exists():
95
+ if cache and not self.cache_path.exists():
90
96
  self.cache_path.mkdir(parents=True)
91
97
 
92
98
  def get_iri(self, ontology: str, term: str) -> str:
@@ -137,11 +143,6 @@ class OLSQuery:
137
143
  # double urlencode iri for OLS
138
144
  urliri = urllib.parse.quote(iri, safe="")
139
145
  urliri = urllib.parse.quote(urliri, safe="")
140
- # urliri = iri.replace(":", "%253A")
141
- # urliri = urliri.replace("/", "%252F")
142
-
143
- # term_id = term.split(":")[-1]
144
- # url = ols_pattern.replace('{$id}', term_id)
145
146
  cache_path = self.cache_path / f"{urliri}.json"
146
147
  data: Dict[str, Any] = {}
147
148
  if self.cache:
@@ -177,7 +178,8 @@ class OLSQuery:
177
178
  else:
178
179
  data["errors"] = []
179
180
  data["warnings"] = []
180
- write_json_cache(data=data, cache_path=cache_path) # type: ignore
181
+ if self.cache:
182
+ write_json_cache(data=data, cache_path=cache_path) # type: ignore
181
183
 
182
184
  return data
183
185
 
@@ -291,7 +291,7 @@ def try_ontology_import(ontology_id: str) -> None:
291
291
 
292
292
  if __name__ == "__main__":
293
293
  # download latest versions
294
- # update_ontology_files()
294
+ update_ontology_files()
295
295
 
296
296
  # test loading of OWL files
297
297
  # ofile: OntologyFile
@@ -14,7 +14,8 @@ from typing import Dict, List, Optional
14
14
 
15
15
  import requests
16
16
 
17
- from pymetadata import CACHE_PATH, CACHE_USE, log
17
+ import pymetadata
18
+ from pymetadata import log
18
19
  from pymetadata.cache import DataclassJSONEncoder, read_json_cache, write_json_cache
19
20
  from pymetadata.core.xref import CrossReference
20
21
 
@@ -59,27 +60,27 @@ class UnichemQuery:
59
60
 
60
61
  sources: Dict[int, UnichemSource] = {}
61
62
 
62
- def __init__(self, cache_path: Path = CACHE_PATH, cache: bool = CACHE_USE):
63
+ def __init__(self, cache_path: Optional[Path] = None, cache: Optional[bool] = None):
63
64
  """Initialize UnichemQuery."""
65
+ if cache_path is None:
66
+ cache_path = pymetadata.CACHE_PATH
67
+ if cache is None:
68
+ cache = pymetadata.CACHE_USE
69
+
64
70
  self.cache_path: Path = cache_path
65
71
  self.cache: bool = cache
66
72
 
67
73
  if not self.sources:
68
- self.sources = self.get_sources(
69
- cache_path=self.cache_path, cache=self.cache
70
- )
74
+ self.sources = self.get_sources()
71
75
 
72
- @classmethod
73
- def get_sources(
74
- cls, cache_path: Path = CACHE_PATH, cache: bool = CACHE_USE
75
- ) -> Dict[int, UnichemSource]:
76
+ def get_sources(self) -> Dict[int, UnichemSource]:
76
77
  """Retrieve or query the sources."""
77
78
 
78
79
  sources: Dict[int, UnichemSource]
79
- unichem_sources_path = cache_path / "unichem_sources.json"
80
+ unichem_sources_path = self.cache_path / "unichem_sources.json"
80
81
 
81
82
  data: Dict
82
- if cache and unichem_sources_path.exists():
83
+ if self.cache and unichem_sources_path.exists():
83
84
  data = read_json_cache(unichem_sources_path)
84
85
  sources = {int(k): UnichemSource(**v) for k, v in data.items()}
85
86
  else:
@@ -96,11 +97,12 @@ class UnichemQuery:
96
97
  sources = {source.sourceID: source for source in sources_list}
97
98
 
98
99
  # write cache
99
- write_json_cache(
100
- data=sources,
101
- cache_path=unichem_sources_path,
102
- json_encoder=DataclassJSONEncoder,
103
- )
100
+ if self.cache:
101
+ write_json_cache(
102
+ data=sources,
103
+ cache_path=unichem_sources_path,
104
+ json_encoder=DataclassJSONEncoder,
105
+ )
104
106
 
105
107
  return sources
106
108
 
@@ -173,8 +175,10 @@ class UnichemQuery:
173
175
 
174
176
 
175
177
  if __name__ == "__main__":
178
+ pymetadata.CACHE_PATH = Path.home() / ".cache" / "pymetadata"
179
+
176
180
  # query sources
177
- sources = UnichemQuery.get_sources()
181
+ sources = UnichemQuery().get_sources()
178
182
 
179
183
  # query xrefs
180
184
  inchikey = "NGBFQHCMQULJNZ-UHFFFAOYSA-N"