@datagrok/bio 1.7.2 → 1.7.5

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.
@@ -0,0 +1,101 @@
1
+ id,sequence
2
+ 1,M-F-I-T-M-F-C-M-F-W-L-F-I-F-I-L-M-M-L-I-F-F-M-E-A-M-I-K-P-M-L
3
+ 2,A-Q-M-T-M-F-C-I-M-F-F-L-M-L-M-F-I-I-M-I-M-F-M-I-L-E-A-M-K-K-M-L-N-A-I
4
+ 3,I-L-M-T-M-F-C-I-C-W-M-I-M-I-F-F-L-L-L-I-M-F-M-L-M-A-M-M-K-M-L-I-F-L
5
+ 4,F-Q-M-T-M-I-C-M-L-F-F-L-M-M-F-M-F-D-L-I-I-L-F-I-M-M-E-A-M-M-K-P-D-L-M-F-I
6
+ 5,L-L-M-T-M-F-C-F-F-M-M-L-L-M-F-F-M-F-M-I-M-F-M-Y-F-E-A-M-K-K-F-F-I-L-F
7
+ 6,A-M-M-T-M-F-C-F-M-L-I-M-M-F-I-L-L-F-I-D-I-I-M-E-A-M-L-K-L-D-N-F-I
8
+ 7,L-L-M-T-M-F-C-M-I-L-I-S-M-I-M-I-L-M-M-I-M-F-L-M-E-A-M-K-K-I-F-F-A-V
9
+ 8,L-I-M-T-M-F-C-M-L-I-L-I-F-M-L-M-D-F-M-I-I-M-I-F-F-E-A-M-F-K-M-L-F-L-M-F
10
+ 9,F-Q-M-T-M-F-C-L-M-I-F-M-W-I-F-M-M-M-M-I-L-D-I-F-I-E-A-M-I-K-F-I-N-L-F-M
11
+ 10,F-L-M-T-M-F-C-I-L-I-N-I-M-I-I-W-M-I-I-M-L-M-F-E-A-M-F-K-L-D-I-I-F
12
+ 11,F-F-M-T-M-F-C-M-M-I-F-L-L-L-I-M-I-I-I-M-I-M-D-M-I-M-E-A-M-K-K-M-M-D-I-I-I
13
+ 12,I-M-M-T-M-F-C-I-C-L-L-F-W-L-L-F-M-L-L-I-M-D-M-M-F-E-A-M-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M-T-M-F-C-M-F-I-N-L-W-I-F-F-L-L-D-I-F-F-L-I-M-E-A-M-K-L-D-M-I-M
94
+ 93,L-L-M-T-M-F-C-M-F-I-I-M-L-F-F-L-F-M-F-L-I-M-F-F-I-D-E-A-M-F-K-P-L-F-I-M
95
+ 94,F-F-M-T-M-F-C-I-F-F-M-S-L-H-L-F-M-L-L-I-I-F-M-F-D-E-A-M-K-K-M-L-L-F-I
96
+ 95,I-F-F-T-M-F-L-I-F-L-L-F-I-M-M-M-I-D-M-I-I-F-I-L-L-E-A-M-K-K-P-M-F-I-I
97
+ 96,M-F-M-M-T-M-F-C-F-M-I-I-F-F-M-M-M-D-I-M-I-I-M-D-F-I-L-E-A-M-L-K-I-F-L-I-I-I
98
+ 97,I-I-M-T-M-F-C-M-I-I-N-M-L-F-F-D-L-L-I-I-I-L-L-E-A-M-L-K-F-D-M-F-F
99
+ 98,M-L-M-T-M-F-C-M-L-L-I-M-F-M-I-L-I-L-M-F-I-F-L-L-Y-D-E-A-M-K-K-M-L-M-L-I
100
+ 99,L-F-M-T-M-F-C-M-L-I-N-S-L-I-M-I-F-F-D-I-I-I-F-L-E-A-M-F-K-F-F-L-I-L-L
101
+ 100,F-L-M-T-M-F-C-M-M-M-F-S-M-M-M-M-F-I-I-F-M-L-L-I-E-A-M-L-K-I-F-N-A-L
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@datagrok/bio",
3
3
  "beta": false,
4
4
  "friendlyName": "Bio",
5
- "version": "1.7.2",
5
+ "version": "1.7.5",
6
6
  "description": "Bio is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform",
7
7
  "repository": {
8
8
  "type": "git",
@@ -11,12 +11,13 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@biowasm/aioli": ">=2.4.0",
14
- "@datagrok-libraries/bio": "^2.5.0",
14
+ "@datagrok-libraries/bio": "2.8.3",
15
15
  "@datagrok-libraries/utils": "^1.0.0",
16
16
  "@datagrok-libraries/ml": "^2.0.10",
17
17
  "cash-dom": "latest",
18
18
  "datagrok-api": "^1.4.12",
19
19
  "dayjs": "latest",
20
+ "rxjs": "^6.5.5",
20
21
  "ts-loader": "^9.2.5",
21
22
  "typescript": "^4.4.2",
22
23
  "openchemlib": "6.0.1"
package/src/const.ts CHANGED
@@ -2,3 +2,24 @@ import * as ui from 'datagrok-api/ui';
2
2
  import * as grok from 'datagrok-api/grok';
3
3
  import * as DG from 'datagrok-api/dg';
4
4
 
5
+ export const jsonSdfMonomerLibDict = {
6
+ "monomerType": null,
7
+ "smiles": null,
8
+ "name": "MonomerName",
9
+ "author": null,
10
+ "molfile": "molecule",
11
+ "naturalAnalog": "MonomerNaturalAnalogCode",
12
+ "rgroups": "MonomerCaps",
13
+ "createDate": null,
14
+ "id": null,
15
+ "polymerType": "MonomerType",
16
+ "symbol": "MonomerCode"
17
+ }
18
+
19
+ export const RGROUP_FIELD = "rgroups";
20
+ export const CAP_GROUP_SMILES = "capGroupSmiles";
21
+ export const RGROUP_ALTER_ID = "alternateId";
22
+ export const CAP_GROUP_NAME = "capGroupName";
23
+ export const RGROUP_LABEL = "label";
24
+ export const MONOMER_SYMBOL = "symbol";
25
+ export const SDF_MONOMER_NAME = "MonomerName";
@@ -8,8 +8,8 @@ import './tests/detectors-test';
8
8
  import './tests/msa-tests';
9
9
  import './tests/sequence-space-test';
10
10
  import './tests/activity-cliffs-tests';
11
- import './tests/splitter-test';
12
- import './tests/renderer-test';
11
+ import './tests/splitters-test';
12
+ import './tests/renderers-test';
13
13
  import './tests/convert-test';
14
14
 
15
15
  export const _package = new DG.Package();
package/src/package.ts CHANGED
@@ -11,18 +11,14 @@ import {runKalign, testMSAEnoughMemory} from './utils/multiple-sequence-alignmen
11
11
  import {SequenceAlignment, Aligned} from './seq_align';
12
12
  import {Nucleotides} from '@datagrok-libraries/bio/src/nucleotides';
13
13
  import {Aminoacids} from '@datagrok-libraries/bio/src/aminoacids';
14
- import {convert} from './utils/convert';
15
14
  import {getEmbeddingColsNames, sequenceSpace} from './utils/sequence-space';
16
15
  import {AvailableMetrics} from '@datagrok-libraries/ml/src/typed-metrics';
17
16
  import {getActivityCliffs} from '@datagrok-libraries/ml/src/viewers/activity-cliffs';
18
17
  import {sequenceGetSimilarities, drawTooltip} from './utils/sequence-activity-cliffs';
19
- import {getMolfilesFromSeq, HELM_CORE_LIB_FILENAME} from './utils/utils';
18
+ import {createJsonMonomerLibFromSdf, getMolfilesFromSeq, HELM_CORE_LIB_FILENAME} from './utils/utils';
20
19
  import {getMacroMol} from './utils/atomic-works';
21
20
  import {MacromoleculeSequenceCellRenderer} from './utils/cell-renderer';
22
- import {Column} from 'datagrok-api/dg';
23
- import {SEM_TYPES} from './utils/constants';
24
- import { delay } from '@datagrok-libraries/utils/src/test';
25
- import { TableView } from 'datagrok-api/dg';
21
+ import {convert} from './utils/convert';
26
22
 
27
23
  //tags: init
28
24
  export async function initBio(): Promise<void> {
@@ -175,21 +171,22 @@ export async function toAtomicLevel(df: DG.DataFrame, macroMolecule: DG.Column):
175
171
  if (!checkInputColumn(macroMolecule, 'To Atomic Level'))
176
172
  return;
177
173
 
178
- let currentView: TableView;
179
- for (let view of grok.shell.tableViews) {
180
- if (df.name === view.name) {
174
+ let currentView: DG.TableView;
175
+ for (const view of grok.shell.tableViews) {
176
+ if (df.name === view.name)
181
177
  currentView = view;
182
- }
183
178
  }
184
- const file = await _package.files.readAsText('tests/sar-small.csv');
185
- const df2 = DG.DataFrame.fromCsv(file);
186
- const v = grok.shell.addTableView(df2);
187
- setTimeout(()=> {
179
+
180
+ // Some hack to activate Chem Molecule rendering
181
+ const file2 = await _package.files.readAsText('tests/sar-small.csv');
182
+ const df2 = DG.DataFrame.fromCsv(file2);
183
+ const v2 = grok.shell.addTableView(df2);
184
+ setTimeout(() => {
188
185
  grok.shell.closeTable(df2);
189
- v.close();
186
+ v2.close();
190
187
  grok.shell.v = currentView;
191
188
  }, 100);
192
-
189
+
193
190
  const monomersLibFile = await _package.files.readAsText(HELM_CORE_LIB_FILENAME);
194
191
  const monomersLibObject: any[] = JSON.parse(monomersLibFile);
195
192
  const atomicCodes = getMolfilesFromSeq(macroMolecule, monomersLibObject);
@@ -199,7 +196,6 @@ export async function toAtomicLevel(df: DG.DataFrame, macroMolecule: DG.Column):
199
196
  col.semType = DG.SEMTYPE.MOLECULE;
200
197
  col.tags[DG.TAGS.UNITS] = 'molblock';
201
198
  df.columns.add(col, true);
202
-
203
199
  }
204
200
 
205
201
 
@@ -248,7 +244,15 @@ export async function compositionAnalysis(): Promise<void> {
248
244
  return;
249
245
  }
250
246
 
251
- tv.addViewer('WebLogo', {sequenceColumnName: col.name});
247
+ const wlViewer = tv.addViewer('WebLogo', {sequenceColumnName: col.name});
248
+ grok.shell.tv.dockManager.dock(wlViewer, DG.DOCK_TYPE.DOWN, null, 'Composition analysis', 0.25);
249
+ }
250
+
251
+ //top-menu: Bio | Sdf to Json lib...
252
+ //name: sdfToJsonLib
253
+ //input: dataframe table
254
+ export async function sdfToJsonLib(table: DG.DataFrame) {
255
+ const jsonMonomerLibrary = createJsonMonomerLibFromSdf(table);
252
256
  }
253
257
 
254
258
  // helper function for importFasta
@@ -328,7 +332,7 @@ export function importFasta(fileContent: string): DG.DataFrame [] {
328
332
  ])];
329
333
  }
330
334
 
331
- //name: Bio | Convert
335
+ //name: Bio | Convert ...
332
336
  //friendly-name: Bio | Convert
333
337
  //tags: panel, bio
334
338
  //input: column col {semType: Macromolecule}
@@ -61,6 +61,24 @@ XZJ{}2
61
61
  test('testPickupPaletteX', async () => { await _testPickupPaletteX(csvDfX); });
62
62
  });
63
63
 
64
+ category('WebLogo.monomerToText', () => {
65
+ test('longMonomerSingle', async () => {
66
+ await expect(WebLogo.monomerToText('S'), 'S');
67
+ });
68
+ test('longMonomerShort', async () => {
69
+ await expect(WebLogo.monomerToText('Short'), 'Short');
70
+ });
71
+ test('longMonomerLong56', async () => {
72
+ await expect(WebLogo.monomerToText('Long56'), 'Long5…');
73
+ });
74
+ test('longMonomerComplexFirstPartShort', async () => {
75
+ await expect(WebLogo.monomerToText('Long-long'), 'Long…');
76
+ });
77
+ test('longMonomerComplexFirstPartLong56', async () => {
78
+ await expect(WebLogo.monomerToText('Long56-long'), 'Long5…');
79
+ });
80
+ });
81
+
64
82
 
65
83
  export async function _testGetStats(csvDfN1: string) {
66
84
  const dfN1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfN1);
@@ -1,7 +1,9 @@
1
1
  import {after, before, category, expect, expectFloat, test} from '@datagrok-libraries/utils/src/test';
2
+
2
3
  import * as DG from 'datagrok-api/dg';
3
- import {createTableView, readDataframe} from './utils';
4
- import {_package} from '../package-test';
4
+ import * as grok from 'datagrok-api/grok';
5
+
6
+ import {readDataframe} from './utils';
5
7
  import {getEmbeddingColsNames, sequenceSpace} from '../utils/sequence-space';
6
8
  import {drawTooltip, sequenceGetSimilarities} from '../utils/sequence-activity-cliffs';
7
9
  import {getActivityCliffs} from '@datagrok-libraries/ml/src/viewers/activity-cliffs';
@@ -12,8 +14,15 @@ category('activityCliffs', async () => {
12
14
  let actCliffsDf: DG.DataFrame;
13
15
 
14
16
  before(async () => {
15
- actCliffsTableView = await createTableView('sample_MSA.csv');
16
- actCliffsDf = await readDataframe('sample_MSA.csv');
17
+ actCliffsDf = await readDataframe('samples/sample_MSA.csv');
18
+ actCliffsTableView = grok.shell.addTableView(actCliffsDf);
19
+
20
+ actCliffsDf = actCliffsTableView.dataFrame;
21
+ });
22
+
23
+ after(async () => {
24
+ grok.shell.closeTable(actCliffsDf);
25
+ actCliffsTableView.close();
17
26
  });
18
27
 
19
28
  test('activityCliffsOpen', async () => {
@@ -41,10 +50,6 @@ category('activityCliffs', async () => {
41
50
 
42
51
  const cliffsLink = (Array.from(scatterPlot.root.children) as Element[])
43
52
  .filter((it) => it.className === 'ui-btn ui-btn-ok');
44
- expect((cliffsLink[0] as HTMLElement).innerText, '101 cliffs');
45
- });
46
-
47
- after(async () => {
48
- actCliffsTableView.close();
53
+ expect((cliffsLink[0] as HTMLElement).innerText, '105 cliffs');
49
54
  });
50
55
  });
@@ -4,7 +4,7 @@ import * as grok from 'datagrok-api/grok';
4
4
  import * as DG from 'datagrok-api/dg';
5
5
 
6
6
  import {ConverterFunc, DfReaderFunc} from './types';
7
- import {NOTATION, NotationConverter} from '../utils/notation-converter';
7
+ import {NOTATION, NotationConverter} from '@datagrok-libraries/bio/src/utils/notation-converter';
8
8
 
9
9
  // import {mmSemType} from '../const';
10
10
  // import {importFasta} from '../package';
@@ -102,6 +102,7 @@ MWRSWY-CKHP
102
102
 
103
103
  const enum Samples {
104
104
  peptidesComplex = 'peptidesComplex',
105
+ peptidesSimple = 'peptidesSimple',
105
106
  fastaCsv = 'fastaCsv',
106
107
  fastaFasta = 'fastaFasta',
107
108
  fastaPtCsv = 'fastaPtCsv',
@@ -115,15 +116,16 @@ MWRSWY-CKHP
115
116
  }
116
117
 
117
118
  const samples: { [key: string]: string } = {
118
- 'peptidesComplex': 'System:AppData/Bio/tests/peptides_complex_msa.csv',
119
119
  'fastaCsv': 'System:AppData/Bio/samples/sample_FASTA.csv',
120
120
  'fastaFasta': 'System:AppData/Bio/samples/sample_FASTA.fasta',
121
121
  'fastaPtCsv': 'System:AppData/Bio/samples/sample_FASTA_PT.csv',
122
122
  'msaComplex': 'System:AppData/Bio/samples/sample_MSA.csv',
123
123
  'helmCsv': 'System:AppData/Bio/samples/sample_HELM.csv',
124
+ 'peptidesComplex': 'System:AppData/Bio/tests/peptides_complex_msa.csv',
125
+ 'peptidesSimple': 'System:AppData/Bio/tests/peptides_simple_msa.csv',
124
126
  'testDemogCsv': 'System:AppData/Bio/tests/testDemog.csv',
125
127
  'testHelmCsv': 'System:AppData/Bio/tests/testHelm.csv',
126
- 'testIdCsv': 'System:AppData/Bio/tests/id.csv',
128
+ 'testIdCsv': 'System:AppData/Bio/tests/testId.csv',
127
129
  'testSmilesCsv': 'System:AppData/Bio/tests/testSmiles.csv',
128
130
  'testSmiles2Csv': 'System:AppData/Bio/tests/testSmiles2.csv',
129
131
  };
@@ -228,6 +230,10 @@ MWRSWY-CKHP
228
230
  await _testPos(readSamples(Samples.fastaFasta, readFileFasta), 'sequence', 'fasta:SEQ:PT');
229
231
  });
230
232
 
233
+ // peptidesComplex contains monomers with spaces in AlignedSequence columns, which are forbidden
234
+ // test('samplesPeptidesComplexPositiveAlignedSequence', async () => {
235
+ // await _testPos(readSamples(Samples.peptidesComplex), 'AlignedSequence', 'separator:SEQ:UN', '-');
236
+ // });
231
237
  test('samplesPeptidesComplexNegativeID', async () => {
232
238
  await _testNeg(readSamples(Samples.peptidesComplex), 'ID');
233
239
  });
@@ -1,18 +1,23 @@
1
- import {after, before, category, test, expect, expectObject} from '@datagrok-libraries/utils/src/test';
1
+ import {after, before, category, expect, test} from '@datagrok-libraries/utils/src/test';
2
2
 
3
3
  import * as grok from 'datagrok-api/grok';
4
- import * as ui from 'datagrok-api/ui';
5
4
  import * as DG from 'datagrok-api/dg';
6
5
  import {importFasta, multipleSequenceAlignmentAny} from '../package';
6
+ import {readDataframe} from './utils';
7
+ import {convertDo} from '../utils/convert';
8
+ import {NOTATION} from '@datagrok-libraries/bio/src/utils/notation-converter';
7
9
 
8
10
  category('renderers', () => {
9
11
  let tvList: DG.TableView[];
12
+ let dfList: DG.DataFrame[];
10
13
 
11
14
  before(async () => {
12
15
  tvList = [];
16
+ dfList = [];
13
17
  });
14
18
 
15
19
  after(async () => {
20
+ dfList.forEach((df: DG.DataFrame) => { grok.shell.closeTable(df); });
16
21
  tvList.forEach((tv: DG.TableView) => tv.close());
17
22
  });
18
23
 
@@ -20,39 +25,49 @@ category('renderers', () => {
20
25
  await _testAfterMsa();
21
26
  });
22
27
 
28
+ test('afterConvert', async () => {
29
+ await _testAfterConvert();
30
+ });
31
+
23
32
  async function _testAfterMsa() {
24
33
  const fastaTxt: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/sample_FASTA.fasta');
25
34
  const df: DG.DataFrame = importFasta(fastaTxt)[0];
26
-
27
- const srcSeqCol: DG.Column | null = df.col('sequence');
28
- expect(srcSeqCol !== null, true);
29
- console.log('Bio: tests/renderers/afterMsa, src data loaded');
30
-
31
35
  const tv: DG.TableView = grok.shell.addTableView(df);
36
+ await grok.data.detectSemanticTypes(df);
32
37
  console.log('Bio: tests/renderers/afterMsa, table view');
33
38
 
34
- await grok.data.detectSemanticTypes(df);
35
- console.log('Bio: tests/renderers/afterMsa, detectSemanticTypes');
39
+ const srcSeqCol: DG.Column | null = df.col('sequence');
40
+ expect(srcSeqCol !== null, true);
36
41
 
37
- console.log('Bio: tests/renderers/afterMsa, src before test semType' +
42
+ console.log('Bio: tests/renderers/afterMsa, src before test ' +
38
43
  `semType="${srcSeqCol!.semType}", units="${srcSeqCol!.getTag(DG.TAGS.UNITS)}", ` +
39
44
  `cell.renderer="${srcSeqCol!.getTag('cell.renderer')}"`);
40
45
  expect(srcSeqCol!.semType, DG.SEMTYPE.MACROMOLECULE);
41
46
  expect(srcSeqCol!.getTag(DG.TAGS.UNITS), 'fasta:SEQ:PT');
42
47
  expect(srcSeqCol!.getTag('cell.renderer'), 'Macromolecule');
43
- console.log('Bio: tests/renderers/afterMsa, src semType tested');
44
48
 
45
49
  const msaSeqCol: DG.Column | null = await multipleSequenceAlignmentAny(df, srcSeqCol!);
46
- console.log('Bio: tests/renderers/afterMsa, msaSeqCol created');
47
-
48
50
  tv.grid.invalidate();
49
- console.log('Bio: tests/renderers/afterMsa, tv.grid invalidated');
50
51
 
51
52
  expect(msaSeqCol!.semType, DG.SEMTYPE.MACROMOLECULE);
52
53
  expect(msaSeqCol!.getTag(DG.TAGS.UNITS), 'fasta:SEQ.MSA:PT');
53
54
  expect(msaSeqCol!.getTag('cell.renderer'), 'Macromolecule');
54
- console.log('Bio: tests/renderers/afterMsa, msa semType tested');
55
55
 
56
+ dfList.push(df);
56
57
  tvList.push(tv);
57
58
  }
59
+
60
+ async function _testAfterConvert() {
61
+ const csv: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/sample_FASTA_PT.csv');
62
+ const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
63
+ const tv: DG.TableView = grok.shell.addTableView(df);
64
+ await grok.data.detectSemanticTypes(df);
65
+
66
+ const srcCol: DG.Column = df.col('sequence')!;
67
+ const tgtCol: DG.Column = await convertDo(srcCol, NOTATION.SEPARATOR, '/');
68
+ expect(tgtCol.getTag('cell.renderer'), 'Macromolecule');
69
+
70
+ tvList.push(tv);
71
+ dfList.push(df);
72
+ };
58
73
  });
@@ -1,16 +1,20 @@
1
- import {before, category, test, expect} from '@datagrok-libraries/utils/src/test';
1
+ import {after, before, category, test, expect} from '@datagrok-libraries/utils/src/test';
2
2
  import * as DG from 'datagrok-api/dg';
3
3
  import {sequenceSpace} from '../utils/sequence-space';
4
4
  import {readDataframe} from './utils';
5
- //import * as grok from 'datagrok-api/grok';
5
+ import * as grok from 'datagrok-api/grok';
6
6
 
7
7
  category('sequenceSpace', async () => {
8
8
  let testFastaDf: DG.DataFrame;
9
9
 
10
10
  before(async () => {
11
- testFastaDf = await readDataframe('sample_FASTA.csv');
11
+ testFastaDf = await readDataframe('samples/sample_FASTA.csv');
12
+ // await grok.data.detectSemanticTypes(testFastaDf);
12
13
  });
13
14
 
15
+ after(async () => {
16
+ grok.shell.closeTable(testFastaDf);
17
+ });
14
18
 
15
19
  test('sequenceSpaceOpens', async () => {
16
20
  const sequenceSpaceParams = {
@@ -0,0 +1,35 @@
1
+ import {after, before, category, test, expect, expectArray} from '@datagrok-libraries/utils/src/test';
2
+
3
+ import * as grok from 'datagrok-api/grok';
4
+ import * as ui from 'datagrok-api/ui';
5
+ import * as DG from 'datagrok-api/dg';
6
+ import {WebLogo, SplitterFunc} from '@datagrok-libraries/bio/src/viewers/web-logo';
7
+
8
+ category('splitters', () => {
9
+ const helm1 = 'PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$';
10
+
11
+ const helm2 = 'PEPTIDE1{meI.hHis.Hcy.Q.T.W.Q.Phe_4NH2.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.N.meK}$$$';
12
+
13
+ const data: { [key: string]: [string, string[]] } = {
14
+ helm1: [
15
+ 'PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$',
16
+ ['meI', 'hHis', 'Aca', 'N', 'T', 'dE', 'Thr_PO3H2', 'Aca', 'D-Tyr_Et',
17
+ 'Tyr_ab-dehydroMe', 'dV', 'E', 'N', 'D-Orn', 'D-aThr', 'Phe_4Me']
18
+ ],
19
+ helm2: [
20
+ 'PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.D-Dap.dV.E.N.pnG.Phe_4Me}$$$',
21
+ ['meI', 'hHis', 'Aca', 'N', 'T', 'dK', 'Thr_PO3H2', 'Aca',
22
+ 'D-Tyr_Et', 'D-Dap', 'dV', 'E', 'N', 'pnG', 'Phe_4Me']
23
+ ],
24
+ };
25
+
26
+ test('helm1', async () => { await _testHelmSplitter(data.helm1[0], data.helm1[1]); });
27
+ test('helm2', async () => { await _testHelmSplitter(data.helm2[0], data.helm2[1]); });
28
+ });
29
+
30
+ export async function _testHelmSplitter(src: string, tgt: string[]) {
31
+ const res: string[] = WebLogo.splitterAsHelm(src);
32
+ console.debug(`Bio: tests: splitters: src=${JSON.stringify(src)}, res=${JSON.stringify(res)} .`);
33
+ expectArray(res, tgt);
34
+ }
35
+
@@ -9,6 +9,7 @@ import * as ui from 'datagrok-api/ui';
9
9
 
10
10
  const lru = new DG.LruCache<any, any>();
11
11
  const undefinedColor = 'rgb(100,100,100)';
12
+ const grayColor = '#808080'
12
13
 
13
14
  function getPalleteByType(paletteType: string): SeqPalette {
14
15
  switch (paletteType) {
@@ -68,9 +69,9 @@ function printLeftOrCentered(
68
69
  g.textAlign = 'start';
69
70
  const colorPart = s.substring(0);
70
71
  let grayPart = separator;
71
- if (last) {
72
+ if (last)
72
73
  grayPart = '';
73
- }
74
+
74
75
  const textSize = g.measureText(colorPart + grayPart);
75
76
  const indent = 5;
76
77
 
@@ -81,7 +82,7 @@ function printLeftOrCentered(
81
82
  g.fillStyle = color;
82
83
  g.globalAlpha = transparencyRate;
83
84
  g.fillText(colorPart, x + dx1, y + dy);
84
- g.fillStyle = '#808080';
85
+ g.fillStyle = grayColor;
85
86
  g.fillText(grayPart, x + dx2, y + dy);
86
87
  }
87
88
 
@@ -96,10 +97,29 @@ function printLeftOrCentered(
96
97
  }
97
98
  }
98
99
 
100
+ function findMonomers(helmString: string) {
101
+ //@ts-ignore
102
+ const types = Object.keys(org.helm.webeditor.monomerTypeList());
103
+ const monomers: any = [];
104
+ const monomer_names: any = [];
105
+ for (var i = 0; i < types.length; i++) {
106
+ //@ts-ignore
107
+ monomers.push(new scil.helm.Monomers.getMonomerSet(types[i]));
108
+ Object.keys(monomers[i]).forEach(k => {
109
+ monomer_names.push(monomers[i][k].id);
110
+ });
111
+ }
112
+ const split_string = WebLogo.splitterAsHelm(helmString);
113
+ return new Set(split_string.filter(val => !monomer_names.includes(val)));
114
+ }
115
+
99
116
  export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
100
117
  get name(): string { return 'macromoleculeSequence'; }
118
+
101
119
  get cellType(): string { return C.SEM_TYPES.Macro_Molecule; }
120
+
102
121
  get defaultHeight(): number { return 30; }
122
+
103
123
  get defaultWidth(): number { return 230; }
104
124
 
105
125
  /**
@@ -122,22 +142,47 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
122
142
  const cell = gridCell.cell;
123
143
  const tag = gridCell.cell.column.getTag(DG.TAGS.UNITS);
124
144
  if (tag === 'HELM') {
125
- const host = ui.div([], {style: {width: `${w}px`, height: `${h}px`}});
126
- host.setAttribute('dataformat', 'helm');
127
- host.setAttribute('data', gridCell.cell.value);
128
- gridCell.element = host;
129
- //@ts-ignore
130
- const canvas = new JSDraw2.Editor(host, {width: w, height: h, skin: 'w8', viewonly: true});
131
- const formula = canvas.getFormula(true);
132
- if (!formula) {
133
- gridCell.element = ui.divText(gridCell.cell.value, {style: {color: 'red'}});
134
- } else {
145
+ console.log(findMonomers(cell.value));
146
+ const monomers = findMonomers(cell.value);
147
+ if (monomers.size == 0) {
148
+ const host = ui.div([], {style: {width: `${w}px`, height: `${h}px`}});
149
+ host.setAttribute('dataformat', 'helm');
150
+ host.setAttribute('data', gridCell.cell.value);
135
151
  gridCell.element = host;
136
- const molWeight = Math.round(canvas.getMolWeight() * 100) / 100;
137
- const coef = Math.round(canvas.getExtinctionCoefficient(true) * 100) / 100;
138
- const molfile = canvas.getMolfile();
139
- const result = formula + ', ' + molWeight + ', ' + coef + ', ' + molfile;
140
- lru.set(gridCell.cell.value, result);
152
+ //@ts-ignore
153
+ const canvas = new JSDraw2.Editor(host, {width: w, height: h, skin: 'w8', viewonly: true});
154
+ const formula = canvas.getFormula(true);
155
+ if (!formula) {
156
+ gridCell.element = ui.divText(gridCell.cell.value, {style: {color: 'red'}});
157
+ }
158
+ return;
159
+ }
160
+ if (monomers.size > 0) {
161
+ w = grid ? Math.min(grid.canvas.width - x, w) : g.canvas.width - x;
162
+ g.save();
163
+ g.beginPath();
164
+ g.rect(x, y, w, h);
165
+ g.clip();
166
+ g.font = '12px monospace';
167
+ g.textBaseline = 'top';
168
+ let x1 = x;
169
+ const s: string = cell.value ?? '';
170
+ let subParts: string[] = WebLogo.splitterAsHelm(s);
171
+ let color = undefinedColor;
172
+ subParts.forEach((amino, index) => {
173
+ if (monomers.has(amino)) {
174
+ color = 'red';
175
+ } else {
176
+ color = grayColor;
177
+ }
178
+ g.fillStyle = undefinedColor;
179
+ let last = false;
180
+ if (index === subParts.length - 1)
181
+ last = true;
182
+ x1 = printLeftOrCentered(x1, y, w, h, g, amino, color, 0, true, 1.0, '/', last);
183
+ });
184
+ g.restore();
185
+ return;
141
186
  }
142
187
  } else {
143
188
  const [type, subtype, paletteType] = gridCell.cell.column.getTag(DG.TAGS.UNITS).split(':');
@@ -166,13 +211,15 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
166
211
  color = palette.get(amino);
167
212
  g.fillStyle = undefinedColor;
168
213
  let last = false;
169
- if (index === subParts.length - 1) {
214
+ if (index === subParts.length - 1)
170
215
  last = true;
171
- }
172
- x1 = printLeftOrCentered(x1, y, w, h, g, amino, color, 0, true, 1.0, separator, last);
216
+
217
+ x1 = printLeftOrCentered(x1, y, w, h, g, amino, color, 0, true, 1.0, separator, last);
173
218
  });
174
219
 
175
220
  g.restore();
221
+ return;
222
+
176
223
  }
177
224
  }
178
225
  }