@datagrok/bio 2.24.0 → 2.25.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/455.js.map +1 -1
  3. package/dist/package-test.js +2 -2
  4. package/dist/package-test.js.map +1 -1
  5. package/dist/package.js +2 -2
  6. package/dist/package.js.map +1 -1
  7. package/files/samples/HELM_CHEMS.csv +11 -0
  8. package/package.json +2 -2
  9. package/src/analysis/sequence-space.ts +1 -1
  10. package/src/demo/bio03-atomic-level.ts +1 -1
  11. package/src/package-types.ts +1 -1
  12. package/src/package.ts +1 -1
  13. package/src/tests/monomer-libraries-tests.ts +1 -1
  14. package/src/utils/get-region.ts +2 -2
  15. package/src/utils/helm-to-molfile/converter/const.ts +0 -1
  16. package/src/utils/helm-to-molfile/converter/converter.ts +3 -3
  17. package/src/utils/helm-to-molfile/converter/helm.ts +14 -6
  18. package/src/utils/helm-to-molfile/converter/mol-bonds.ts +1 -1
  19. package/src/utils/helm-to-molfile/converter/mol-wrapper.ts +2 -2
  20. package/src/utils/helm-to-molfile/converter/r-group-handler.ts +2 -2
  21. package/src/utils/monomer-lib/library-file-manager/file-validator.ts +1 -1
  22. package/src/utils/monomer-lib/library-file-manager/ui.ts +1 -1
  23. package/src/utils/monomer-lib/monomer-lib-base.ts +31 -3
  24. package/src/utils/monomer-lib/monomer-lib.ts +0 -26
  25. package/src/utils/monomer-lib/monomer-manager/monomer-manager.ts +1 -1
  26. package/src/utils/monomer-lib/smiles2Monomer.ts +128 -0
  27. package/src/utils/monomer-lib/web-editor-monomer-dummy.ts +15 -1
  28. package/src/utils/multiple-sequence-alignment-ui.ts +1 -1
  29. package/src/utils/multiple-sequence-alignment.ts +1 -1
  30. package/src/utils/seq-helper/seq-handler.ts +10 -10
  31. package/src/utils/ui-utils.ts +1 -1
  32. package/src/viewers/web-logo-viewer.ts +19 -8
  33. package/test-console-output-1.log +338 -341
  34. package/test-record-1.mp4 +0 -0
@@ -34,6 +34,7 @@ import {AggFunc, getAgg} from '../utils/agg';
34
34
  import {_package, PackageFunctions} from '../package';
35
35
  import {numbersWithinMaxDiff} from './utils';
36
36
  import {buildCompositionTable} from '@datagrok-libraries/bio/src/utils/composition-table';
37
+ import {helmTypeToPolymerType} from '@datagrok-libraries/bio/src/monomer-works/monomer-works';
37
38
 
38
39
  declare global {
39
40
  interface HTMLCanvasElement {
@@ -212,14 +213,24 @@ export class PositionInfo {
212
213
  ) {
213
214
  for (const [monomer, pmInfo] of Object.entries(this._freqs)) {
214
215
  if (monomer !== GAP_SYMBOL) {
215
- const monomerTxt = monomerToShort(monomer, maxMonomerLetters);
216
+ // to handle explicit smiles based monomers in monomer lib
217
+ let monomerDisplayValue = monomer;
218
+
216
219
  const b = pmInfo.bounds!;
217
220
  const left = b.left;
218
221
 
219
222
  let color: string = undefinedColor;
220
- if (monomerLib)
221
- color = monomerLib.getMonomerTextColor(biotype, monomer)!;
222
-
223
+ if (monomerLib) {
224
+ try {
225
+ color = monomerLib.getMonomerTextColor(biotype, monomer)!;
226
+ const m = monomerLib.getMonomer(helmTypeToPolymerType(biotype), monomer);
227
+ if (m && m.symbol !== monomer) // for explicit smiles based monomers
228
+ monomerDisplayValue = m.symbol;
229
+ } catch (e) {
230
+ errorToConsole(e);
231
+ }
232
+ }
233
+ const monomerTxt = monomerToShort(monomerDisplayValue, maxMonomerLetters);
223
234
  g.resetTransform();
224
235
  g.strokeStyle = 'lightgray';
225
236
  g.lineWidth = 1;
@@ -949,7 +960,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
949
960
  return [null, null, null];
950
961
 
951
962
  const monomer: string | undefined = pi.getMonomerAt(calculatedX, p.y);
952
- if (monomer === undefined)
963
+ if (monomer == undefined)
953
964
  return [pi, null, null];
954
965
 
955
966
  return [pi, monomer, pi.getFreq(monomer)];
@@ -1262,7 +1273,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
1262
1273
  const [pi, monomer] = this.getMonomer(cursorP, dpr);
1263
1274
  const positionLabelHeight = this.showPositionLabels ? POSITION_LABELS_HEIGHT * dpr : 0;
1264
1275
 
1265
- if (pi !== null && monomer === null && 0 <= cursorP.y && cursorP.y <= positionLabelHeight) {
1276
+ if (pi !== null && monomer == null && 0 <= cursorP.y && cursorP.y <= positionLabelHeight) {
1266
1277
  // Position tooltip
1267
1278
 
1268
1279
  const tooltipRows = [ui.divText(`Position ${pi.label}`)];
@@ -1373,8 +1384,8 @@ function renderPositionLabels(g: CanvasRenderingContext2D,
1373
1384
  const pos = positions[jPos];
1374
1385
  const tm = g.measureText(pos.name);
1375
1386
  const textHeight = tm.actualBoundingBoxDescent - tm.actualBoundingBoxAscent;
1376
- maxPosNameWidth = maxPosNameWidth === null ? tm.width : Math.max(maxPosNameWidth, tm.width);
1377
- maxPosNameHeight = maxPosNameHeight === null ? textHeight : Math.max(maxPosNameHeight, textHeight);
1387
+ maxPosNameWidth = maxPosNameWidth == null ? tm.width : Math.max(maxPosNameWidth, tm.width);
1388
+ maxPosNameHeight = maxPosNameHeight == null ? textHeight : Math.max(maxPosNameHeight, textHeight);
1378
1389
  }
1379
1390
  const hScale = maxPosNameWidth! < (positionWidth * dpr - 2) ? 1 : (positionWidth * dpr - 2) / maxPosNameWidth!;
1380
1391