@datagrok/bio 1.5.7 → 1.5.8

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 (36) hide show
  1. package/css/helm.css +3 -0
  2. package/detectors.js +9 -10
  3. package/dist/package-test.js +1095 -416
  4. package/dist/package.js +898 -250
  5. package/files/samples/sample_FASTA.csv +66 -66
  6. package/helm/JSDraw/Pistoia.HELM-uncompressed.js +9694 -0
  7. package/helm/JSDraw/Pistoia.HELM.js +27 -0
  8. package/helm/JSDraw/ReadMe.txt +8 -0
  9. package/helm/JSDraw/Scilligence.JSDraw2.Lite-uncompressed.js +31126 -0
  10. package/helm/JSDraw/Scilligence.JSDraw2.Lite.js +12 -0
  11. package/helm/JSDraw/Scilligence.JSDraw2.Resources.js +762 -0
  12. package/helm/JSDraw/dojo.js +250 -0
  13. package/helm/JSDraw/test.html +21 -0
  14. package/package.json +8 -1
  15. package/src/monomer-library.ts +199 -0
  16. package/src/package-test.ts +2 -0
  17. package/src/package.ts +41 -13
  18. package/src/tests/convert-test.ts +143 -22
  19. package/src/tests/detectors-test.ts +97 -156
  20. package/src/tests/renderer-test.ts +36 -0
  21. package/src/tests/splitter-test.ts +22 -0
  22. package/src/tests/types.ts +7 -0
  23. package/src/utils/atomic-works.ts +218 -97
  24. package/src/utils/cell-renderer.ts +214 -0
  25. package/src/utils/chem-palette.ts +280 -0
  26. package/src/utils/convert.ts +25 -16
  27. package/src/utils/misc.ts +29 -0
  28. package/src/utils/multiple-sequence-alignment.ts +1 -1
  29. package/src/utils/notation-converter.ts +120 -84
  30. package/src/utils/sequence-activity-cliffs.ts +2 -2
  31. package/src/utils/types.ts +13 -0
  32. package/src/utils/utils.ts +35 -30
  33. package/test-Bio-34f75e5127b8-c4c5a3dc.html +259 -0
  34. package/files/sample_FASTA.csv +0 -66
  35. package/files/sample_FASTA_with_activities.csv +0 -66
  36. package/files/sample_MSA.csv +0 -541
@@ -1,40 +1,45 @@
1
1
  import * as DG from 'datagrok-api/dg';
2
- import { WebLogo, SplitterFunc } from '@datagrok-libraries/bio/src/viewers/web-logo';
2
+ import {WebLogo, SplitterFunc} from '@datagrok-libraries/bio/src/viewers/web-logo';
3
3
  import * as grok from 'datagrok-api/grok';
4
4
 
5
- export const HELM_CORE_LIB_MONOMER_COL = 'symbol';
6
- export const HELM_CORE_LIB_MOLFILE_COL = 'molfile';
7
5
  export const HELM_CORE_LIB_FILENAME = '/samples/HELMCoreLibrary.json';
6
+ export const HELM_CORE_LIB_MONOMER_SYMBOL = 'symbol';
7
+ export const HELM_CORE_LIB_MOLFILE = 'molfile';
8
+ export const HELM_CORE_FIELDS = ['symbol', 'molfile', 'rgroups', 'name'];
8
9
 
9
- export function getMolfilesFromSeq(col: DG.Column, monomersLib: DG.DataFrame): string[][] | null {
10
- const units = col.tags[DG.TAGS.UNITS];
11
- const sep = col.getTag('separator');
12
- const splitterFunc: SplitterFunc = WebLogo.getSplitter(units, sep);
13
- const monomersDict = createMomomersMolDict(monomersLib);
14
- const molFiles = [];
15
- for (let i = 0; i < col.length; ++i) {
16
- const monomers = splitterFunc(col.get(i));
17
- const molFilesForSeq = [];
18
- for (let j = 0; j < monomers.length; ++j) {
19
- if (monomers[j]) {
20
- if (!monomersDict[monomers[j]]) {
21
- grok.shell.warning(`Monomer ${monomers[j]} is missing in HELM library. Structure cannot be created`);
22
- return null;
23
- }
24
- molFilesForSeq.push(monomersDict[monomers[j]])
25
- }
10
+ export function getMolfilesFromSeq(col: DG.Column, monomersLibObject: any[]): any[][] | null {
11
+ const units = col.tags[DG.TAGS.UNITS];
12
+ const sep = col.getTag('separator');
13
+ const splitterFunc: SplitterFunc = WebLogo.getSplitter(units, sep);
14
+ const monomersDict = createMomomersMolDict(monomersLibObject);
15
+ const molFiles = [];
16
+ for (let i = 0; i < col.length; ++i) {
17
+ const monomers = splitterFunc(col.get(i));
18
+ const molFilesForSeq = [];
19
+ for (let j = 0; j < monomers.length; ++j) {
20
+ if (monomers[j]) {
21
+ if (!monomersDict[monomers[j]]) {
22
+ grok.shell.warning(`Monomer ${monomers[j]} is missing in HELM library. Structure cannot be created`);
23
+ return null;
26
24
  }
27
- molFiles.push(molFilesForSeq);
25
+ molFilesForSeq.push(JSON.parse(JSON.stringify(monomersDict[monomers[j]])));
26
+ }
28
27
  }
29
- return molFiles;
28
+ molFiles.push(molFilesForSeq);
30
29
  }
30
+ return molFiles;
31
+ }
31
32
 
32
- export function createMomomersMolDict(lib: DG.DataFrame): {[key: string]: string} {
33
- const dict: {[key: string]: string} = {};
34
- const monmersCol = lib.col(HELM_CORE_LIB_MONOMER_COL);
35
- const molCol = lib.col(HELM_CORE_LIB_MOLFILE_COL);
36
- for (let i = 0; i < lib.rowCount; ++i) {
37
- dict[monmersCol!.get(i)] = molCol!.get(i);
33
+ export function createMomomersMolDict(lib: any[]): { [key: string]: string | any } {
34
+ const dict: { [key: string]: string | any } = {};
35
+ lib.forEach((it) => {
36
+ if (it['polymerType'] === 'PEPTIDE') {
37
+ const monomerObject: { [key: string]: any } = {};
38
+ HELM_CORE_FIELDS.forEach((field) => {
39
+ monomerObject[field] = it[field];
40
+ });
41
+ dict[it[HELM_CORE_LIB_MONOMER_SYMBOL]] = monomerObject;
38
42
  }
39
- return dict;
40
- }
43
+ });
44
+ return dict;
45
+ }
@@ -0,0 +1,259 @@
1
+ <html><head><meta charset="utf-8"/><title>Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit c4c5a3dc.</title><style type="text/css">html,
2
+ body {
3
+ font-family: Arial, Helvetica, sans-serif;
4
+ font-size: 1rem;
5
+ margin: 0;
6
+ padding: 0;
7
+ color: #333;
8
+ }
9
+ body {
10
+ padding: 2rem 1rem;
11
+ font-size: 0.85rem;
12
+ }
13
+ #jesthtml-content {
14
+ margin: 0 auto;
15
+ max-width: 70rem;
16
+ }
17
+ header {
18
+ display: flex;
19
+ align-items: center;
20
+ }
21
+ #title {
22
+ margin: 0;
23
+ flex-grow: 1;
24
+ }
25
+ #logo {
26
+ height: 4rem;
27
+ }
28
+ #timestamp {
29
+ color: #777;
30
+ margin-top: 0.5rem;
31
+ }
32
+
33
+ /** SUMMARY */
34
+ #summary {
35
+ color: #333;
36
+ margin: 2rem 0;
37
+ display: flex;
38
+ font-family: monospace;
39
+ font-size: 1rem;
40
+ }
41
+ #summary > div {
42
+ margin-right: 2rem;
43
+ background: #eee;
44
+ padding: 1rem;
45
+ min-width: 15rem;
46
+ }
47
+ #summary > div:last-child {
48
+ margin-right: 0;
49
+ }
50
+ @media only screen and (max-width: 720px) {
51
+ #summary {
52
+ flex-direction: column;
53
+ }
54
+ #summary > div {
55
+ margin-right: 0;
56
+ margin-top: 2rem;
57
+ }
58
+ #summary > div:first-child {
59
+ margin-top: 0;
60
+ }
61
+ }
62
+
63
+ .summary-total {
64
+ font-weight: bold;
65
+ margin-bottom: 0.5rem;
66
+ }
67
+ .summary-passed {
68
+ color: #4f8a10;
69
+ border-left: 0.4rem solid #4f8a10;
70
+ padding-left: 0.5rem;
71
+ }
72
+ .summary-failed,
73
+ .summary-obsolete-snapshots {
74
+ color: #d8000c;
75
+ border-left: 0.4rem solid #d8000c;
76
+ padding-left: 0.5rem;
77
+ }
78
+ .summary-pending {
79
+ color: #9f6000;
80
+ border-left: 0.4rem solid #9f6000;
81
+ padding-left: 0.5rem;
82
+ }
83
+ .summary-empty {
84
+ color: #999;
85
+ border-left: 0.4rem solid #999;
86
+ }
87
+
88
+ .test-result {
89
+ padding: 1rem;
90
+ margin-bottom: 0.25rem;
91
+ }
92
+ .test-result:last-child {
93
+ border: 0;
94
+ }
95
+ .test-result.passed {
96
+ background-color: #dff2bf;
97
+ color: #4f8a10;
98
+ }
99
+ .test-result.failed {
100
+ background-color: #ffbaba;
101
+ color: #d8000c;
102
+ }
103
+ .test-result.pending {
104
+ background-color: #ffdf61;
105
+ color: #9f6000;
106
+ }
107
+
108
+ .test-info {
109
+ display: flex;
110
+ justify-content: space-between;
111
+ }
112
+ .test-suitename {
113
+ width: 20%;
114
+ text-align: left;
115
+ font-weight: bold;
116
+ word-break: break-word;
117
+ }
118
+ .test-title {
119
+ width: 40%;
120
+ text-align: left;
121
+ font-style: italic;
122
+ }
123
+ .test-status {
124
+ width: 20%;
125
+ text-align: right;
126
+ }
127
+ .test-duration {
128
+ width: 10%;
129
+ text-align: right;
130
+ font-size: 0.75rem;
131
+ }
132
+
133
+ .failureMessages {
134
+ padding: 0 1rem;
135
+ margin-top: 1rem;
136
+ border-top: 1px dashed #d8000c;
137
+ }
138
+ .failureMessages.suiteFailure {
139
+ border-top: none;
140
+ }
141
+ .failureMsg {
142
+ white-space: pre-wrap;
143
+ white-space: -moz-pre-wrap;
144
+ white-space: -pre-wrap;
145
+ white-space: -o-pre-wrap;
146
+ word-wrap: break-word;
147
+ }
148
+
149
+ .suite-container {
150
+ margin-bottom: 2rem;
151
+ }
152
+ .suite-info {
153
+ padding: 1rem;
154
+ background-color: #eee;
155
+ color: #777;
156
+ display: flex;
157
+ align-items: center;
158
+ margin-bottom: 0.25rem;
159
+ }
160
+ .suite-info .suite-path {
161
+ word-break: break-all;
162
+ flex-grow: 1;
163
+ font-family: monospace;
164
+ font-size: 1rem;
165
+ }
166
+ .suite-info .suite-time {
167
+ margin-left: 0.5rem;
168
+ padding: 0.2rem 0.3rem;
169
+ font-size: 0.75rem;
170
+ }
171
+ .suite-info .suite-time.warn {
172
+ background-color: #d8000c;
173
+ color: #fff;
174
+ }
175
+
176
+ /* CONSOLE LOGS */
177
+ .suite-consolelog {
178
+ margin-bottom: 0.25rem;
179
+ padding: 1rem;
180
+ background-color: #efefef;
181
+ }
182
+ .suite-consolelog-header {
183
+ font-weight: bold;
184
+ }
185
+ .suite-consolelog-item {
186
+ padding: 0.5rem;
187
+ }
188
+ .suite-consolelog-item pre {
189
+ margin: 0.5rem 0;
190
+ white-space: pre-wrap;
191
+ white-space: -moz-pre-wrap;
192
+ white-space: -pre-wrap;
193
+ white-space: -o-pre-wrap;
194
+ word-wrap: break-word;
195
+ }
196
+ .suite-consolelog-item-origin {
197
+ color: #777;
198
+ font-weight: bold;
199
+ }
200
+ .suite-consolelog-item-message {
201
+ color: #000;
202
+ font-size: 1rem;
203
+ padding: 0 0.5rem;
204
+ }
205
+
206
+ /* OBSOLETE SNAPSHOTS */
207
+ .suite-obsolete-snapshots {
208
+ margin-bottom: 0.25rem;
209
+ padding: 1rem;
210
+ background-color: #ffbaba;
211
+ color: #d8000c;
212
+ }
213
+ .suite-obsolete-snapshots-header {
214
+ font-weight: bold;
215
+ }
216
+ .suite-obsolete-snapshots-item {
217
+ padding: 0.5rem;
218
+ }
219
+ .suite-obsolete-snapshots-item pre {
220
+ margin: 0.5rem 0;
221
+ white-space: pre-wrap;
222
+ white-space: -moz-pre-wrap;
223
+ white-space: -pre-wrap;
224
+ white-space: -o-pre-wrap;
225
+ word-wrap: break-word;
226
+ }
227
+ .suite-obsolete-snapshots-item-message {
228
+ color: #000;
229
+ font-size: 1rem;
230
+ padding: 0 0.5rem;
231
+ }
232
+ </style></head><body><div id="jesthtml-content"><header><h1 id="title">Bio Test Report. Datagrok version datagrok/datagrok:latest SHA=34f75e5127b8. Commit c4c5a3dc.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-07-11 10:13:14</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">94.078s</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">84.418s</div></div><div class="failureMessages"> <pre class="failureMsg">Error: expect(received).toBe(expected) // Object.is equality
233
+
234
+ Expected: false
235
+ Received: true
236
+ at /home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:49:20
237
+ at Generator.next (&lt;anonymous&gt;)
238
+ at fulfilled (/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:31:58)
239
+ at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre></div></div></div><div class="suite-consolelog"><div class="suite-consolelog-header">Console Log</div><div class="suite-consolelog-item"><pre class="suite-consolelog-item-origin"> at Object.&lt;anonymous&gt; (/home/runner/work/public/public/packages/Bio/src/__jest__/test-node.ts:63:11)
240
+ at Generator.next (&lt;anonymous&gt;)
241
+ at fulfilled (/home/runner/work/public/public/packages/Bio/src/__jest__/test-node.ts:28:58)
242
+ at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre><pre class="suite-consolelog-item-message">Using web root: http://localhost:8080</pre></div><div class="suite-consolelog-item"><pre class="suite-consolelog-item-origin"> at /home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:24:11
243
+ at Generator.next (&lt;anonymous&gt;)
244
+ at /home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:34:71
245
+ at new Promise (&lt;anonymous&gt;)
246
+ at Object.&lt;anonymous&gt;.__awaiter (/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:30:12)
247
+ at Object.&lt;anonymous&gt; (/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:22:23)
248
+ at Promise.then.completed (/home/runner/work/public/public/packages/Bio/node_modules/jest-circus/build/utils.js:391:28)
249
+ at new Promise (&lt;anonymous&gt;)</pre><pre class="suite-consolelog-item-message">Testing Bio package</pre></div><div class="suite-consolelog-item"><pre class="suite-consolelog-item-origin"> at /home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:47:11
250
+ at Generator.next (&lt;anonymous&gt;)
251
+ at fulfilled (/home/runner/work/public/public/packages/Bio/src/__jest__/remote.test.ts:31:58)
252
+ at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre><pre class="suite-consolelog-item-message">MSA.is_correct: TypeError: Cannot read properties of undefined (reading 'split')
253
+ sequenceSpace.sequenceSpaceOpens: TypeError: Cannot read properties of undefined (reading 'col')
254
+ sequenceSpace.init: Operation caused an exception (FileSystemException: Cannot open file, path = '/home/grok/data/prod/packages/data/Bio/sample_FASTA.csv' (OS Error: No such file or directory, errno = 2))
255
+ activityCliffs.activityCliffsOpen: TypeError: Cannot read properties of undefined (reading 'columns')
256
+ activityCliffs.init: TypeError: Cannot read properties of undefined (reading 'close')
257
+ activityCliffs.init: Operation caused an exception (FileSystemException: Cannot open file, path = '/home/grok/data/prod/packages/data/Bio/sample_MSA.csv' (OS Error: No such file or directory, errno = 2))
258
+ renderers.afterMsa: Error: Expected "Macromolecule", got "null"
259
+ </pre></div></div></div></div></body></html>