@datagrok/bio 2.12.19 → 2.12.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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Aleksandr Tanas",
6
6
  "email": "atanas@datagrok.ai"
7
7
  },
8
- "version": "2.12.19",
8
+ "version": "2.12.21",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@biowasm/aioli": "^3.1.0",
37
- "@datagrok-libraries/bio": "^5.41.5",
37
+ "@datagrok-libraries/bio": "^5.41.6",
38
38
  "@datagrok-libraries/chem-meta": "^1.2.5",
39
39
  "@datagrok-libraries/math": "^1.1.5",
40
40
  "@datagrok-libraries/ml": "^6.6.5",
@@ -106,7 +106,7 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
106
106
  .getSplitted(gridCell.tableRowIndex!).canonicals;
107
107
  if (left !== null && left < seqCList.length) {
108
108
  const monomerSymbol: string = seqCList[left];
109
- const tooltipElements: HTMLElement[] = [ui.div(monomerSymbol)];
109
+ const tooltipElements: HTMLElement[] = [];
110
110
  let monomerDiv = seqColTemp._monomerStructureMap[monomerSymbol];
111
111
  if (!monomerDiv || true) {
112
112
  monomerDiv = seqColTemp._monomerStructureMap[monomerSymbol] = (() => {
@@ -9,10 +9,11 @@ import {Observable, Subject} from 'rxjs';
9
9
  import {
10
10
  IMonomerLib, Monomer, MonomerLibSummaryType, MonomerType, PolymerType, RGroup
11
11
  } from '@datagrok-libraries/bio/src/types';
12
- import {
13
- HELM_REQUIRED_FIELD as REQ, HELM_RGROUP_FIELDS as RGP
14
- } from '@datagrok-libraries/bio/src/utils/const';
12
+ import {PolymerTypes} from '@datagrok-libraries/bio/src/utils/const';
13
+ import {HELM_REQUIRED_FIELD as REQ, HELM_RGROUP_FIELDS as RGP} from '@datagrok-libraries/bio/src/utils/const';
15
14
  import {MolfileHandler} from '@datagrok-libraries/chem-meta/src/parsing-utils/molfile-handler';
15
+ import {GapOriginals} from '@datagrok-libraries/bio/src/utils/seq-handler';
16
+ import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
16
17
 
17
18
  import '../../../css/cell-renderer.css';
18
19
 
@@ -39,9 +40,18 @@ export class MonomerLib implements IMonomerLib {
39
40
  let mSet = this._monomers[polymerType];
40
41
  if (!mSet)
41
42
  mSet = this._monomers[polymerType] = {};
43
+
44
+ let monomerName: string = monomerSymbol;
45
+ if (monomerSymbol === GapOriginals[NOTATION.HELM])
46
+ monomerName = 'Gap';
47
+ else if (polymerType === PolymerTypes.PEPTIDE && monomerSymbol === 'X')
48
+ monomerName = 'Any';
49
+ else if (polymerType === PolymerTypes.RNA && monomerSymbol === 'N')
50
+ monomerName = 'Any';
51
+
42
52
  const m = mSet[monomerSymbol] = {
43
53
  [REQ.SYMBOL]: monomerSymbol,
44
- [REQ.NAME]: monomerSymbol,
54
+ [REQ.NAME]: monomerName,
45
55
  [REQ.MOLFILE]: '',
46
56
  [REQ.AUTHOR]: 'MISSING',
47
57
  [REQ.ID]: -1,
@@ -209,37 +219,47 @@ export class MonomerLib implements IMonomerLib {
209
219
  const res = ui.div([], {classes: 'ui-form ui-tooltip'});
210
220
  const monomer = this.getMonomer(polymerType, monomerSymbol);
211
221
  if (monomer) {
212
- const label = (s: string) => {
213
- return ui.label(s /* span ? */, {classes: 'ui-input-label'});
214
- };
215
- res.append(ui.div([
216
- label('Name'),
217
- ui.divText(monomer.name, {classes: 'ui-input-text'})
218
- ], {classes: 'ui-input-root'}));
222
+ // Symbol & Name
223
+ const symbol = monomer[REQ.SYMBOL];
224
+ const name = monomer[REQ.NAME];
225
+ res.append(ui.divH([
226
+ ui.div([symbol], {style: {fontWeight: 'bolder', textWrap: 'nowrap', marginRight: '6px'}}),
227
+ ui.div([monomer.name])
228
+ ], {style: {display: 'flex', flexDirection: 'row', justifyContent: 'left'}}));
219
229
 
220
230
  // Structure
221
231
  const chemOptions = {autoCrop: true, autoCropMargin: 0, suppressChiralText: true};
232
+ let structureEl: HTMLElement;
222
233
  if (monomer.molfile) {
223
- res.append(ui.div([
224
- label('Mol file'),
225
- grok.chem.svgMol(monomer.molfile, undefined, undefined, chemOptions),
226
- ], {classes: 'ui-input-root'}));
234
+ structureEl = grok.chem.svgMol(monomer.molfile, undefined, undefined, chemOptions);
227
235
  } else if (monomer.smiles) {
228
- res.append(ui.div([
229
- label('Smiles'),
236
+ structureEl = ui.divV([
230
237
  grok.chem.svgMol(monomer.smiles, undefined, undefined, chemOptions),
231
- ], {classes: 'ui-input-root'}));
238
+ ui.divText('from smiles', {style: {fontSize: 'smaller'}}),
239
+ ]);
232
240
  } else {
233
241
  // Unable to get monomer's structure
234
- res.append(ui.div([
235
- label('No structure')
236
- ], {classes: 'ui-input-root'}));
242
+ structureEl = ui.divText('No structure', {style: {margin: '6px'}});
237
243
  }
238
-
239
- res.append(ui.div([
240
- label('Source'),
241
- ui.divText(monomer.lib?.source ?? 'unknown', {classes: 'ui-input-text'}),
242
- ], {classes: 'ui-input-root'}));
244
+ res.append(ui.div(structureEl,
245
+ {style: {display: 'flex', flexDirection: 'row', justifyContent: 'center', margin: '6px'}}));
246
+
247
+ // Source
248
+ res.append(ui.divText(monomer.lib?.source ?? 'unknown'));
249
+
250
+ // const label = (s: string) => {
251
+ // return ui.label(s /* span ? */, {classes: 'ui-input-label'});
252
+ // };
253
+ // res.append(ui.div([
254
+ // label('Name'),
255
+ // ui.divText(monomer.name, {classes: 'ui-input-text'})
256
+ // ], {classes: 'ui-input-root'}));
257
+ //
258
+ //
259
+ // res.append(ui.div([
260
+ // label('Source'),
261
+ // ui.divText(monomer.lib?.source ?? 'unknown', {classes: 'ui-input-text'}),
262
+ // ], {classes: 'ui-input-root'}));
243
263
  } else {
244
264
  res.append(ui.divV([
245
265
  ui.divText(`Monomer '${monomerSymbol}' of type '${polymerType}' not found.`),
package/webpack.config.js CHANGED
@@ -2,7 +2,11 @@ const path = require('path');
2
2
  const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
3
3
  const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
4
4
 
5
- const mode = 'development';
5
+ const mode = process.env.NODE_ENV ?? 'production';
6
+ if (mode !== 'production') {
7
+ console.warn(`Building Bio in '${mode}' mode.`);
8
+ }
9
+
6
10
  module.exports = {
7
11
  cache: {
8
12
  type: 'filesystem',
@@ -30,7 +34,7 @@ module.exports = {
30
34
  plugins: [
31
35
  new FuncGeneratorPlugin({outputPath: './src/package.g.ts'}),
32
36
  ],
33
- devtool: mode === 'development' ? 'source-map' : 'inline-source-map',
37
+ devtool: mode !== 'production' ? 'inline-source-map' : 'source-map',
34
38
  externals: {
35
39
  'datagrok-api/dg': 'DG',
36
40
  'datagrok-api/grok': 'grok',