Skip to content

Commit 75ed174

Browse files
authored
Merge pull request #36 from lamalab-org/tests
retianed names support for phenazine, phenanthrolines, acridine, carbazole, purine, indazole, xanthenes and their derivates
2 parents 142e72d + 5fe1ae1 commit 75ed174

24 files changed

Lines changed: 1758 additions & 119 deletions

.github/workflows/ci.yml

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, refactor_namer]
5+
branches: [main, refactor_namer, tests]
66
pull_request:
77
branches: ["**"]
88

@@ -94,30 +94,65 @@ jobs:
9494
run: pytest -m golden -v --no-header -rA
9595

9696
docker:
97+
needs: [lint, test, rdkit-compat]
98+
permissions:
99+
contents: read
100+
packages: write
101+
uses: ./.github/workflows/docker-image.yml
102+
secrets: inherit
103+
104+
paper-evaluations:
105+
if: github.event_name == 'push' && github.ref == 'refs/heads/tests'
106+
needs: [lint, test, rdkit-compat]
97107
runs-on: ubuntu-latest
98-
needs: [lint]
108+
timeout-minutes: 60
109+
strategy:
110+
fail-fast: false
111+
max-parallel: 3
112+
matrix:
113+
shard:
114+
- qm9/qm9_all
115+
- pubchem/pubchem_seed5_100000
116+
- pubchem/pubchem_seed17_100000
117+
- pubchem/pubchem_seed42_100000
118+
- pubchem/pubchem_seed63_100000
119+
- pubchem/pubchem_seed87_100000
120+
- zinc22/zinc22_seed5_100000
121+
- zinc22/zinc22_seed17_100000
122+
- zinc22/zinc22_seed42_100000
123+
- zinc22/zinc22_seed63_100000
124+
- zinc22/zinc22_seed87_100000
125+
99126
steps:
100127
- uses: actions/checkout@v4
101128

102-
- uses: docker/setup-buildx-action@v3
129+
- uses: actions/setup-python@v5
130+
with:
131+
python-version: "3.12"
132+
cache: pip
103133

104-
- name: Build image
105-
uses: docker/build-push-action@v6
134+
- name: Set up JDK for changed-name OPSIN checks
135+
uses: actions/setup-java@v4
106136
with:
107-
context: .
108-
push: false
109-
load: true
110-
tags: openclatura:ci
137+
distribution: temurin
138+
java-version: "17"
139+
140+
- name: Install OpenClatura and regression dependencies
141+
run: |
142+
python -m pip install --upgrade pip
143+
pip install -e ".[dev]"
111144
112-
- name: Smoke-test the image
145+
- name: Compare against the paper evaluation
113146
run: |
114-
docker run -d --name openclatura-ci -p 8000:8000 openclatura:ci
115-
for i in $(seq 1 30); do
116-
if curl -fsS http://127.0.0.1:8000/healthz > /tmp/health.json; then
117-
cat /tmp/health.json
118-
exit 0
119-
fi
120-
sleep 2
121-
done
122-
docker logs openclatura-ci
123-
exit 1
147+
python evaluations/check_regression.py \
148+
"evaluations/results/${{ matrix.shard }}_openclatura.jsonl" \
149+
--processes auto \
150+
--report "regression-reports/${{ strategy.job-index }}.json"
151+
152+
- name: Upload discrepancy report
153+
if: always()
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: evaluation-regression-${{ strategy.job-index }}
157+
path: regression-reports/*.json
158+
if-no-files-found: error

.github/workflows/docker-image.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: Build Docker image
22

33
on:
4-
push:
5-
branches: [main, tests]
6-
pull_request:
7-
workflow_dispatch:
4+
workflow_call:
85

96
permissions:
107
contents: read
@@ -54,4 +51,4 @@ jobs:
5451
push: true
5552
tags: |
5653
${{ env.IMAGE_NAME }}:main
57-
${{ env.IMAGE_NAME }}:${{ github.sha }}
54+
${{ env.IMAGE_NAME }}:${{ github.sha }}

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing to openclatura
2+
3+
Thank you for your interest in contributing to **openclatura**.
4+
5+
openclatura aims to be a practical implementation of the **IUPAC Blue Book 2013** recommendations for organic nomenclature. This is the main scope of the project and the area we currently prioritize.
6+
7+
We especially welcome:
8+
9+
* bug reports
10+
* feature requests
11+
* tests
12+
* code contributions
13+
14+
## Reporting unsupported or incorrect names
15+
16+
Please open a GitHub issue if openclatura:
17+
18+
* generates an incorrect name for a family of compounds
19+
* does not yet support a nomenclature feature.
20+
21+
A useful issue includes:
22+
23+
* input structures, preferably as SMILES
24+
* names generated by openclatura, or the error message
25+
* expected names
26+
* the suspected reason for the failure, if known
27+
* a reference or output from another program, such as OPSIN and a few related examples from the same family.
28+
29+
For example, if one polycyclic structure fails, it is helpful to include a few similar polycyclic structures. This makes it easier to identify and implement the general missing rule instead of fixing only one molecule.
30+
31+
## Feature requests
32+
33+
Feature requests should also be submitted as GitHub issues.
34+
35+
The current priority is nomenclature covered by the Blue Book 2013.
36+
37+
## Contributing code
38+
39+
Please open pull requests against the **`tests`** branch.
40+
41+
Pull requests to this branch run the automated test and regression workflows. These checks help ensure that a change does not reduce the general naming performance or break previously supported cases.
42+
43+
For code contributions, please:
44+
45+
* add tests for new behavior or bug fixes;
46+
* include several related examples when implementing a general rule;
47+
* mention the relevant Blue Book rule or other reference when available; and
48+
* make sure the existing tests pass.
49+
50+
We prioritize work that can be validated through **OPSIN** where possible. OPSIN validation is helpful for automated testing, but it is not the only measure of correctness, and valid cases that OPSIN does not support may still be considered.
51+
52+
## Questions and discussions
53+
54+
If you are unsure whether an example is a bug, a missing feature, or outside the current scope, please open an issue and describe what you found.
55+
:::

README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,12 @@ print(d.text)
163163
Processed SMILES: Cn1cnc2c1c(=O)n(C)c(=O)n2C
164164
Atom ids in that SMILES: C{0}n{1}1c{2}n{3}c{4}2c{5}1c{6}(=O{7})n{8}(C{13})c{9}(=O{10})n{11}2C{12}
165165
166-
The molecule is named 2,4,7-trimethyl-2,4,7,9-tetraazabicyclo[4.3.0]nona-1(6),8-diene-3,5-dione.
166+
The molecule is named 1,3,7-trimethylpurine-2,6-dione.
167167
168-
The molecule is built around a 9-membered bicyclic [4.3.0] heteroskeleton.
169-
Within that parent framework, there is nitrogen at positions 2 (atom id 11), 4 (atom id 8), 7 (atom id 1), and 9 (atom id 3).
170-
Within that parent framework, there is a double bond between position 1 (atom id 4) and position 6 (atom id 5) and a double bond between position 8 (atom id 2) and position 9 (atom id 3).
171-
The principal characteristic feature is oxo groups at positions 3 (atom id 9) and 5 (atom id 6).
172-
Attached to this framework are methyl groups at positions 2 (atom id 11), 4 (atom id 8), and 7 (atom id 1). """
168+
The molecule is built around the retained purine parent, 9-membered bicyclic [4.3.0] heteroskeleton.
169+
Within that parent framework, there is nitrogen at positions 1 (atom id 8), 3 (atom id 11), 7 (atom id 1), and 9 (atom id 3).
170+
The principal characteristic feature is oxo groups at positions 2 (atom id 9) and 6 (atom id 6).
171+
Attached to this framework are methyl groups at positions 1 (atom id 8), 3 (atom id 11), and 7 (atom id 1). """
173172

174173
```
175174

@@ -231,6 +230,36 @@ OpenAPI docs are served at `http://localhost:8000/docs`.
231230

232231
MIT. See `LICENSE`.
233232

234-
## How to cite
235-
Adrian Mirza, Kevin Maik Jablonka, Rostislav Fedorov. Openclatura–an Open-Source Nomenclature Framework for Rule-Based Molecule Naming. ChemRxiv. 15 July 2026.
236-
DOI: https://doi.org/10.26434/chemrxiv.15006114/v1
233+
## How to cite
234+
235+
If you use Openclatura in your research, please cite the Openclatura preprint:
236+
237+
```bibtex
238+
@article{openclatura2026,
239+
author = {Mirza, Adrian and Jablonka, Kevin Maik and Fedorov, Rostislav},
240+
title = {Openclatura--An Open-Source Nomenclature Framework for Rule-Based Molecule Naming},
241+
journal = {ChemRxiv},
242+
year = {2026},
243+
month = jul,
244+
day = {15},
245+
doi = {10.26434/chemrxiv.15006114/v1},
246+
url = {https://doi.org/10.26434/chemrxiv.15006114/v1},
247+
note = {Preprint}
248+
}
249+
```
250+
251+
If you are using OPSIN for verification, please cite the original OPSIN publication:
252+
253+
```bibtex
254+
@article{lowe2011opsin,
255+
author = {Lowe, Daniel M. and Corbett, Peter T. and Murray-Rust, Peter and Glen, Robert C.},
256+
title = {Chemical Name to Structure: {OPSIN}, an Open Source Solution},
257+
journal = {Journal of Chemical Information and Modeling},
258+
year = {2011},
259+
volume = {51},
260+
number = {3},
261+
pages = {739--753},
262+
doi = {10.1021/ci100384d},
263+
url = {https://doi.org/10.1021/ci100384d}
264+
}
265+
```

0 commit comments

Comments
 (0)