openchemlib-search-wasm 1.1.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
 
@@ -30,9 +30,13 @@ similaritySearch<Entry>(idCodeQuery: string, entries: Entry[],
30
30
  getIndex(idCode: string): Int32Array;
31
31
  getIndexes(idCodes: string[]): Int32Array[];
32
32
 
33
- // the 64-bit hash a molecule keeps across its tautomers and stereoisomers
34
- getNoStereoTautomerHash(idCode: string, options?: TautomerHashOptions): bigint;
35
- getNoStereoTautomerHashes(idCodes: string[], options?: TautomerHashOptions): BigInt64Array;
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;
36
40
  ```
37
41
 
38
42
  **Give it your objects and it gives them back.** An entry is an idcode or anything carrying one — a
@@ -142,34 +146,64 @@ const columns = new BigInt64Array(index.buffer, index.byteOffset, 8);
142
146
 
143
147
  This is the expensive half of importing a library, and where the biggest speedup is.
144
148
 
145
- ## Tautomer hashes
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.
146
165
 
147
- `getNoStereoTautomerHash` is OpenChemLib's `CanonizerUtil.getNoStereoTautomerHash`: the molecule
148
- stripped of stereo information, reduced to its generic tautomer, canonized, and that idcode run
149
- through OpenChemLib's 64-bit hash. Every tautomer of a structure and every stereoisomer of it give
150
- the same value, so it is the column to key on when "the same compound" means the same constitution
151
- rather than the same drawing.
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.
152
169
 
153
170
  ```js
154
- import { getNoStereoTautomerHash } from 'openchemlib-search-wasm';
171
+ import {
172
+ getNoStereoHash,
173
+ getNoStereoTautomerHash,
174
+ } from 'openchemlib-search-wasm';
175
+
176
+ // both enantiomers of 2-chlorobutane
177
+ getNoStereoHash('gJPHADILuTb@') === getNoStereoHash('gJPHADILuTd@'); // true
155
178
 
156
179
  // pentan-3-one drawn as the keto and as the enol form
180
+ getNoStereoHash('gGQ@@drmT@@') === getNoStereoHash('gGQ@@drsT@@'); // false
157
181
  getNoStereoTautomerHash('gGQ@@drmT@@') ===
158
182
  getNoStereoTautomerHash('gGQ@@drsT@@'); // true
159
183
  ```
160
184
 
161
- It is a signed 64-bit integer, which is exactly what an SQLite `INTEGER` column stores and indexes,
162
- so a `BigInt64Array` of hashes goes straight into one. An idcode that will not parse, or a molecule
163
- OpenChemLib cannot canonize, gets `NO_HASH` (`0n`).
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.
164
197
 
165
- Pass `{ largestFragmentOnly: true }` to strip everything but the largest fragment and neutralize it
166
- first, so a salt hashes as its parent structure.
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.
167
203
 
168
- The hash is the same value any other OpenChemLib build computes — the tests check all 250 fixture
169
- molecules against `openchemlib` — and costs around 130 µs against 520 µs there. That cost is driven
170
- by how many tautomeric sites a molecule has and is nothing like uniform: a molecule with a great
171
- many can take the better part of a second before OpenChemLib abandons the enumeration, so hash a
172
- library in a worker rather than on the main thread.
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.
173
207
 
174
208
  ## What you actually win
175
209
 
package/lib/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { TautomerHashOptions } from './types.ts';
1
+ import type { HashOptions } from './types.ts';
2
2
  export { substructureSearch } from './substructureSearch.ts';
3
3
  export { similaritySearch } from './similaritySearch.ts';
4
4
  export { INDEX_WORDS, NO_HASH } from './types.ts';
5
- export type { ResultBuffer, SearchMode, SearchOptions, SearchResult, SearchStep, SimilaritySearchOptions, SimilaritySearchResult, SubstructureSearchOptions, SubstructureSearchResult, TautomerHashOptions, } from './types.ts';
5
+ export type { HashOptions, ResultBuffer, SearchMode, SearchOptions, SearchResult, SearchStep, SimilaritySearchOptions, SimilaritySearchResult, SubstructureSearchOptions, SubstructureSearchResult, TautomerHashOptions, } from './types.ts';
6
6
  export { SimilarityResult, SubstructureResult } from './types.ts';
7
7
  /**
8
8
  * Builds the 512-bit FragFp fingerprint of one idcode, as sixteen 32-bit words.
@@ -57,11 +57,11 @@ export declare function getIndexes(idCodes: string[]): Int32Array[];
57
57
  * insert.run(entryId, getNoStereoTautomerHash(idCode));
58
58
  * ```
59
59
  * @param idCode - The molecule to hash, as an idcode.
60
- * @param options - See {@link TautomerHashOptions}.
60
+ * @param options - See {@link HashOptions}.
61
61
  * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
62
62
  * OpenChemLib cannot canonize.
63
63
  */
64
- export declare function getNoStereoTautomerHash(idCode: string, options?: TautomerHashOptions): bigint;
64
+ export declare function getNoStereoTautomerHash(idCode: string, options?: HashOptions): bigint;
65
65
  /**
66
66
  * Hashes every idcode to its no-stereo tautomer hash, one 64-bit value each.
67
67
  *
@@ -75,9 +75,46 @@ export declare function getNoStereoTautomerHash(idCode: string, options?: Tautom
75
75
  * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
76
76
  * them costs a single allocation and can be written straight into a column.
77
77
  * @param idCodes - The molecules to hash, as idcodes.
78
- * @param options - See {@link TautomerHashOptions}.
78
+ * @param options - See {@link HashOptions}.
79
79
  * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
80
80
  * hashed.
81
81
  */
82
- export declare function getNoStereoTautomerHashes(idCodes: string[], options?: TautomerHashOptions): BigInt64Array;
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;
83
120
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAE,kBAAkB,E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B,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAInD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAQ1D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,WAAgB,GACxB,MAAM,CAKR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,GAAE,WAAgB,GACxB,aAAa,CAWf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,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,4 +1,4 @@
1
- import { buildIndexes, buildNoStereoTautomerHashes } 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";
@@ -69,7 +69,7 @@ export function getIndexes(idCodes) {
69
69
  * insert.run(entryId, getNoStereoTautomerHash(idCode));
70
70
  * ```
71
71
  * @param idCode - The molecule to hash, as an idcode.
72
- * @param options - See {@link TautomerHashOptions}.
72
+ * @param options - See {@link HashOptions}.
73
73
  * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
74
74
  * OpenChemLib cannot canonize.
75
75
  */
@@ -92,7 +92,7 @@ export function getNoStereoTautomerHash(idCode, options = {}) {
92
92
  * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
93
93
  * them costs a single allocation and can be written straight into a column.
94
94
  * @param idCodes - The molecules to hash, as idcodes.
95
- * @param options - See {@link TautomerHashOptions}.
95
+ * @param options - See {@link HashOptions}.
96
96
  * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
97
97
  * hashed.
98
98
  */
@@ -102,4 +102,51 @@ export function getNoStereoTautomerHashes(idCodes, options = {}) {
102
102
  buildNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, 0, idCodes.length);
103
103
  return result;
104
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
+ }
105
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,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAalD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,C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CAAW,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAiB,EACjB,UAAuB,EAAE;IAEzB,MAAM,EAAE,mBAAmB,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/lib/scan.d.ts CHANGED
@@ -51,4 +51,17 @@ export declare function buildIndexes(idCodes: string[], result: Int32Array, from
51
51
  * @returns How many molecules were hashed.
52
52
  */
53
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;
54
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,CAAC;AAc3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SA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AAM,GACT,MAAM,CAER;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,aAAa,EACrB,mBAAmB,EAAE,OAAO,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
@@ -116,4 +116,19 @@ export function buildIndexes(idCodes, result, from, to) {
116
116
  export function buildNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, from, to) {
117
117
  return Search.getNoStereoTautomerHashes(idCodes, result, largestFragmentOnly, from, to);
118
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
+ }
119
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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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
@@ -164,12 +164,14 @@ export interface OCLSearch {
164
164
  getIndexes: (idCodes: string[], result: Int32Array, from: number, to: number) => number;
165
165
  /** Returns how many molecules in the range were hashed. */
166
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;
167
169
  };
168
170
  }
169
171
  /** How many 32-bit words one molecule's FragFp fingerprint occupies. */
170
172
  export declare const INDEX_WORDS = 16;
171
- /** What the no-stereo tautomer hash functions take. */
172
- export interface TautomerHashOptions {
173
+ /** What every hash function takes. */
174
+ export interface HashOptions {
173
175
  /**
174
176
  * Whether to reduce the molecule to its largest fragment and neutralize it before hashing, so a
175
177
  * salt hashes as its parent structure and a hydrochloride as its free base. Off by default, which
@@ -178,6 +180,8 @@ export interface TautomerHashOptions {
178
180
  */
179
181
  largestFragmentOnly?: boolean;
180
182
  }
183
+ /** {@link HashOptions} under the name the tautomer hashes introduced it with. */
184
+ export type TautomerHashOptions = HashOptions;
181
185
  /**
182
186
  * The hash of a molecule that has none: its idcode could not be parsed, or OpenChemLib could not
183
187
  * canonize it. A real hash collides with it once in 2^64, so an equality test against it is a
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../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ED
@@ -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;AAgLH,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAa9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,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.1.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": [
package/src/index.ts CHANGED
@@ -1,11 +1,16 @@
1
- import { buildIndexes, buildNoStereoTautomerHashes } from './scan.ts';
2
- import type { TautomerHashOptions } from './types.ts';
1
+ import {
2
+ buildIndexes,
3
+ buildNoStereoHashes,
4
+ buildNoStereoTautomerHashes,
5
+ } from './scan.ts';
6
+ import type { HashOptions } from './types.ts';
3
7
  import { INDEX_WORDS } from './types.ts';
4
8
 
5
9
  export { substructureSearch } from './substructureSearch.ts';
6
10
  export { similaritySearch } from './similaritySearch.ts';
7
11
  export { INDEX_WORDS, NO_HASH } from './types.ts';
8
12
  export type {
13
+ HashOptions,
9
14
  ResultBuffer,
10
15
  SearchMode,
11
16
  SearchOptions,
@@ -86,13 +91,13 @@ export function getIndexes(idCodes: string[]): Int32Array[] {
86
91
  * insert.run(entryId, getNoStereoTautomerHash(idCode));
87
92
  * ```
88
93
  * @param idCode - The molecule to hash, as an idcode.
89
- * @param options - See {@link TautomerHashOptions}.
94
+ * @param options - See {@link HashOptions}.
90
95
  * @returns Its hash, or `NO_HASH` (`0n`) for an idcode that will not parse or a molecule
91
96
  * OpenChemLib cannot canonize.
92
97
  */
93
98
  export function getNoStereoTautomerHash(
94
99
  idCode: string,
95
- options: TautomerHashOptions = {},
100
+ options: HashOptions = {},
96
101
  ): bigint {
97
102
  const { largestFragmentOnly = false } = options;
98
103
  const result = new BigInt64Array(1);
@@ -113,13 +118,13 @@ export function getNoStereoTautomerHash(
113
118
  * The hashes come back in one `BigInt64Array` rather than one value per molecule, so a table of
114
119
  * them costs a single allocation and can be written straight into a column.
115
120
  * @param idCodes - The molecules to hash, as idcodes.
116
- * @param options - See {@link TautomerHashOptions}.
121
+ * @param options - See {@link HashOptions}.
117
122
  * @returns One hash per idcode, in order, with `NO_HASH` (`0n`) for each one that could not be
118
123
  * hashed.
119
124
  */
120
125
  export function getNoStereoTautomerHashes(
121
126
  idCodes: string[],
122
- options: TautomerHashOptions = {},
127
+ options: HashOptions = {},
123
128
  ): BigInt64Array {
124
129
  const { largestFragmentOnly = false } = options;
125
130
  const result = new BigInt64Array(idCodes.length);
@@ -132,3 +137,58 @@ export function getNoStereoTautomerHashes(
132
137
  );
133
138
  return result;
134
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
+ }
package/src/scan.ts CHANGED
@@ -168,3 +168,31 @@ export function buildNoStereoTautomerHashes(
168
168
  to,
169
169
  );
170
170
  }
171
+
172
+ /**
173
+ * Hashes `idCodes[from .. to)` into `result`, one no-stereo hash per molecule.
174
+ *
175
+ * Fails the same way {@link buildNoStereoTautomerHashes} does: `0` for an idcode the WASM side
176
+ * cannot read and for a molecule OpenChemLib cannot canonize.
177
+ * @param idCodes - The molecules to hash.
178
+ * @param result - The caller's buffer, `idCodes.length` entries long.
179
+ * @param largestFragmentOnly - Whether to strip and neutralize down to the largest fragment first.
180
+ * @param from - The first index to hash.
181
+ * @param to - One past the last index to hash.
182
+ * @returns How many molecules were hashed.
183
+ */
184
+ export function buildNoStereoHashes(
185
+ idCodes: string[],
186
+ result: BigInt64Array,
187
+ largestFragmentOnly: boolean,
188
+ from: number,
189
+ to: number,
190
+ ): number {
191
+ return Search.getNoStereoHashes(
192
+ idCodes,
193
+ result,
194
+ largestFragmentOnly,
195
+ from,
196
+ to,
197
+ );
198
+ }
package/src/types.ts CHANGED
@@ -198,14 +198,22 @@ export interface OCLSearch {
198
198
  from: number,
199
199
  to: number,
200
200
  ) => number;
201
+ /** Returns how many molecules in the range were hashed. */
202
+ getNoStereoHashes: (
203
+ idCodes: string[],
204
+ result: BigInt64Array,
205
+ largestFragmentOnly: boolean,
206
+ from: number,
207
+ to: number,
208
+ ) => number;
201
209
  };
202
210
  }
203
211
 
204
212
  /** How many 32-bit words one molecule's FragFp fingerprint occupies. */
205
213
  export const INDEX_WORDS = 16;
206
214
 
207
- /** What the no-stereo tautomer hash functions take. */
208
- export interface TautomerHashOptions {
215
+ /** What every hash function takes. */
216
+ export interface HashOptions {
209
217
  /**
210
218
  * Whether to reduce the molecule to its largest fragment and neutralize it before hashing, so a
211
219
  * salt hashes as its parent structure and a hydrochloride as its free base. Off by default, which
@@ -215,6 +223,9 @@ export interface TautomerHashOptions {
215
223
  largestFragmentOnly?: boolean;
216
224
  }
217
225
 
226
+ /** {@link HashOptions} under the name the tautomer hashes introduced it with. */
227
+ export type TautomerHashOptions = HashOptions;
228
+
218
229
  /**
219
230
  * The hash of a molecule that has none: its idcode could not be parsed, or OpenChemLib could not
220
231
  * canonize it. A real hash collides with it once in 2^64, so an equality test against it is a