Skip to content

Commit 34ea741

Browse files
committed
fix: update OCL to v2026.3.0 + fix
Closes: #372
1 parent d56b94f commit 34ea741

32 files changed

+864
-891
lines changed

__tests__/__snapshots__/conformers.test.ts.snap

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ exports[`ConformerGenerator > should generate conformers 1`] = `
55
Actelion Java MolfileCreator 1.0
66
77
15 14 0 0 0 0 0 0 0 0999 V2000
8-
3.3997 1.5180 -1.6878 C 0 0 0 0 0 0 0 0 0 0 0 0
8+
4.6113 0.4611 -0.5340 C 0 0 0 0 0 0 0 0 0 0 0 0
99
4.1300 1.8178 -0.4830 O 0 0 0 0 0 0 0 0 0 0 0 0
1010
3.2603 2.0511 0.6440 C 0 0 0 0 0 0 0 0 0 0 0 0
1111
2.7851 3.5307 0.6291 C 0 0 0 0 0 0 0 0 0 0 0 0
12-
1.9125 3.7446 -0.5003 O 0 0 0 0 0 0 0 0 0 0 0 0
13-
0.6265 3.1403 -0.2603 N 0 0 0 0 0 0 0 0 0 0 0 0
14-
2.6991 0.7270 -1.5191 H 0 0 0 0 0 0 0 0 0 0 0 0
15-
2.8757 2.3876 -2.0234 H 0 0 0 0 0 0 0 0 0 0 0 0
16-
4.0865 1.2112 -2.4486 H 0 0 0 0 0 0 0 0 0 0 0 0
12+
3.9051 4.3988 0.9019 O 0 0 0 0 0 0 0 0 0 0 0 0
13+
3.4838 5.7769 0.8923 N 0 0 0 0 0 0 0 0 0 0 0 0
14+
5.0424 0.1767 0.4032 H 0 0 0 0 0 0 0 0 0 0 0 0
15+
3.8070 -0.2035 -0.7682 H 0 0 0 0 0 0 0 0 0 0 0 0
16+
5.3601 0.3816 -1.2940 H 0 0 0 0 0 0 0 0 0 0 0 0
1717
3.7860 1.8584 1.5546 H 0 0 0 0 0 0 0 0 0 0 0 0
1818
2.4070 1.4077 0.5876 H 0 0 0 0 0 0 0 0 0 0 0 0
19-
3.6383 4.1723 0.5573 H 0 0 0 0 0 0 0 0 0 0 0 0
20-
2.2605 3.7450 1.5364 H 0 0 0 0 0 0 0 0 0 0 0 0
21-
0.0145 3.4596 -0.8748 H 0 0 0 0 0 0 0 0 0 0 0 0
22-
0.6967 2.2226 -0.3494 H 0 0 0 0 0 0 0 0 0 0 0 0
19+
2.0301 3.6641 1.3754 H 0 0 0 0 0 0 0 0 0 0 0 0
20+
2.3740 3.7625 -0.3309 H 0 0 0 0 0 0 0 0 0 0 0 0
21+
4.1394 6.3041 1.2749 H 0 0 0 0 0 0 0 0 0 0 0 0
22+
3.3448 6.0497 0.0198 H 0 0 0 0 0 0 0 0 0 0 0 0
2323
1 2 1 0 0 0 0
2424
2 3 1 0 0 0 0
2525
3 4 1 0 0 0 0
@@ -43,21 +43,21 @@ exports[`ConformerGenerator > should generate conformers 2`] = `
4343
Actelion Java MolfileCreator 1.0
4444
4545
15 14 0 0 0 0 0 0 0 0999 V2000
46-
4.6113 0.4611 -0.5340 C 0 0 0 0 0 0 0 0 0 0 0 0
46+
3.3997 1.5180 -1.6878 C 0 0 0 0 0 0 0 0 0 0 0 0
4747
4.1300 1.8178 -0.4830 O 0 0 0 0 0 0 0 0 0 0 0 0
4848
3.2603 2.0511 0.6440 C 0 0 0 0 0 0 0 0 0 0 0 0
4949
2.7851 3.5307 0.6291 C 0 0 0 0 0 0 0 0 0 0 0 0
50-
3.9051 4.3988 0.9019 O 0 0 0 0 0 0 0 0 0 0 0 0
51-
3.4838 5.7769 0.8923 N 0 0 0 0 0 0 0 0 0 0 0 0
52-
5.0424 0.1767 0.4032 H 0 0 0 0 0 0 0 0 0 0 0 0
53-
3.8070 -0.2035 -0.7682 H 0 0 0 0 0 0 0 0 0 0 0 0
54-
5.3601 0.3816 -1.2940 H 0 0 0 0 0 0 0 0 0 0 0 0
50+
1.9125 3.7446 -0.5003 O 0 0 0 0 0 0 0 0 0 0 0 0
51+
0.6265 3.1403 -0.2603 N 0 0 0 0 0 0 0 0 0 0 0 0
52+
2.6991 0.7270 -1.5191 H 0 0 0 0 0 0 0 0 0 0 0 0
53+
2.8757 2.3876 -2.0234 H 0 0 0 0 0 0 0 0 0 0 0 0
54+
4.0865 1.2112 -2.4486 H 0 0 0 0 0 0 0 0 0 0 0 0
5555
3.7860 1.8584 1.5546 H 0 0 0 0 0 0 0 0 0 0 0 0
5656
2.4070 1.4077 0.5876 H 0 0 0 0 0 0 0 0 0 0 0 0
57-
2.0301 3.6641 1.3754 H 0 0 0 0 0 0 0 0 0 0 0 0
58-
2.3740 3.7625 -0.3309 H 0 0 0 0 0 0 0 0 0 0 0 0
59-
4.1394 6.3041 1.2749 H 0 0 0 0 0 0 0 0 0 0 0 0
60-
3.3448 6.0497 0.0198 H 0 0 0 0 0 0 0 0 0 0 0 0
57+
3.6383 4.1723 0.5573 H 0 0 0 0 0 0 0 0 0 0 0 0
58+
2.2605 3.7450 1.5364 H 0 0 0 0 0 0 0 0 0 0 0 0
59+
0.0145 3.4596 -0.8748 H 0 0 0 0 0 0 0 0 0 0 0 0
60+
0.6967 2.2226 -0.3494 H 0 0 0 0 0 0 0 0 0 0 0 0
6161
1 2 1 0 0 0 0
6262
2 3 1 0 0 0 0
6363
3 4 1 0 0 0 0

__tests__/__snapshots__/force_field_mmff94.test.ts.snap

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ exports[`ForceFieldMMFF94 > should generate force field (MMFF94) 1`] = `
55
Actelion Java MolfileCreator 1.0
66
77
15 14 0 0 0 0 0 0 0 0999 V2000
8-
3.5038 1.7385 -1.8009 C 0 0 0 0 0 0 0 0 0 0 0 0
9-
4.2542 1.9917 -0.6217 O 0 0 0 0 0 0 0 0 0 0 0 0
10-
3.4638 1.9620 0.5734 C 0 0 0 0 0 0 0 0 0 0 0 0
11-
2.6772 3.2541 0.7998 C 0 0 0 0 0 0 0 0 0 0 0 0
12-
3.5669 4.3539 1.0380 O 0 0 0 0 0 0 0 0 0 0 0 0
13-
3.8232 4.4598 2.4716 N 0 0 0 0 0 0 0 0 0 0 0 0
14-
3.0118 0.7629 -1.7423 H 0 0 0 0 0 0 0 0 0 0 0 0
15-
2.7643 2.5244 -1.9736 H 0 0 0 0 0 0 0 0 0 0 0 0
16-
4.1945 1.7264 -2.6486 H 0 0 0 0 0 0 0 0 0 0 0 0
17-
4.1661 1.8109 1.3998 H 0 0 0 0 0 0 0 0 0 0 0 0
18-
2.7900 1.0980 0.5489 H 0 0 0 0 0 0 0 0 0 0 0 0
19-
1.9754 3.1387 1.6350 H 0 0 0 0 0 0 0 0 0 0 0 0
20-
2.0905 3.5144 -0.0855 H 0 0 0 0 0 0 0 0 0 0 0 0
21-
4.8437 4.3997 2.4861 H 0 0 0 0 0 0 0 0 0 0 0 0
22-
3.6051 5.4445 2.6343 H 0 0 0 0 0 0 0 0 0 0 0 0
8+
4.5580 0.4550 -0.5243 C 0 0 0 0 0 0 0 0 0 0 0 0
9+
3.9831 1.7542 -0.5584 O 0 0 0 0 0 0 0 0 0 0 0 0
10+
3.3460 2.0828 0.6810 C 0 0 0 0 0 0 0 0 0 0 0 0
11+
2.7808 3.4984 0.6111 C 0 0 0 0 0 0 0 0 0 0 0 0
12+
3.8635 4.4375 0.6754 O 0 0 0 0 0 0 0 0 0 0 0 0
13+
3.3028 5.7848 0.7159 N 0 0 0 0 0 0 0 0 0 0 0 0
14+
5.3297 0.3978 0.2494 H 0 0 0 0 0 0 0 0 0 0 0 0
15+
3.7872 -0.3006 -0.3448 H 0 0 0 0 0 0 0 0 0 0 0 0
16+
5.0214 0.2578 -1.4947 H 0 0 0 0 0 0 0 0 0 0 0 0
17+
4.0787 2.0078 1.4927 H 0 0 0 0 0 0 0 0 0 0 0 0
18+
2.5306 1.3722 0.8548 H 0 0 0 0 0 0 0 0 0 0 0 0
19+
2.1121 3.6657 1.4633 H 0 0 0 0 0 0 0 0 0 0 0 0
20+
2.2348 3.6485 -0.3273 H 0 0 0 0 0 0 0 0 0 0 0 0
21+
3.8164 6.1856 1.5022 H 0 0 0 0 0 0 0 0 0 0 0 0
22+
3.7213 6.1903 -0.1234 H 0 0 0 0 0 0 0 0 0 0 0 0
2323
1 2 1 0 0 0 0
2424
2 3 1 0 0 0 0
2525
3 4 1 0 0 0 0
@@ -43,21 +43,21 @@ exports[`ForceFieldMMFF94 > should generate force field (MMFF94s) 1`] = `
4343
Actelion Java MolfileCreator 1.0
4444
4545
15 14 0 0 0 0 0 0 0 0999 V2000
46-
3.5038 1.7385 -1.8009 C 0 0 0 0 0 0 0 0 0 0 0 0
47-
4.2542 1.9917 -0.6217 O 0 0 0 0 0 0 0 0 0 0 0 0
48-
3.4638 1.9620 0.5734 C 0 0 0 0 0 0 0 0 0 0 0 0
49-
2.6772 3.2541 0.7998 C 0 0 0 0 0 0 0 0 0 0 0 0
50-
3.5669 4.3539 1.0380 O 0 0 0 0 0 0 0 0 0 0 0 0
51-
3.8232 4.4598 2.4716 N 0 0 0 0 0 0 0 0 0 0 0 0
52-
3.0118 0.7629 -1.7423 H 0 0 0 0 0 0 0 0 0 0 0 0
53-
2.7643 2.5244 -1.9736 H 0 0 0 0 0 0 0 0 0 0 0 0
54-
4.1945 1.7264 -2.6486 H 0 0 0 0 0 0 0 0 0 0 0 0
55-
4.1661 1.8109 1.3998 H 0 0 0 0 0 0 0 0 0 0 0 0
56-
2.7900 1.0980 0.5489 H 0 0 0 0 0 0 0 0 0 0 0 0
57-
1.9754 3.1387 1.6350 H 0 0 0 0 0 0 0 0 0 0 0 0
58-
2.0905 3.5144 -0.0855 H 0 0 0 0 0 0 0 0 0 0 0 0
59-
4.8437 4.3997 2.4861 H 0 0 0 0 0 0 0 0 0 0 0 0
60-
3.6051 5.4445 2.6343 H 0 0 0 0 0 0 0 0 0 0 0 0
46+
4.5580 0.4550 -0.5243 C 0 0 0 0 0 0 0 0 0 0 0 0
47+
3.9831 1.7542 -0.5584 O 0 0 0 0 0 0 0 0 0 0 0 0
48+
3.3460 2.0828 0.6810 C 0 0 0 0 0 0 0 0 0 0 0 0
49+
2.7808 3.4984 0.6111 C 0 0 0 0 0 0 0 0 0 0 0 0
50+
3.8635 4.4375 0.6754 O 0 0 0 0 0 0 0 0 0 0 0 0
51+
3.3028 5.7848 0.7159 N 0 0 0 0 0 0 0 0 0 0 0 0
52+
5.3297 0.3978 0.2494 H 0 0 0 0 0 0 0 0 0 0 0 0
53+
3.7872 -0.3006 -0.3448 H 0 0 0 0 0 0 0 0 0 0 0 0
54+
5.0214 0.2578 -1.4947 H 0 0 0 0 0 0 0 0 0 0 0 0
55+
4.0787 2.0078 1.4927 H 0 0 0 0 0 0 0 0 0 0 0 0
56+
2.5306 1.3722 0.8548 H 0 0 0 0 0 0 0 0 0 0 0 0
57+
2.1121 3.6657 1.4633 H 0 0 0 0 0 0 0 0 0 0 0 0
58+
2.2348 3.6485 -0.3273 H 0 0 0 0 0 0 0 0 0 0 0 0
59+
3.8164 6.1856 1.5022 H 0 0 0 0 0 0 0 0 0 0 0 0
60+
3.7213 6.1903 -0.1234 H 0 0 0 0 0 0 0 0 0 0 0 0
6161
1 2 1 0 0 0 0
6262
2 3 1 0 0 0 0
6363
3 4 1 0 0 0 0
@@ -81,21 +81,21 @@ exports[`ForceFieldMMFF94 > should generate force field (MMFF94s+) 1`] = `
8181
Actelion Java MolfileCreator 1.0
8282
8383
15 14 0 0 0 0 0 0 0 0999 V2000
84-
3.5038 1.7385 -1.8009 C 0 0 0 0 0 0 0 0 0 0 0 0
85-
4.2542 1.9917 -0.6217 O 0 0 0 0 0 0 0 0 0 0 0 0
86-
3.4638 1.9620 0.5734 C 0 0 0 0 0 0 0 0 0 0 0 0
87-
2.6772 3.2541 0.7998 C 0 0 0 0 0 0 0 0 0 0 0 0
88-
3.5669 4.3539 1.0380 O 0 0 0 0 0 0 0 0 0 0 0 0
89-
3.8232 4.4598 2.4716 N 0 0 0 0 0 0 0 0 0 0 0 0
90-
3.0118 0.7629 -1.7423 H 0 0 0 0 0 0 0 0 0 0 0 0
91-
2.7643 2.5244 -1.9736 H 0 0 0 0 0 0 0 0 0 0 0 0
92-
4.1945 1.7264 -2.6486 H 0 0 0 0 0 0 0 0 0 0 0 0
93-
4.1661 1.8109 1.3998 H 0 0 0 0 0 0 0 0 0 0 0 0
94-
2.7900 1.0980 0.5489 H 0 0 0 0 0 0 0 0 0 0 0 0
95-
1.9754 3.1387 1.6350 H 0 0 0 0 0 0 0 0 0 0 0 0
96-
2.0905 3.5144 -0.0855 H 0 0 0 0 0 0 0 0 0 0 0 0
97-
4.8437 4.3997 2.4861 H 0 0 0 0 0 0 0 0 0 0 0 0
98-
3.6051 5.4445 2.6343 H 0 0 0 0 0 0 0 0 0 0 0 0
84+
4.5580 0.4550 -0.5243 C 0 0 0 0 0 0 0 0 0 0 0 0
85+
3.9831 1.7542 -0.5584 O 0 0 0 0 0 0 0 0 0 0 0 0
86+
3.3460 2.0828 0.6810 C 0 0 0 0 0 0 0 0 0 0 0 0
87+
2.7808 3.4984 0.6111 C 0 0 0 0 0 0 0 0 0 0 0 0
88+
3.8635 4.4375 0.6754 O 0 0 0 0 0 0 0 0 0 0 0 0
89+
3.3028 5.7848 0.7159 N 0 0 0 0 0 0 0 0 0 0 0 0
90+
5.3297 0.3978 0.2494 H 0 0 0 0 0 0 0 0 0 0 0 0
91+
3.7872 -0.3006 -0.3448 H 0 0 0 0 0 0 0 0 0 0 0 0
92+
5.0214 0.2578 -1.4947 H 0 0 0 0 0 0 0 0 0 0 0 0
93+
4.0787 2.0078 1.4927 H 0 0 0 0 0 0 0 0 0 0 0 0
94+
2.5306 1.3722 0.8548 H 0 0 0 0 0 0 0 0 0 0 0 0
95+
2.1121 3.6657 1.4633 H 0 0 0 0 0 0 0 0 0 0 0 0
96+
2.2348 3.6485 -0.3273 H 0 0 0 0 0 0 0 0 0 0 0 0
97+
3.8164 6.1856 1.5022 H 0 0 0 0 0 0 0 0 0 0 0 0
98+
3.7213 6.1903 -0.1234 H 0 0 0 0 0 0 0 0 0 0 0 0
9999
1 2 1 0 0 0 0
100100
2 3 1 0 0 0 0
101101
3 4 1 0 0 0 0
Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { expect, test } from 'vitest';
55

66
import { Canonizer, Molecule } from '../lib';
77

8-
test.fails('Molecule with annotation', () => {
8+
test('Molecule with annotation', () => {
99
const filename = join(import.meta.dirname, 'data', 'molfile_annotated.mol');
1010
const molfile = readFileSync(filename, 'utf8');
1111
const molecule = Molecule.fromMolfile(molfile);
@@ -44,5 +44,24 @@ test.fails('Molecule with annotation', () => {
4444
for (let i = 0; i < 16; i++) {
4545
customLabels2.push(molecule2.getAtomCustomLabel(i));
4646
}
47-
expect(customLabels2).toStrictEqual(expected);
47+
48+
const expected2 = [
49+
null,
50+
']9',
51+
']9α',
52+
']8α',
53+
']4α',
54+
']1',
55+
']10α',
56+
']8',
57+
']10',
58+
']4',
59+
']2',
60+
']5',
61+
']7',
62+
null,
63+
']3',
64+
']6',
65+
];
66+
expect(customLabels2).toStrictEqual(expected2);
4867
});

openchemlib

Submodule openchemlib updated 31 files

src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Canonizer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,13 +3244,13 @@ private void idCodeCreate() {
32443244
encodeBits(lbits, 6);
32453245
encodeBits(mbits, 16);
32463246
for (int atom=0; atom<mMol.getAtoms(); atom++) {
3247-
String customLabel = mMol.getAtomCustomLabel(mGraphAtom[atom]);
3248-
if (customLabel != null) {
3247+
String label = mMol.getAtomCustomLabel(mGraphAtom[atom]);
3248+
if (label != null && (label.length() > 15 || maxEnhancedCustomLabelCharCode(label) > 127)) {
32493249
encodeBits(atom, nbits);
3250-
int length = Math.min(63, customLabel.length());
3250+
int length = Math.min(63, label.length());
32513251
encodeBits(length, lbits);
32523252
for (int i=0; i<length; i++)
3253-
encodeBits(customLabel.charAt(i), mbits);
3253+
encodeBits(label.charAt(i), mbits);
32543254
}
32553255
}
32563256
}
@@ -3798,7 +3798,7 @@ private void encodeFeatureNo(int codeNo) {
37983798
}
37993799

38003800
private void encodeBits(long data, int bits) {
3801-
//System.out.println(bits+" bits:"+data+" mode="+mode);
3801+
//System.out.println(bits+" bits:"+data);
38023802
while (bits != 0) {
38033803
if (mEncodingBitsAvail == 0) {
38043804
if (!mEncodeAvoid127 || mEncodingTempData != 63)

src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@
4040
/**
4141
* Typically you should use IDCodeParser instead of this class. You may instantiate this class
4242
* if you need to avoid a dependency to the CoordinateInventor and if you pass encoded coordinates
43-
* together with any idcode for parsing.
43+
* together with any idcode for parsing, or if you don't need 2D-coordinates, e.g. because you
44+
* intend to generate 3D-coordinates afterward.
4445
* We needed to introduce this class to avoid a cyclic dependency between the IDCodeParser and
45-
* the CoordinateInventor: If encoded atom coords are not given, then the IDcodeParser needs
46-
* to invent then in order to assign proper up-/down-bonds. The CoordinateInventor needs the
47-
* IDCodeParser to unpack its default template list.
46+
* the CoordinateInventor: If encoded atom coords are not given and if you later depict the
47+
* molecule in 2D, then IDCodeParser needs to invent 2D-coordinates in order to assign
48+
* proper up-/down-bonds from stereo parities. CoordinateInventor needs IDCodeParser in turn
49+
* to unpack its default template list.
4850
*/
4951
public class IDCodeParserWithoutCoordinateInvention {
5052
private StereoMolecule mMol;
@@ -69,7 +71,7 @@ public void neglectSpaceDelimitedCoordinates() {
6971
/**
7072
* Creates and returns a molecule from the idcode with its atom and bond arrays being
7173
* just as large as needed to hold the molecule. Use this to conserve memory if no
72-
* atoms or bonds are added to the molecule afterwards. This version of the method
74+
* atoms or bonds are added to the molecule afterward. This version of the method
7375
* allows to pass idcode and atom coordinates in one String object.
7476
* @param idcode null or idcode, which may contain coordinates separated by a space character
7577
* @return

0 commit comments

Comments
 (0)