@datagrok/bio 1.7.8 → 1.7.12

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.
@@ -2,7 +2,7 @@ import * as DG from 'datagrok-api/dg';
2
2
  import {WebLogo, SplitterFunc} from '@datagrok-libraries/bio/src/viewers/web-logo';
3
3
  import * as grok from 'datagrok-api/grok';
4
4
  import {
5
- CAP_GROUP_NAME, CAP_GROUP_SMILES, jsonSdfMonomerLibDict, MONOMER_SYMBOL,
5
+ CAP_GROUP_NAME, CAP_GROUP_SMILES, jsonSdfMonomerLibDict, MONOMER_ENCODE_MAX, MONOMER_ENCODE_MIN, MONOMER_SYMBOL,
6
6
  RGROUP_ALTER_ID, RGROUP_FIELD, RGROUP_LABEL, SDF_MONOMER_NAME
7
7
  } from '../const';
8
8
 
@@ -11,6 +11,33 @@ export const HELM_CORE_LIB_MONOMER_SYMBOL = 'symbol';
11
11
  export const HELM_CORE_LIB_MOLFILE = 'molfile';
12
12
  export const HELM_CORE_FIELDS = ['symbol', 'molfile', 'rgroups', 'name'];
13
13
 
14
+
15
+ export function encodeMonomers(col: DG.Column): DG.Column | null {
16
+ let encodeSymbol = MONOMER_ENCODE_MIN;
17
+ const monomerSymbolDict: { [key: string]: number }= {};
18
+ const units = col.tags[DG.TAGS.UNITS];
19
+ const sep = col.getTag('separator');
20
+ const splitterFunc: SplitterFunc = WebLogo.getSplitter(units, sep);
21
+ const encodedStringArray = [];
22
+ for (let i = 0; i < col.length; ++i) {
23
+ let encodedMonomerStr = '';
24
+ const monomers = splitterFunc(col.get(i));
25
+ monomers.forEach(m => {
26
+ if(!monomerSymbolDict[m]) {
27
+ if(encodeSymbol > MONOMER_ENCODE_MAX) {
28
+ grok.shell.error(`Not enougth symbols to encode monomers`);
29
+ return null;
30
+ }
31
+ monomerSymbolDict[m] = encodeSymbol;
32
+ encodeSymbol++;
33
+ }
34
+ encodedMonomerStr += String.fromCodePoint(monomerSymbolDict[m]);
35
+ })
36
+ encodedStringArray.push(encodedMonomerStr);
37
+ }
38
+ return DG.Column.fromStrings('encodedMolecules', encodedStringArray);
39
+ }
40
+
14
41
  export function getMolfilesFromSeq(col: DG.Column, monomersLibObject: any[]): any[][] | null {
15
42
  const units = col.tags[DG.TAGS.UNITS];
16
43
  const sep = col.getTag('separator');
@@ -79,4 +106,4 @@ export function createJsonMonomerLibFromSdf(table: DG.DataFrame): any {
79
106
  resultLib.push(monomer);
80
107
  }
81
108
  return resultLib;
82
- }
109
+ }
@@ -1,4 +1,4 @@
1
- <html><head><meta charset="utf-8"/><title>Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit cdc230d8.</title><style type="text/css">html,
1
+ <html><head><meta charset="utf-8"/><title>Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit 6fa72ec4.</title><style type="text/css">html,
2
2
  body {
3
3
  font-family: Arial, Helvetica, sans-serif;
4
4
  font-size: 1rem;
@@ -229,14 +229,8 @@ header {
229
229
  font-size: 1rem;
230
230
  padding: 0 0.5rem;
231
231
  }
232
- </style></head><body><div id="jesthtml-content"><header><h1 id="title">Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit cdc230d8.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-07-19 10:23:49</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></div><div id="suite-1" class="suite-container"><div class="suite-info"><div class="suite-path">/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts</div><div class="suite-time warn">179.806s</div></div><div class="suite-tests"><div class="test-result failed"><div class="test-info"><div class="test-suitename"> </div><div class="test-title">TEST</div><div class="test-status">failed</div><div class="test-duration">168.85s</div></div><div class="failureMessages"> <pre class="failureMsg">Error: Test result : Bio.MSA.is_correct : TypeError: Cannot read properties of undefined (reading 'split')
233
- Test result : Bio.splitters.testHelm1 : Error: Expected R(U)P at position 0, got U
234
- Test result : Bio.splitters.testHelm2 : Error: Expected R(U)P at position 1, got U
235
- Test result : Bio.splitters.testHelm3 : Error: Expected R(U) at position 1, got U)
236
- Test result : Bio.converters.testFastaGapsToSeparator : Error: Units are not specified in column
237
- Test result : Bio.converters.testFastaGapsToHelm : Error: Units are not specified in column
238
- Test result : Bio.converters.HelmDnaToFasta : Error: Units are not specified in column
239
- Test result : Bio.converters.HelmDnaToSeparator : Error: Units are not specified in column
232
+ </style></head><body><div id="jesthtml-content"><header><h1 id="title">Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit 6fa72ec4.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-07-22 13:03:45</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></div><div id="suite-1" class="suite-container"><div class="suite-info"><div class="suite-path">/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts</div><div class="suite-time warn">213.603s</div></div><div class="suite-tests"><div class="test-result failed"><div class="test-info"><div class="test-suitename"> </div><div class="test-title">TEST</div><div class="test-status">failed</div><div class="test-duration">199.146s</div></div><div class="failureMessages"> <pre class="failureMsg">Error: Test result : Bio.MSA.is_correct : TypeError: Cannot read properties of undefined (reading 'split')
233
+ Test result : Bio.activityCliffs.activityCliffsOpen : Error: Expected "105 cliffs", got "2362 cliffs"
240
234
 
241
235
  at /home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:67:20
242
236
  at Generator.next (&lt;anonymous&gt;)
@@ -310,20 +304,29 @@ Test result : Bio.detectors.samplesTestSmiles2NegativeSmiles : OK
310
304
  Test result : Bio.detectors.samplesTestActivityCliffsNegativeSmiles : OK
311
305
  Test result : Bio.detectors.samplesFastaPtPosSequence : OK
312
306
  Test result : Bio.detectors.samplesTestCerealNegativeCerealName : OK
307
+ Test result : Bio.detectors.samplesTestSpgi100NegativeStereoCategory : OK
308
+ Test result : Bio.detectors.samplesTestSpgi100NegativeScaffoldNames : OK
309
+ Test result : Bio.detectors.samplesTestSpgi100NegativePrimaryScaffoldName : OK
310
+ Test result : Bio.detectors.samplesTestUnichemSourcesNegativeSrcUrl : OK
311
+ Test result : Bio.detectors.samplesTestUnichemSourcesNegativeBaseIdUrl : OK
313
312
  Test result : Bio.MSA.test_table.is_not_empty : OK
314
313
  Test result : Bio.sequenceSpace.sequenceSpaceOpens : OK
315
- Test result : Bio.activityCliffs.activityCliffsOpen : OK
316
314
  Test result : Bio.splitters.helm1 : OK
317
315
  Test result : Bio.splitters.helm2 : OK
318
316
  Test result : Bio.splitters.helm3-multichar : OK
317
+ Test result : Bio.splitters.testHelm1 : OK
318
+ Test result : Bio.splitters.testHelm2 : OK
319
+ Test result : Bio.splitters.testHelm3 : OK
319
320
  Test result : Bio.renderers.afterMsa : OK
320
321
  Test result : Bio.renderers.afterConvert : OK
321
322
  Test result : Bio.converters.testFastaPtToSeparator : OK
322
323
  Test result : Bio.converters.testFastaDnaToSeparator : OK
323
324
  Test result : Bio.converters.testFastaRnaToSeparator : OK
325
+ Test result : Bio.converters.testFastaGapsToSeparator : OK
324
326
  Test result : Bio.converters.testFastaPtToHelm : OK
325
327
  Test result : Bio.converters.testFastaDnaToHelm : OK
326
328
  Test result : Bio.converters.testFastaRnaToHelm : OK
329
+ Test result : Bio.converters.testFastaGapsToHelm : OK
327
330
  Test result : Bio.converters.testSeparatorPtToFasta : OK
328
331
  Test result : Bio.converters.testSeparatorDnaToFasta : OK
329
332
  Test result : Bio.converters.testSeparatorRnaToFasta : OK
@@ -332,8 +335,13 @@ Test result : Bio.converters.testSeparatorPtToHelm : OK
332
335
  Test result : Bio.converters.testSeparatorDnaToHelm : OK
333
336
  Test result : Bio.converters.testSeparatorRnaToHelm : OK
334
337
  Test result : Bio.converters.testSeparatorGapsToHelm : OK
335
- Test result : Bio.converters.HelmRnaToFasta : OK
336
- Test result : Bio.converters.HelmPtToFasta : OK
337
- Test result : Bio.converters.HelmRnaToSeparator : OK
338
- Test result : Bio.converters.HelmPtToSeparator : OK
338
+ Test result : Bio.converters.testHelmDnaToFasta : OK
339
+ Test result : Bio.converters.testHelmRnaToFasta : OK
340
+ Test result : Bio.converters.testHelmPtToFasta : OK
341
+ Test result : Bio.converters.testHelmDnaToSeparator : OK
342
+ Test result : Bio.converters.testHelmRnaToSeparator : OK
343
+ Test result : Bio.converters.testHelmPtToSeparator : OK
344
+ Test result : Bio.converters.testHelmLoneRibose : OK
345
+ Test result : Bio.converters.testHelmLoneDeoxyribose : OK
346
+ Test result : Bio.converters.testHelmLonePhosphorus : OK
339
347
  </pre></div></div></div></div></body></html>