@datagrok/bio 1.5.6 → 1.5.9

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 (40) hide show
  1. package/css/helm.css +3 -0
  2. package/detectors.js +16 -17
  3. package/dist/package-test.js +1134 -425
  4. package/dist/package.js +906 -259
  5. package/files/samples/sample_FASTA.csv +66 -66
  6. package/files/samples/testDemog.csv +5851 -0
  7. package/files/samples/testHelm.csv +6 -0
  8. package/files/samples/{id.csv → testId.csv} +0 -0
  9. package/files/samples/{sar-small.csv → testSmiles.csv} +0 -0
  10. package/helm/JSDraw/Pistoia.HELM-uncompressed.js +9694 -0
  11. package/helm/JSDraw/Pistoia.HELM.js +27 -0
  12. package/helm/JSDraw/ReadMe.txt +8 -0
  13. package/helm/JSDraw/Scilligence.JSDraw2.Lite-uncompressed.js +31126 -0
  14. package/helm/JSDraw/Scilligence.JSDraw2.Lite.js +12 -0
  15. package/helm/JSDraw/Scilligence.JSDraw2.Resources.js +762 -0
  16. package/helm/JSDraw/dojo.js +250 -0
  17. package/helm/JSDraw/test.html +21 -0
  18. package/package.json +9 -2
  19. package/src/monomer-library.ts +199 -0
  20. package/src/package-test.ts +2 -0
  21. package/src/package.ts +41 -13
  22. package/src/tests/convert-test.ts +143 -22
  23. package/src/tests/detectors-test.ts +133 -156
  24. package/src/tests/renderer-test.ts +36 -0
  25. package/src/tests/splitter-test.ts +22 -0
  26. package/src/tests/types.ts +7 -0
  27. package/src/utils/atomic-works.ts +218 -97
  28. package/src/utils/cell-renderer.ts +211 -0
  29. package/src/utils/chem-palette.ts +280 -0
  30. package/src/utils/convert.ts +25 -16
  31. package/src/utils/misc.ts +29 -0
  32. package/src/utils/multiple-sequence-alignment.ts +1 -1
  33. package/src/utils/notation-converter.ts +120 -84
  34. package/src/utils/sequence-activity-cliffs.ts +2 -2
  35. package/src/utils/types.ts +13 -0
  36. package/src/utils/utils.ts +35 -30
  37. package/test-Bio-34f75e5127b8-b47d4664.html +260 -0
  38. package/files/sample_FASTA.csv +0 -66
  39. package/files/sample_FASTA_with_activities.csv +0 -66
  40. package/files/sample_MSA.csv +0 -541
@@ -33,23 +33,35 @@ C1CCCCC1
33
33
  CCCCCC
34
34
  `;
35
35
 
36
- const csvDfN1: string = `seq
36
+ const csvDfDna1: string = `seq
37
37
  ACGTC
38
38
  CAGTGT
39
39
  TTCAAC
40
+ `;
41
+
42
+ const csvDfRna1: string = `seq
43
+ ACGUC
44
+ CAGUGU
45
+ UUCAAC
40
46
  `;
41
47
 
42
48
  /** Pure amino acids sequence */
43
- const csvDfAA1: string = `seq
49
+ const csvDfPt1: string = `seq
44
50
  FWPHEY
45
51
  YNRQWYV
46
52
  MKPSEYV
47
53
  `;
48
54
 
49
- const csvDfSepNt: string = `seq
55
+ const csvDfSepDna: string = `seq
50
56
  A*C*G*T*C
51
57
  C*A*G*T*G*T
52
58
  T*T*C*A*A*C
59
+ `;
60
+
61
+ const csvDfSepRna: string = `seq
62
+ A*C*G*U*C
63
+ C*A*G*U*G*U
64
+ U*U*C*A*A*C
53
65
  `;
54
66
 
55
67
  const csvDfSepPt: string = `seq
@@ -70,49 +82,55 @@ rut12/her2/rty/wert//abc/abc1/dfgg
70
82
  rut12/rty/her2/abc/cfr3//wert/rut12
71
83
  `;
72
84
 
73
- const csvDfSepMsaN1: string = `seq
85
+ const csvDfSepMsaDna1: string = `seq
74
86
  A-C--G-T--C-T
75
87
  C-A-C--T--G-T
76
88
  A-C-C-G-T-A-C-T
77
89
  `;
78
90
 
79
- const csvDfMsaN1: string = `seq
91
+ const csvDfMsaDna1: string = `seq
80
92
  AC-GT-CT
81
93
  CAC-T-GT
82
94
  ACCGTACT
83
95
  `;
84
96
 
85
- const csvDfMsaAA1: string = `seq
97
+ const csvDfMsaPt1: string = `seq
86
98
  FWR-WYV-KHP
87
99
  YNR-WYV-KHP
88
100
  MWRSWY-CKHP
89
101
  `;
90
102
 
91
103
  const enum Samples {
92
- peptidesComplex = 'PeptidesComplex',
93
- fastaCsv = 'FastaCsv',
94
- msaComplex = 'MsaComplex',
95
- idCsv = 'IdCsv',
96
- sarSmallCsv = 'SarSmallCsv',
97
- HelmCsv = 'HelmCsv',
104
+ peptidesComplex = 'peptidesComplex',
105
+ fastaCsv = 'fastaCsv',
106
+ fastaFasta = 'fastaFasta',
107
+ msaComplex = 'msaComplex',
108
+ helmCsv = 'helmCsv',
109
+ testIdCsv = 'testIdCsv',
110
+ testSmilesCsv = 'testSmilesCsv',
111
+ testHelmCsv = 'testHelmCsv',
112
+ testDemogCsv = 'testDemogCsv',
98
113
  }
99
114
 
100
115
  const samples: { [key: string]: string } = {
101
- 'PeptidesComplex': 'System:AppData/Bio/samples/peptides_complex_msa.csv',
102
- 'FastaCsv': 'System:AppData/Bio/samples/sample_FASTA.csv',
103
- 'MsaComplex': 'System:AppData/Bio/samples/sample_MSA.csv',
104
- 'IdCsv': 'System:AppData/Bio/samples/id.csv',
105
- 'SarSmallCsv': 'System:AppData/Bio/samples/sar-small.csv',
106
- 'HelmCsv': 'System:AppData/Bio/samples/sample_HELM.csv',
116
+ 'peptidesComplex': 'System:AppData/Bio/samples/peptides_complex_msa.csv',
117
+ 'fastaCsv': 'System:AppData/Bio/samples/sample_FASTA.csv',
118
+ 'fastaFasta': 'System:AppData/Bio/samples/sample_FASTA.fasta',
119
+ 'msaComplex': 'System:AppData/Bio/samples/sample_MSA.csv',
120
+ 'helmCsv': 'System:AppData/Bio/samples/sample_HELM.csv',
121
+ 'testDemogCsv': 'System:AppData/Bio/samples/testDemog.csv',
122
+ 'testIdCsv': 'System:AppData/Bio/samples/id.csv',
123
+ 'testHelmCsv': 'System:AppData/Bio/samples/testHelm.csv',
124
+ 'testSmilesCsv': 'System:AppData/Bio/samples/testSmiles.csv',
107
125
  };
108
126
 
109
127
  const _samplesDfs: { [key: string]: Promise<DG.DataFrame> } = {};
110
- const readSamplesCsv: (key: string) => DfReaderFunc = (key: string) => {
128
+
129
+ function readSamples(key: string, readFile: (file: string) => Promise<DG.DataFrame> = readFileCsv): DfReaderFunc {
111
130
  return async () => {
112
131
  if (!(key in _samplesDfs)) {
113
132
  _samplesDfs[key] = (async (): Promise<DG.DataFrame> => {
114
- const csv: string = await grok.dapi.files.readAsText(samples[key]);
115
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
133
+ const df: DG.DataFrame = await readFile(samples[key]);
116
134
  await grok.data.detectSemanticTypes(df);
117
135
  return df;
118
136
  })();
@@ -121,6 +139,18 @@ MWRSWY-CKHP
121
139
  };
122
140
  };
123
141
 
142
+ async function readFileCsv(file: string): Promise<DG.DataFrame> {
143
+ const csv: string = await grok.dapi.files.readAsText(file);
144
+ const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
145
+ return df;
146
+ }
147
+
148
+ async function readFileFasta(file: string): Promise<DG.DataFrame> {
149
+ const txt: string = await grok.dapi.files.readAsText(file);
150
+ const df: DG.DataFrame = importFasta(txt)[0];
151
+ return df;
152
+ }
153
+
124
154
  const _csvDfs: { [key: string]: Promise<DG.DataFrame> } = {};
125
155
  const readCsv: (key: string, csv: string) => DfReaderFunc = (key: string, csv: string) => {
126
156
  return async () => {
@@ -140,69 +170,123 @@ MWRSWY-CKHP
140
170
  test('Negative3', async () => { await _testNeg(readCsv('csvDf3', csvDf3), 'col1'); });
141
171
  test('NegativeSmiles', async () => { await _testNeg(readCsv('csvDfSmiles', csvDfSmiles), 'col1'); });
142
172
 
143
- test('N1', async () => { await _testN1(csvDfN1); });
144
- test('AA1', async () => { await _testAA1(csvDfAA1); });
145
- test('MsaN1', async () => { await _testMsaN1(csvDfMsaN1); });
146
- test('MsaAA1', async () => { await _testMsaAA1(csvDfMsaAA1); });
173
+ test('Dna1', async () => {
174
+ await _testPos(readCsv('csvDfDna1', csvDfDna1), 'seq', 'fasta:SEQ:DNA');
175
+ });
176
+ test('Rna1', async () => {
177
+ await _testPos(readCsv('csvDfRna1', csvDfRna1), 'seq', 'fasta:SEQ:RNA');
178
+ });
179
+ test('AA1', async () => {
180
+ await _testPos(readCsv('csvDfPt1', csvDfPt1), 'seq', 'fasta:SEQ:PT');
181
+ });
182
+ test('MsaDna1', async () => {
183
+ await _testPos(readCsv('csvDfMsaDna1', csvDfMsaDna1), 'seq', 'fasta:SEQ.MSA:DNA');
184
+ });
185
+
186
+ test('MsaAA1', async () => {
187
+ await _testPos(readCsv('csvDfMsaPt1', csvDfMsaPt1), 'seq', 'fasta:SEQ.MSA:PT');
188
+ });
147
189
 
148
- test('SepNt', async () => { await _testSepNt(csvDfSepNt, '*'); });
149
- test('SepPt', async () => { await _testSepPt(csvDfSepPt, '-'); });
150
- test('SepUn1', async () => { await _testSepUn(csvDfSepUn1, '-'); });
151
- test('SepUn2', async () => { await _testSepUn(csvDfSepUn2, '/'); });
190
+ test('SepDna', async () => {
191
+ await _testPos(readCsv('csvDfSepDna', csvDfSepDna), 'seq', 'separator:SEQ:DNA', '*');
192
+ });
193
+ test('SepRna', async () => {
194
+ await _testPos(readCsv('csvDfSepRna', csvDfSepRna), 'seq', 'separator:SEQ:RNA', '*');
195
+ });
196
+ test('SepPt', async () => {
197
+ await _testPos(readCsv('csvDfSepPt', csvDfSepPt), 'seq', 'separator:SEQ:PT', '-');
198
+ });
199
+ test('SepUn1', async () => {
200
+ await _testPos(readCsv('csvDfSepUn1', csvDfSepUn1), 'seq', 'separator:SEQ:UN', '-');
201
+ });
202
+ test('SepUn2', async () => {
203
+ await _testPos(readCsv('csvDfSepUn2', csvDfSepUn2), 'seq', 'separator:SEQ:UN', '/');
204
+ });
152
205
 
153
- test('SepMsaN1', async () => { await _testSepMsaN1(csvDfSepMsaN1); });
206
+ test('SepMsaN1', async () => {
207
+ await _testPos(readCsv('csvDfSepMsaDna1', csvDfSepMsaDna1), 'seq', 'separator:SEQ.MSA:DNA', '-');
208
+ });
154
209
 
155
210
  test('SamplesFastaCsvPt', async () => {
156
- await _testSamplesFastaCsvPt();
211
+ await _testPos(readSamples(Samples.fastaCsv), 'sequence', 'fasta:SEQ:PT');
157
212
  });
158
213
  test('SamplesFastaCsvNegativeEntry', async () => {
159
- await _testNeg(readSamplesCsv(Samples.fastaCsv), 'Entry');
214
+ await _testNeg(readSamples(Samples.fastaCsv), 'Entry');
160
215
  });
161
216
  test('SamplesFastaCsvNegativeLength', async () => {
162
- await _testNeg(readSamplesCsv(Samples.fastaCsv), 'Length');
217
+ await _testNeg(readSamples(Samples.fastaCsv), 'Length');
163
218
  });
164
219
  test('SamplesFastaCsvNegativeUniProtKB', async () => {
165
- await _testNeg(readSamplesCsv(Samples.fastaCsv), 'UniProtKB');
220
+ await _testNeg(readSamples(Samples.fastaCsv), 'UniProtKB');
166
221
  });
167
222
 
168
- test('SamplesFastaFastaPt', async () => { await _testSamplesFastaFastaPt(); });
169
-
170
- // System:AppData/Bio/samples/peptides_complex_align.csv contains monomers with spaces
171
- // test('SamplesPeptidesComplexUn', async () => {
172
- // await _testSamplesPeptidesComplexUn();
173
- // });
223
+ test('SamplesFastaFastaPt', async () => {
224
+ await _testPos(readSamples(Samples.fastaFasta, readFileFasta), 'sequence', 'fasta:SEQ:PT');
225
+ });
174
226
 
175
227
  test('samplesPeptidesComplexNegativeID', async () => {
176
- await _testNeg(readSamplesCsv(Samples.peptidesComplex), 'ID');
228
+ await _testNeg(readSamples(Samples.peptidesComplex), 'ID');
177
229
  });
178
230
  test('SamplesPeptidesComplexNegativeMeasured', async () => {
179
- await _testNeg(readSamplesCsv(Samples.peptidesComplex), 'Measured');
231
+ await _testNeg(readSamples(Samples.peptidesComplex), 'Measured');
180
232
  });
181
233
  test('SamplesPeptidesComplexNegativeValue', async () => {
182
- await _testNeg(readSamplesCsv(Samples.peptidesComplex), 'Value');
234
+ await _testNeg(readSamples(Samples.peptidesComplex), 'Value');
183
235
  });
184
236
 
185
237
  test('samplesMsaComplexUn', async () => {
186
- await _testPos(readSamplesCsv(Samples.msaComplex), 'MSA', 'separator:SEQ.MSA:UN', '/');
238
+ await _testPos(readSamples(Samples.msaComplex), 'MSA', 'separator:SEQ.MSA:UN', '/');
187
239
  });
188
240
  test('samplesMsaComplexNegativeActivity', async () => {
189
- await _testNeg(readSamplesCsv(Samples.msaComplex), 'Activity');
241
+ await _testNeg(readSamples(Samples.msaComplex), 'Activity');
190
242
  });
191
243
 
192
244
  test('samplesIdCsvNegativeID', async () => {
193
- await _testNeg(readSamplesCsv(Samples.idCsv), 'ID');
245
+ await _testNeg(readSamples(Samples.testIdCsv), 'ID');
194
246
  });
195
247
 
196
248
  test('samplesSarSmallCsvNegativeSmiles', async () => {
197
- await _testNeg(readSamplesCsv(Samples.sarSmallCsv), 'smiles');
249
+ await _testNeg(readSamples(Samples.testSmilesCsv), 'smiles');
198
250
  });
199
251
 
200
252
  test('samplesHelmCsvHELM', async () => {
201
- await _testPos(readSamplesCsv(Samples.HelmCsv), 'HELM', 'HELM', null);
253
+ await _testPos(readSamples(Samples.helmCsv), 'HELM', 'HELM', null);
202
254
  });
203
255
 
204
256
  test('samplesHelmCsvNegativeActivity', async () => {
205
- await _testNeg(readSamplesCsv(Samples.HelmCsv), 'Activity');
257
+ await _testNeg(readSamples(Samples.helmCsv), 'Activity');
258
+ });
259
+
260
+ // sample_testHelm.csb
261
+ // columns: ID,Test type,HELM string,Valid?,Mol Weight,Mol Formula,SMILES
262
+ test('samplesTestHelmNegativeID', async () => {
263
+ await _testNeg(readSamples(Samples.testHelmCsv), 'ID');
264
+ });
265
+ test('samplesTestHelmNegativeTestType', async () => {
266
+ await _testNeg(readSamples(Samples.testHelmCsv), 'Test type');
267
+ });
268
+ test('samplesTestHelmPositiveHelmString', async () => {
269
+ await _testPos(readSamples(Samples.testHelmCsv), 'HELM string', 'HELM');
270
+ });
271
+ test('samplesTestHelmNegativeValid', async () => {
272
+ await _testNeg(readSamples(Samples.testHelmCsv), 'Valid?');
273
+ });
274
+ test('samplesTestHelmNegativeMolWeight', async () => {
275
+ await _testNeg(readSamples(Samples.testHelmCsv), 'Mol Weight');
276
+ });
277
+ test('samplesTestHelmNegativeMolFormula', async () => {
278
+ await _testNeg(readSamples(Samples.testHelmCsv), 'Mol Formula');
279
+ });
280
+ test('samplesTestHelmNegativeSmiles', async () => {
281
+ await _testNeg(readSamples(Samples.testHelmCsv), 'Smiles');
282
+ });
283
+
284
+ test('samplesTestDemogNegativeAll', async () => {
285
+ const dfFunc: DfReaderFunc = readSamples(Samples.testDemogCsv);
286
+ const df: DG.DataFrame = await dfFunc();
287
+
288
+ for (const col of df.columns.toList())
289
+ await _testNeg(dfFunc, col.name);
206
290
  });
207
291
  });
208
292
 
@@ -223,110 +307,3 @@ export async function _testPos(readDf: DfReaderFunc, colName: string, units: str
223
307
  expect(col.getTag('separator'), separator);
224
308
  }
225
309
 
226
- export async function _testN1(csvDfN1: string) {
227
- const dfN1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfN1);
228
- await grok.data.detectSemanticTypes(dfN1);
229
-
230
- const col: DG.Column = dfN1.col('seq')!;
231
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
232
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ:NT');
233
- }
234
-
235
- export async function _testAA1(csvDfAA1: string) {
236
- const dfAA1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfAA1);
237
- await grok.data.detectSemanticTypes(dfAA1);
238
-
239
- const col: DG.Column = dfAA1.col('seq')!;
240
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
241
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ:PT');
242
- }
243
-
244
- export async function _testMsaN1(csvDfMsaN1: string) {
245
- const dfMsaN1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfMsaN1);
246
- await grok.data.detectSemanticTypes(dfMsaN1);
247
-
248
- const col: DG.Column = dfMsaN1.col('seq')!;
249
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
250
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ.MSA:NT');
251
- }
252
-
253
- export async function _testMsaAA1(csvDfMsaAA1: string) {
254
- const dfMsaAA1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfMsaAA1);
255
- await grok.data.detectSemanticTypes(dfMsaAA1);
256
-
257
- const col: DG.Column = dfMsaAA1.col('seq')!;
258
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
259
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ.MSA:PT');
260
- }
261
-
262
- export async function _testSepNt(csv: string, separator: string) {
263
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
264
- await grok.data.detectSemanticTypes(df);
265
-
266
- const col: DG.Column = df.col('seq')!;
267
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
268
- expect(col.getTag(DG.TAGS.UNITS), 'separator:SEQ:NT');
269
- expect(col.getTag('separator'), separator);
270
- }
271
-
272
- export async function _testSepPt(csv: string, separator: string) {
273
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
274
- await grok.data.detectSemanticTypes(df);
275
-
276
- const col: DG.Column = df.col('seq')!;
277
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
278
- expect(col.getTag(DG.TAGS.UNITS), 'separator:SEQ:PT');
279
- expect(col.getTag('separator'), separator);
280
- }
281
-
282
- export async function _testSepUn(csv: string, separator: string) {
283
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
284
- await grok.data.detectSemanticTypes(df);
285
-
286
- const col: DG.Column = df.col('seq')!;
287
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
288
- expect(col.getTag(DG.TAGS.UNITS), 'separator:SEQ:UN');
289
- expect(col.getTag('separator'), separator);
290
- }
291
-
292
- export async function _testSepMsaN1(csvDfSepMsaN1: string) {
293
- const dfSepMsaN1: DG.DataFrame = DG.DataFrame.fromCsv(csvDfSepMsaN1);
294
- await grok.data.detectSemanticTypes(dfSepMsaN1);
295
-
296
- const col: DG.Column = dfSepMsaN1.col('seq')!;
297
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
298
- expect(col.getTag(DG.TAGS.UNITS), 'separator:SEQ.MSA:NT');
299
- }
300
-
301
- export async function _testSamplesFastaCsvPt() {
302
- const csv: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/sample_FASTA.csv');
303
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
304
- await grok.data.detectSemanticTypes(df);
305
-
306
- const col: DG.Column = df.col('sequence')!;
307
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
308
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ:PT');
309
- expect(col.getTag('separator'), null);
310
- }
311
-
312
- export async function _testSamplesFastaFastaPt() {
313
- const fasta: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/sample_FASTA.fasta');
314
- const df: DG.DataFrame = importFasta(fasta)[0];
315
-
316
- const col: DG.Column = df.col('sequence')!;
317
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
318
- expect(col.getTag(DG.TAGS.UNITS), 'fasta:SEQ:PT');
319
- expect(col.getTag('separator'), null);
320
- }
321
-
322
- export async function _testSamplesPeptidesComplexUn() {
323
- const csv: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/peptides_complex_aligned.csv');
324
- const df: DG.DataFrame = DG.DataFrame.fromCsv(csv);
325
- await grok.data.detectSemanticTypes(df);
326
-
327
- const col: DG.Column = df.col('AlignedSequence')!;
328
- expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
329
- expect(col.getTag(DG.TAGS.UNITS), 'separator:SEQ.MSA:UN');
330
- expect(col.getTag('separator'), '-');
331
- }
332
-
@@ -0,0 +1,36 @@
1
+ import {after, before, category, test, expect, expectObject} 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 {importFasta, multipleSequenceAlignmentAny} from '../package';
7
+
8
+ category('renderers', () => {
9
+ test('afterMsa', async () => {
10
+ await _testAfterMsa();
11
+ });
12
+ });
13
+
14
+ export async function _testAfterMsa() {
15
+ const fastaTxt: string = await grok.dapi.files.readAsText('System:AppData/Bio/samples/sample_FASTA.fasta');
16
+ const df: DG.DataFrame = importFasta(fastaTxt)[0];
17
+
18
+ const seqCol: DG.Column | null = df.col('sequence');
19
+ expect(seqCol !== null, true);
20
+
21
+ const tv: DG.TableView = grok.shell.addTableView(df);
22
+ await grok.data.detectSemanticTypes(df);
23
+
24
+ expect(seqCol!.semType, DG.SEMTYPE.MACROMOLECULE);
25
+ expect(seqCol!.getTag(DG.TAGS.UNITS), 'fasta:SEQ:PT');
26
+ expect(seqCol!.getTag('cell.renderer'), 'Macromolecule');
27
+
28
+ const seqMsaCol: DG.Column = await multipleSequenceAlignmentAny(df, seqCol!);
29
+ tv.grid.invalidate();
30
+
31
+ expect(seqMsaCol!.semType, DG.SEMTYPE.MACROMOLECULE);
32
+ expect(seqMsaCol!.getTag(DG.TAGS.UNITS), 'fasta:SEQ.MSA:PT');
33
+ expect(seqMsaCol!.getTag('cell.renderer'), 'Macromolecule');
34
+
35
+ // tv.close();
36
+ }
@@ -0,0 +1,22 @@
1
+ import {after, before, category, test, expect, expectObject} 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('splitter', () => {
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
+ const helm2 = 'PEPTIDE1{meI.hHis.Hcy.Q.T.W.Q.Phe_4NH2.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.N.meK}$$$';
11
+
12
+ test('helm1', async () => { await _testHelmSplitter(helm1); });
13
+ test('helm2', async () => { await _testHelmSplitter(helm2); });
14
+ });
15
+
16
+ export async function _testHelmSplitter(txt: string) {
17
+ // const splitter: SplitterFunc = WebLogo.getSplitterAsHelm();
18
+ //
19
+ // const mList: string[] = splitter(txt);
20
+ // expect(mList.length, 12);
21
+ }
22
+
@@ -0,0 +1,7 @@
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+
5
+ export type DfReaderFunc = () => Promise<DG.DataFrame>;
6
+
7
+ export type ConverterFunc = (srcCol: DG.Column) => DG.Column;