openchemlib-search-wasm 1.0.0 → 1.2.0

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # openchemlib-search-wasm
2
2
 
3
- Batch substructure search, batch similarity search and FragFp fingerprints over arrays of
4
- OpenChemLib idcodes — with OpenChemLib compiled to WebAssembly.
3
+ Batch substructure search, batch similarity search, FragFp fingerprints and identity hashes over
4
+ arrays of OpenChemLib idcodes — with OpenChemLib compiled to WebAssembly.
5
5
 
6
6
  ## Install
7
7
 
@@ -29,6 +29,14 @@ similaritySearch<Entry>(idCodeQuery: string, entries: Entry[],
29
29
  // the 512-bit FragFp, for a fingerprint table: sixteen 32-bit words per molecule
30
30
  getIndex(idCode: string): Int32Array;
31
31
  getIndexes(idCodes: string[]): Int32Array[];
32
+
33
+ // the 64-bit hash a molecule keeps across its stereoisomers
34
+ getNoStereoHash(idCode: string, options?: HashOptions): bigint;
35
+ getNoStereoHashes(idCodes: string[], options?: HashOptions): BigInt64Array;
36
+
37
+ // the same, across its tautomers as well
38
+ getNoStereoTautomerHash(idCode: string, options?: HashOptions): bigint;
39
+ getNoStereoTautomerHashes(idCodes: string[], options?: HashOptions): BigInt64Array;
32
40
  ```
33
41
 
34
42
  **Give it your objects and it gives them back.** An entry is an idcode or anything carrying one — a
@@ -138,6 +146,65 @@ const columns = new BigInt64Array(index.buffer, index.byteOffset, 8);
138
146
 
139
147
  This is the expensive half of importing a library, and where the biggest speedup is.
140
148
 
149
+ ## Identity hashes
150
+
151
+ Two hashes, for the two things "the same compound" usually means. Both are OpenChemLib's own —
152
+ `CanonizerUtil.getNoStereoHash` and `CanonizerUtil.getNoStereoTautomerHash` — so both are the value
153
+ any other OpenChemLib build computes, and the tests check the fixture molecules against
154
+ `openchemlib` to prove it.
155
+
156
+ | | drops | keeps apart |
157
+ | ------------------------- | ---------------------------- | ------------- |
158
+ | `getNoStereoHash` | stereochemistry | the tautomers |
159
+ | `getNoStereoTautomerHash` | stereochemistry, tautomerism | — |
160
+
161
+ `getNoStereoHash` strips the molecule of stereo information, canonizes it, and runs that idcode
162
+ through OpenChemLib's 64-bit hash. Both enantiomers of a centre, and both isomers of a double bond,
163
+ give the same value — the one to key on when a record's stereochemistry is unreliable but the bonds
164
+ it was drawn with are not.
165
+
166
+ `getNoStereoTautomerHash` reduces the molecule to its generic tautomer first, so the keto and the
167
+ enol form of a compound land on the same key as well — the one to key on when "the same compound"
168
+ means the same constitution rather than the same drawing.
169
+
170
+ ```js
171
+ import {
172
+ getNoStereoHash,
173
+ getNoStereoTautomerHash,
174
+ } from 'openchemlib-search-wasm';
175
+
176
+ // both enantiomers of 2-chlorobutane
177
+ getNoStereoHash('gJPHADILuTb@') === getNoStereoHash('gJPHADILuTd@'); // true
178
+
179
+ // pentan-3-one drawn as the keto and as the enol form
180
+ getNoStereoHash('gGQ@@drmT@@') === getNoStereoHash('gGQ@@drsT@@'); // false
181
+ getNoStereoTautomerHash('gGQ@@drmT@@') ===
182
+ getNoStereoTautomerHash('gGQ@@drsT@@'); // true
183
+ ```
184
+
185
+ Both are signed 64-bit integers, which is exactly what an SQLite `INTEGER` column stores and
186
+ indexes, so a `BigInt64Array` of hashes goes straight into one. An idcode that will not parse, or a
187
+ molecule OpenChemLib cannot canonize, gets `NO_HASH` (`0n`).
188
+
189
+ Both take `{ largestFragmentOnly: true }` to strip everything but the largest fragment and
190
+ neutralize it first, so a salt hashes as its parent structure.
191
+
192
+ ### What they cost
193
+
194
+ On ordinary drug-like molecules the no-stereo hash costs about 52 µs and the tautomer one about
195
+ 145 µs. Want both columns? Call both — the two share the idcode parse and the stereo strip, but that
196
+ shared work is worth under 20 µs and is not worth an API to save.
197
+
198
+ The tautomer cost is nothing like uniform, though, and that changes the picture entirely on a real
199
+ library. It is driven by how many tautomeric sites a molecule has, and a molecule with a great many
200
+ can take the better part of a second before OpenChemLib abandons the enumeration. Roughly one in ten
201
+ of the test fixture is such a molecule, and they drag the mean to 29.6 ms — at which point the
202
+ no-stereo hash is 0.2% of the tautomer one.
203
+
204
+ Two things follow. Hash a library **in a worker**, never on the main thread. And if you only need
205
+ identity up to stereochemistry, `getNoStereoHash` is the one to reach for: it is the hash whose cost
206
+ you can predict.
207
+
141
208
  ## What you actually win
142
209
 
143
210
  Against `openchemlib` 9.25.0, on 409,686 real idcodes, with identical hit counts for every query:
package/lib/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import type { HashOptions } from './types.ts';
1
2
  export { substructureSearch } from './substructureSearch.ts';
2
3
  export { similaritySearch } from './similaritySearch.ts';
3
- export { INDEX_WORDS } from './types.ts';
4
- export type { ResultBuffer, SearchMode, SearchOptions, SearchResult, SearchStep, SimilaritySearchOptions, SimilaritySearchResult, SubstructureSearchOptions, SubstructureSearchResult, } from './types.ts';
4
+ export { INDEX_WORDS, NO_HASH } from './types.ts';
5
+ export type { HashOptions, ResultBuffer, SearchMode, SearchOptions, SearchResult, SearchStep, SimilaritySearchOptions, SimilaritySearchResult, SubstructureSearchOptions, SubstructureSearchResult, TautomerHashOptions, } from './types.ts';
5
6
  export { SimilarityResult, SubstructureResult } from './types.ts';
6
7
  /**
7
8
  * Builds the 512-bit FragFp fingerprint of one idcode, as sixteen 32-bit words.
@@ -39,4 +40,81 @@ export declare function getIndex(idCode: string): Int32Array;
39
40
  * @returns One sixteen-word view per idcode, in order.
40
41
  */
41
42
  export declare function getIndexes(idCodes: string[]): Int32Array[];
43
+ /**
44
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to tautomerism and
45
+ * stereochemistry.
46
+ *
47
+ * Every tautomer of a structure and every stereoisomer of it give the same hash, so two records key
48
+ * to the same value whether the compound was drawn as the keto or the enol form, and whether or not
49
+ * its stereo centres were assigned. That is what makes it the column to look a compound up by when
50
+ * "the same molecule" means the same constitution rather than the same drawing.
51
+ *
52
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoTautomerHash`, so the value matches what any
53
+ * other OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER`
54
+ * column stores and indexes directly:
55
+ *
56
+ * ```js
57
+ * insert.run(entryId, getNoStereoTautomerHash(idCode));
58
+ * ```
59
+ * @param idCode - The molecule to hash, as an idcode.
60
+ * @param options - See {@link HashOptions}.
61
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
62
+ * OpenChemLib cannot canonize.
63
+ */
64
+ export declare function getNoStereoTautomerHash(idCode: string, options?: HashOptions): bigint;
65
+ /**
66
+ * Hashes every idcode to its no-stereo tautomer hash, one 64-bit value each.
67
+ *
68
+ * See {@link getNoStereoTautomerHash} for what the hash identifies. A drug-like molecule costs
69
+ * around 130 µs, against 520 µs for `openchemlib-js`, and almost all of that is canonizing the
70
+ * generic tautomer rather than the hashing itself. That cost is nothing like uniform: it is driven
71
+ * by how many tautomeric sites the molecule has, and one with a great many can take the better part
72
+ * of a second before OpenChemLib abandons the enumeration — so a library import belongs in a worker
73
+ * rather than on the main thread.
74
+ *
75
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
76
+ * them costs a single allocation and can be written straight into a column.
77
+ * @param idCodes - The molecules to hash, as idcodes.
78
+ * @param options - See {@link HashOptions}.
79
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
80
+ * hashed.
81
+ */
82
+ export declare function getNoStereoTautomerHashes(idCodes: string[], options?: HashOptions): BigInt64Array;
83
+ /**
84
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to stereochemistry.
85
+ *
86
+ * Every stereoisomer of a structure gives the same hash, and nothing else does: unlike
87
+ * {@link getNoStereoTautomerHash} the tautomers stay apart, so the keto and the enol form of a
88
+ * compound key differently. That makes it the narrower of the two identity columns — the one to use
89
+ * when a record's stereo centres are unreliable but the bonds it was drawn with are not.
90
+ *
91
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoHash`, so the value matches what any other
92
+ * OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER` column
93
+ * stores and indexes directly:
94
+ *
95
+ * ```js
96
+ * insert.run(entryId, getNoStereoHash(idCode));
97
+ * ```
98
+ * @param idCode - The molecule to hash, as an idcode.
99
+ * @param options - See {@link HashOptions}.
100
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
101
+ * OpenChemLib cannot canonize.
102
+ */
103
+ export declare function getNoStereoHash(idCode: string, options?: HashOptions): bigint;
104
+ /**
105
+ * Hashes every idcode to its no-stereo hash, one 64-bit value each.
106
+ *
107
+ * See {@link getNoStereoHash} for what the hash identifies. It costs a fraction of
108
+ * {@link getNoStereoTautomerHashes} because it canonizes the molecule itself instead of enumerating
109
+ * its tautomers, and its cost is even across a library rather than driven by how tautomeric each
110
+ * molecule happens to be.
111
+ *
112
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
113
+ * them costs a single allocation and can be written straight into a column.
114
+ * @param idCodes - The molecules to hash, as idcodes.
115
+ * @param options - See {@link HashOptions}.
116
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
117
+ * hashed.
118
+ */
119
+ export declare function getNoStereoHashes(idCodes: string[], options?: HashOptions): BigInt64Array;
42
120
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAA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Ae,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,WAAgB,GACxB,MAAM,CAKR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,GAAE,WAAgB,GACxB,aAAa,CAKf"}
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { buildIndexes } from "./scan.js";
1
+ import { buildIndexes, buildNoStereoHashes, buildNoStereoTautomerHashes, } from "./scan.js";
2
2
  import { INDEX_WORDS } from "./types.js";
3
3
  export { substructureSearch } from "./substructureSearch.js";
4
4
  export { similaritySearch } from "./similaritySearch.js";
5
- export { INDEX_WORDS } from "./types.js";
5
+ export { INDEX_WORDS, NO_HASH } from "./types.js";
6
6
  export { SimilarityResult, SubstructureResult } from "./types.js";
7
7
  /**
8
8
  * Builds the 512-bit FragFp fingerprint of one idcode, as sixteen 32-bit words.
@@ -52,4 +52,101 @@ export function getIndexes(idCodes) {
52
52
  }
53
53
  return indexes;
54
54
  }
55
+ /**
56
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to tautomerism and
57
+ * stereochemistry.
58
+ *
59
+ * Every tautomer of a structure and every stereoisomer of it give the same hash, so two records key
60
+ * to the same value whether the compound was drawn as the keto or the enol form, and whether or not
61
+ * its stereo centres were assigned. That is what makes it the column to look a compound up by when
62
+ * "the same molecule" means the same constitution rather than the same drawing.
63
+ *
64
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoTautomerHash`, so the value matches what any
65
+ * other OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER`
66
+ * column stores and indexes directly:
67
+ *
68
+ * ```js
69
+ * insert.run(entryId, getNoStereoTautomerHash(idCode));
70
+ * ```
71
+ * @param idCode - The molecule to hash, as an idcode.
72
+ * @param options - See {@link HashOptions}.
73
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
74
+ * OpenChemLib cannot canonize.
75
+ */
76
+ export function getNoStereoTautomerHash(idCode, options = {}) {
77
+ const { largestFragmentOnly = false } = options;
78
+ const result = new BigInt64Array(1);
79
+ buildNoStereoTautomerHashes([idCode], result, largestFragmentOnly, 0, 1);
80
+ return result[0];
81
+ }
82
+ /**
83
+ * Hashes every idcode to its no-stereo tautomer hash, one 64-bit value each.
84
+ *
85
+ * See {@link getNoStereoTautomerHash} for what the hash identifies. A drug-like molecule costs
86
+ * around 130 µs, against 520 µs for `openchemlib-js`, and almost all of that is canonizing the
87
+ * generic tautomer rather than the hashing itself. That cost is nothing like uniform: it is driven
88
+ * by how many tautomeric sites the molecule has, and one with a great many can take the better part
89
+ * of a second before OpenChemLib abandons the enumeration — so a library import belongs in a worker
90
+ * rather than on the main thread.
91
+ *
92
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
93
+ * them costs a single allocation and can be written straight into a column.
94
+ * @param idCodes - The molecules to hash, as idcodes.
95
+ * @param options - See {@link HashOptions}.
96
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
97
+ * hashed.
98
+ */
99
+ export function getNoStereoTautomerHashes(idCodes, options = {}) {
100
+ const { largestFragmentOnly = false } = options;
101
+ const result = new BigInt64Array(idCodes.length);
102
+ buildNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, 0, idCodes.length);
103
+ return result;
104
+ }
105
+ /**
106
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to stereochemistry.
107
+ *
108
+ * Every stereoisomer of a structure gives the same hash, and nothing else does: unlike
109
+ * {@link getNoStereoTautomerHash} the tautomers stay apart, so the keto and the enol form of a
110
+ * compound key differently. That makes it the narrower of the two identity columns — the one to use
111
+ * when a record's stereo centres are unreliable but the bonds it was drawn with are not.
112
+ *
113
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoHash`, so the value matches what any other
114
+ * OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER` column
115
+ * stores and indexes directly:
116
+ *
117
+ * ```js
118
+ * insert.run(entryId, getNoStereoHash(idCode));
119
+ * ```
120
+ * @param idCode - The molecule to hash, as an idcode.
121
+ * @param options - See {@link HashOptions}.
122
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
123
+ * OpenChemLib cannot canonize.
124
+ */
125
+ export function getNoStereoHash(idCode, options = {}) {
126
+ const { largestFragmentOnly = false } = options;
127
+ const result = new BigInt64Array(1);
128
+ buildNoStereoHashes([idCode], result, largestFragmentOnly, 0, 1);
129
+ return result[0];
130
+ }
131
+ /**
132
+ * Hashes every idcode to its no-stereo hash, one 64-bit value each.
133
+ *
134
+ * See {@link getNoStereoHash} for what the hash identifies. It costs a fraction of
135
+ * {@link getNoStereoTautomerHashes} because it canonizes the molecule itself instead of enumerating
136
+ * its tautomers, and its cost is even across a library rather than driven by how tautomeric each
137
+ * molecule happens to be.
138
+ *
139
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
140
+ * them costs a single allocation and can be written straight into a column.
141
+ * @param idCodes - The molecules to hash, as idcodes.
142
+ * @param options - See {@link HashOptions}.
143
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
144
+ * hashed.
145
+ */
146
+ export function getNoStereoHashes(idCodes, options = {}) {
147
+ const { largestFragmentOnly = false } = options;
148
+ const result = new BigInt64Array(idCodes.length);
149
+ buildNoStereoHashes(idCodes, result, largestFragmentOnly, 0, idCodes.length);
150
+ return result;
151
+ }
55
152
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC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ts CHANGED
@@ -37,4 +37,31 @@ export declare function checkQuery(mode: SearchMode, idCodeQuery: string): void;
37
37
  * @returns How many molecules were parsed and fingerprinted.
38
38
  */
39
39
  export declare function buildIndexes(idCodes: string[], result: Int32Array, from: number, to: number): number;
40
+ /**
41
+ * Hashes `idCodes[from .. to)` into `result`, one no-stereo tautomer hash per molecule.
42
+ *
43
+ * Like the fingerprints and unlike the searches, a malformed idcode needs no recovery here: the
44
+ * WASM side writes `0` for one it cannot read and carries on, and `0` is also what OpenChemLib
45
+ * returns for a molecule it cannot canonize, so the two failures are reported the same way.
46
+ * @param idCodes - The molecules to hash.
47
+ * @param result - The caller's buffer, `idCodes.length` entries long.
48
+ * @param largestFragmentOnly - Whether to strip and neutralize down to the largest fragment first.
49
+ * @param from - The first index to hash.
50
+ * @param to - One past the last index to hash.
51
+ * @returns How many molecules were hashed.
52
+ */
53
+ export declare function buildNoStereoTautomerHashes(idCodes: string[], result: BigInt64Array, largestFragmentOnly: boolean, from: number, to: number): number;
54
+ /**
55
+ * Hashes `idCodes[from .. to)` into `result`, one no-stereo hash per molecule.
56
+ *
57
+ * Fails the same way {@link buildNoStereoTautomerHashes} does: `0` for an idcode the WASM side
58
+ * cannot read and for a molecule OpenChemLib cannot canonize.
59
+ * @param idCodes - The molecules to hash.
60
+ * @param result - The caller's buffer, `idCodes.length` entries long.
61
+ * @param largestFragmentOnly - Whether to strip and neutralize down to the largest fragment first.
62
+ * @param from - The first index to hash.
63
+ * @param to - One past the last index to hash.
64
+ * @returns How many molecules were hashed.
65
+ */
66
+ export declare function buildNoStereoHashes(idCodes: string[], result: BigInt64Array, largestFragmentOnly: boolean, from: number, to: number): number;
40
67
  //# sourceMappingURL=scan.d.ts.map
package/lib/scan.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CA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,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,aAAa,EACrB,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,MAAM,CAQR"}
package/lib/scan.js CHANGED
@@ -100,4 +100,35 @@ function firstPending(mode, result, from, to) {
100
100
  export function buildIndexes(idCodes, result, from, to) {
101
101
  return Search.getIndexes(idCodes, result, from, to);
102
102
  }
103
+ /**
104
+ * Hashes `idCodes[from .. to)` into `result`, one no-stereo tautomer hash per molecule.
105
+ *
106
+ * Like the fingerprints and unlike the searches, a malformed idcode needs no recovery here: the
107
+ * WASM side writes `0` for one it cannot read and carries on, and `0` is also what OpenChemLib
108
+ * returns for a molecule it cannot canonize, so the two failures are reported the same way.
109
+ * @param idCodes - The molecules to hash.
110
+ * @param result - The caller's buffer, `idCodes.length` entries long.
111
+ * @param largestFragmentOnly - Whether to strip and neutralize down to the largest fragment first.
112
+ * @param from - The first index to hash.
113
+ * @param to - One past the last index to hash.
114
+ * @returns How many molecules were hashed.
115
+ */
116
+ export function buildNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, from, to) {
117
+ return Search.getNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, from, to);
118
+ }
119
+ /**
120
+ * Hashes `idCodes[from .. to)` into `result`, one no-stereo hash per molecule.
121
+ *
122
+ * Fails the same way {@link buildNoStereoTautomerHashes} does: `0` for an idcode the WASM side
123
+ * cannot read and for a molecule OpenChemLib cannot canonize.
124
+ * @param idCodes - The molecules to hash.
125
+ * @param result - The caller's buffer, `idCodes.length` entries long.
126
+ * @param largestFragmentOnly - Whether to strip and neutralize down to the largest fragment first.
127
+ * @param from - The first index to hash.
128
+ * @param to - One past the last index to hash.
129
+ * @returns How many molecules were hashed.
130
+ */
131
+ export function buildNoStereoHashes(idCodes, result, largestFragmentOnly, from, to) {
132
+ return Search.getNoStereoHashes(idCodes, result, largestFragmentOnly, from, to);
133
+ }
103
134
  //# sourceMappingURL=scan.js.map
package/lib/scan.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qGAAqG;AACrG,0FAA0F;AAC1F,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,EAAE,CAAC;AAEnC,kGAAkG;AAClG,8FAA8F;AAC9F,kGAAkG;AAClG,wEAAwE;AACxE,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CACvB,IAAgB,EAChB,WAAmB,EACnB,OAAiB,EACjB,MAAoB,EACpB,IAAY,EACZ,EAAU;IAEV,MAAM,UAAU,GACd,IAAI,KAAK,YAAY;QACnB,CAAC,CAAC,gBAAgB,CAAC,UAAU;QAC7B,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC;IACpC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,OAAO,MAAM,GAAG,EAAE,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YACpD,OAAO;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YACtD,IAAI,MAAM,KAAK,CAAC,CAAC,IAAI,QAAQ,IAAI,cAAc,EAAE,CAAC;gBAChD,MAA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AA2B,CACzC,OAAiB,EACjB,MAAqB,EACrB,mBAA4B,EAC5B,IAAY,EACZ,EAAU;IAEV,OAAO,MAAM,CAAC,yBAAyB,CACrC,OAAO,EACP,MAAM,EACN,mBAAmB,EACnB,IAAI,EACJ,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,MAAqB,EACrB,mBAA4B,EAC5B,IAAY,EACZ,EAAU;IAEV,OAAO,MAAM,CAAC,iBAAiB,CAC7B,OAAO,EACP,MAAM,EACN,mBAAmB,EACnB,IAAI,EACJ,EAAE,CACH,CAAC;AACJ,CAAC"}
package/lib/types.d.ts CHANGED
@@ -162,8 +162,30 @@ export interface OCLSearch {
162
162
  similaritySearch: (idCodeQuery: string, idCodes: string[], result: Float32Array, from: number, to: number) => number;
163
163
  /** Returns how many molecules in the range were parsed and fingerprinted. */
164
164
  getIndexes: (idCodes: string[], result: Int32Array, from: number, to: number) => number;
165
+ /** Returns how many molecules in the range were hashed. */
166
+ getNoStereoTautomerHashes: (idCodes: string[], result: BigInt64Array, largestFragmentOnly: boolean, from: number, to: number) => number;
167
+ /** Returns how many molecules in the range were hashed. */
168
+ getNoStereoHashes: (idCodes: string[], result: BigInt64Array, largestFragmentOnly: boolean, from: number, to: number) => number;
165
169
  };
166
170
  }
167
171
  /** How many 32-bit words one molecule's FragFp fingerprint occupies. */
168
172
  export declare const INDEX_WORDS = 16;
173
+ /** What every hash function takes. */
174
+ export interface HashOptions {
175
+ /**
176
+ * Whether to reduce the molecule to its largest fragment and neutralize it before hashing, so a
177
+ * salt hashes as its parent structure and a hydrochloride as its free base. Off by default, which
178
+ * is what `openchemlib`'s own `CanonizerUtil.getIDCode` does.
179
+ * @default false
180
+ */
181
+ largestFragmentOnly?: boolean;
182
+ }
183
+ /** {@link HashOptions} under the name the tautomer hashes introduced it with. */
184
+ export type TautomerHashOptions = HashOptions;
185
+ /**
186
+ * The hash of a molecule that has none: its idcode could not be parsed, or OpenChemLib could not
187
+ * canonize it. A real hash collides with it once in 2^64, so an equality test against it is a
188
+ * usable "no hash" check.
189
+ */
190
+ export declare const NO_HASH = 0n;
169
191
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;IAC7B,sBAAsB;;IAEtB,oDAAoD;;IAEpD,wDAAwD;;IAExD,0DAA0D;;EAE1D,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;IAC3B,wBAAwB;;IAExB,4DAA4D;;EAE5D,CAAC;AAEH,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IACrB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+BAA+B;AAC/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,GAAG,IAAI,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC9D;;;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AAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,MAAM,CAAC;QACZ,wEAAwE;QACxE,gBAAgB,EAAE,CAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,MAAM,CAAC;QACZ,6EAA6E;QAC7E,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,MAAM,CAAC;QACZ,2DAA2D;QAC3D,yBAAyB,EAAE,CACzB,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,aAAa,EACrB,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,MAAM,CAAC;QACZ,2DAA2D;QAC3D,iBAAiB,EAAE,CACjB,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,aAAa,EACrB,mBAAmB,EAAE,OAAO,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,MAAM,CAAC;KACb,CAAC;CACH;AAED,wEAAwE;AACxE,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,sCAAsC;AACtC,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,iFAAiF;AACjF,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,OAAO,KAAK,CAAC"}
package/lib/types.js CHANGED
@@ -27,4 +27,10 @@ export const SimilarityResult = Object.freeze({
27
27
  });
28
28
  /** How many 32-bit words one molecule's FragFp fingerprint occupies. */
29
29
  export const INDEX_WORDS = 16;
30
+ /**
31
+ * The hash of a molecule that has none: its idcode could not be parsed, or OpenChemLib could not
32
+ * canonize it. A real hash collides with it once in 2^64, so an equality test against it is a
33
+ * usable "no hash" check.
34
+ */
35
+ export const NO_HASH = 0n;
30
36
  //# sourceMappingURL=types.js.map
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,sBAAsB;IACtB,WAAW,EAAE,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,CAAC;IACR,wDAAwD;IACxD,OAAO,EAAE,CAAC;IACV,0DAA0D;IAC1D,UAAU,EAAE,CAAC;CACd,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC,GAAG;IACvB,4DAA4D;IAC5D,UAAU,EAAE,CAAC,CAAC;CACf,CAAC,CAAC;AAwKH,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,sBAAsB;IACtB,WAAW,EAAE,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,CAAC;IACR,wDAAwD;IACxD,OAAO,EAAE,CAAC;IACV,0DAA0D;IAC1D,UAAU,EAAE,CAAC;CACd,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC,GAAG;IACvB,4DAA4D;IAC5D,UAAU,EAAE,CAAC,CAAC;CACf,CAAC,CAAC;AAwLH,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAgB9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openchemlib-search-wasm",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Batch substructure and similarity search over idcodes, with OpenChemLib compiled to WebAssembly",
6
6
  "keywords": [
@@ -30,6 +30,7 @@
30
30
  "build-embed": "node build/embed-wasm.mjs",
31
31
  "build-wasm": "node scripts/build-wasm.mjs",
32
32
  "check-types": "tsc --noEmit",
33
+ "check-wasm": "node scripts/check-wasm.mjs",
33
34
  "clean": "rimraf coverage lib",
34
35
  "dataset": "node scripts/build-dataset.mjs",
35
36
  "dev": "vite dev dev",
package/src/index.ts CHANGED
@@ -1,10 +1,16 @@
1
- import { buildIndexes } from './scan.ts';
1
+ import {
2
+ buildIndexes,
3
+ buildNoStereoHashes,
4
+ buildNoStereoTautomerHashes,
5
+ } from './scan.ts';
6
+ import type { HashOptions } from './types.ts';
2
7
  import { INDEX_WORDS } from './types.ts';
3
8
 
4
9
  export { substructureSearch } from './substructureSearch.ts';
5
10
  export { similaritySearch } from './similaritySearch.ts';
6
- export { INDEX_WORDS } from './types.ts';
11
+ export { INDEX_WORDS, NO_HASH } from './types.ts';
7
12
  export type {
13
+ HashOptions,
8
14
  ResultBuffer,
9
15
  SearchMode,
10
16
  SearchOptions,
@@ -14,6 +20,7 @@ export type {
14
20
  SimilaritySearchResult,
15
21
  SubstructureSearchOptions,
16
22
  SubstructureSearchResult,
23
+ TautomerHashOptions,
17
24
  } from './types.ts';
18
25
  export { SimilarityResult, SubstructureResult } from './types.ts';
19
26
 
@@ -66,3 +73,122 @@ export function getIndexes(idCodes: string[]): Int32Array[] {
66
73
  }
67
74
  return indexes;
68
75
  }
76
+
77
+ /**
78
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to tautomerism and
79
+ * stereochemistry.
80
+ *
81
+ * Every tautomer of a structure and every stereoisomer of it give the same hash, so two records key
82
+ * to the same value whether the compound was drawn as the keto or the enol form, and whether or not
83
+ * its stereo centres were assigned. That is what makes it the column to look a compound up by when
84
+ * "the same molecule" means the same constitution rather than the same drawing.
85
+ *
86
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoTautomerHash`, so the value matches what any
87
+ * other OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER`
88
+ * column stores and indexes directly:
89
+ *
90
+ * ```js
91
+ * insert.run(entryId, getNoStereoTautomerHash(idCode));
92
+ * ```
93
+ * @param idCode - The molecule to hash, as an idcode.
94
+ * @param options - See {@link HashOptions}.
95
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
96
+ * OpenChemLib cannot canonize.
97
+ */
98
+ export function getNoStereoTautomerHash(
99
+ idCode: string,
100
+ options: HashOptions = {},
101
+ ): bigint {
102
+ const { largestFragmentOnly = false } = options;
103
+ const result = new BigInt64Array(1);
104
+ buildNoStereoTautomerHashes([idCode], result, largestFragmentOnly, 0, 1);
105
+ return result[0] as bigint;
106
+ }
107
+
108
+ /**
109
+ * Hashes every idcode to its no-stereo tautomer hash, one 64-bit value each.
110
+ *
111
+ * See {@link getNoStereoTautomerHash} for what the hash identifies. A drug-like molecule costs
112
+ * around 130 µs, against 520 µs for `openchemlib-js`, and almost all of that is canonizing the
113
+ * generic tautomer rather than the hashing itself. That cost is nothing like uniform: it is driven
114
+ * by how many tautomeric sites the molecule has, and one with a great many can take the better part
115
+ * of a second before OpenChemLib abandons the enumeration — so a library import belongs in a worker
116
+ * rather than on the main thread.
117
+ *
118
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
119
+ * them costs a single allocation and can be written straight into a column.
120
+ * @param idCodes - The molecules to hash, as idcodes.
121
+ * @param options - See {@link HashOptions}.
122
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
123
+ * hashed.
124
+ */
125
+ export function getNoStereoTautomerHashes(
126
+ idCodes: string[],
127
+ options: HashOptions = {},
128
+ ): BigInt64Array {
129
+ const { largestFragmentOnly = false } = options;
130
+ const result = new BigInt64Array(idCodes.length);
131
+ buildNoStereoTautomerHashes(
132
+ idCodes,
133
+ result,
134
+ largestFragmentOnly,
135
+ 0,
136
+ idCodes.length,
137
+ );
138
+ return result;
139
+ }
140
+
141
+ /**
142
+ * Hashes one idcode to the 64-bit value OpenChemLib identifies a molecule by up to stereochemistry.
143
+ *
144
+ * Every stereoisomer of a structure gives the same hash, and nothing else does: unlike
145
+ * {@link getNoStereoTautomerHash} the tautomers stay apart, so the keto and the enol form of a
146
+ * compound key differently. That makes it the narrower of the two identity columns — the one to use
147
+ * when a record's stereo centres are unreliable but the bonds it was drawn with are not.
148
+ *
149
+ * It is OpenChemLib's own `CanonizerUtil.getNoStereoHash`, so the value matches what any other
150
+ * OpenChemLib build computes, and it is a signed 64-bit integer — what an SQLite `INTEGER` column
151
+ * stores and indexes directly:
152
+ *
153
+ * ```js
154
+ * insert.run(entryId, getNoStereoHash(idCode));
155
+ * ```
156
+ * @param idCode - The molecule to hash, as an idcode.
157
+ * @param options - See {@link HashOptions}.
158
+ * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
159
+ * OpenChemLib cannot canonize.
160
+ */
161
+ export function getNoStereoHash(
162
+ idCode: string,
163
+ options: HashOptions = {},
164
+ ): bigint {
165
+ const { largestFragmentOnly = false } = options;
166
+ const result = new BigInt64Array(1);
167
+ buildNoStereoHashes([idCode], result, largestFragmentOnly, 0, 1);
168
+ return result[0] as bigint;
169
+ }
170
+
171
+ /**
172
+ * Hashes every idcode to its no-stereo hash, one 64-bit value each.
173
+ *
174
+ * See {@link getNoStereoHash} for what the hash identifies. It costs a fraction of
175
+ * {@link getNoStereoTautomerHashes} because it canonizes the molecule itself instead of enumerating
176
+ * its tautomers, and its cost is even across a library rather than driven by how tautomeric each
177
+ * molecule happens to be.
178
+ *
179
+ * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
180
+ * them costs a single allocation and can be written straight into a column.
181
+ * @param idCodes - The molecules to hash, as idcodes.
182
+ * @param options - See {@link HashOptions}.
183
+ * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
184
+ * hashed.
185
+ */
186
+ export function getNoStereoHashes(
187
+ idCodes: string[],
188
+ options: HashOptions = {},
189
+ ): BigInt64Array {
190
+ const { largestFragmentOnly = false } = options;
191
+ const result = new BigInt64Array(idCodes.length);
192
+ buildNoStereoHashes(idCodes, result, largestFragmentOnly, 0, idCodes.length);
193
+ return result;
194
+ }