@datagrok/sequence-translator 1.10.20 → 1.10.21
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/CHANGELOG.md +1 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/polytool/pt-chem-enum-dialog.ts +11 -3
- package/test-console-output-1.log +148 -147
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
extractRNumbers,
|
|
20
20
|
makeCore,
|
|
21
21
|
makeRGroup,
|
|
22
|
+
normalizeRLabels,
|
|
22
23
|
validateParams,
|
|
23
24
|
} from './pt-chem-enum';
|
|
24
25
|
import {_package} from '../package';
|
|
@@ -50,11 +51,17 @@ interface CardOpts {
|
|
|
50
51
|
onRemove?: () => void;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
// Popular multi symbol single atoms for quick lookup in card builder
|
|
55
|
+
const SINGLE_ATOM_SYMBOLS_LOOKUP = new Set([
|
|
56
|
+
'Cl', 'Br', 'Al', 'Si', 'Li', 'Na', 'Mg', 'Ca', 'Ti', 'At', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Kr', 'Rb',
|
|
57
|
+
'Au', 'Ag', 'Pt', 'Pb', 'Sn', 'Sb', 'Te', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho']);
|
|
58
|
+
|
|
53
59
|
/** Draws a molecule into a fixed-size host, constraining SVG dimensions. */
|
|
54
60
|
function drawMolInto(host: HTMLElement, smi: string, w: number, h: number): void {
|
|
55
61
|
ui.empty(host);
|
|
56
62
|
try {
|
|
57
|
-
const
|
|
63
|
+
const correctedSmi = smi.length === 1 || SINGLE_ATOM_SYMBOLS_LOOKUP.has(smi) ? `[${smi}]` : smi;
|
|
64
|
+
const el = grok.chem.drawMolecule(correctedSmi, w, h);
|
|
58
65
|
el.style.width = `${w}px`;
|
|
59
66
|
el.style.height = `${h}px`;
|
|
60
67
|
el.style.maxWidth = `${w}px`;
|
|
@@ -72,7 +79,8 @@ function buildCard(opts: CardOpts): HTMLElement {
|
|
|
72
79
|
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
73
80
|
background: 'transparent', overflow: 'hidden', flex: '0 0 auto',
|
|
74
81
|
}});
|
|
75
|
-
if (opts.smiles && !opts.error)
|
|
82
|
+
if (opts.smiles && !opts.error)
|
|
83
|
+
drawMolInto(thumbHost, opts.smiles, THUMB_W, THUMB_H);
|
|
76
84
|
else thumbHost.appendChild(ui.divText('—', {style: {color: 'var(--grey-4)'}}));
|
|
77
85
|
|
|
78
86
|
const subtitleEl = ui.divText(opts.subtitle, {style: {
|
|
@@ -1249,7 +1257,7 @@ async function executeEnumeration(state: ChemEnumDialogState, _rdkit: RDModule):
|
|
|
1249
1257
|
|
|
1250
1258
|
const smilesCol = DG.Column.fromStrings('Enumerated', results.map((r) => r.smiles));
|
|
1251
1259
|
smilesCol.semType = DG.SEMTYPE.MOLECULE;
|
|
1252
|
-
const coreCol = DG.Column.fromStrings('Core', results.map((r) => r.coreSmiles));
|
|
1260
|
+
const coreCol = DG.Column.fromStrings('Core', results.map((r) => normalizeRLabels(r.coreSmiles ?? '')));
|
|
1253
1261
|
coreCol.semType = DG.SEMTYPE.MOLECULE;
|
|
1254
1262
|
const rCols = sortedRs.map((n) =>
|
|
1255
1263
|
DG.Column.fromStrings(`R${n}`, results.map((r) => r.rGroupSmilesByNum.get(n) ?? '')));
|