@datagrok/peptides 1.2.0 → 1.3.0
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/dist/package-test.js +309 -393
- package/dist/package.js +363 -393
- package/package.json +1 -1
- package/src/model.ts +246 -159
- package/src/package.ts +13 -13
- package/src/styles.css +1 -0
- package/src/tests/core.ts +5 -5
- package/src/tests/peptide-space-test.ts +32 -32
- package/src/utils/cell-renderer.ts +27 -59
- package/src/utils/constants.ts +3 -0
- package/src/utils/types.ts +1 -1
- package/src/viewers/logo-summary.ts +42 -0
- package/src/viewers/sar-viewer.ts +31 -13
- package/src/widgets/analyze-peptides.ts +15 -6
- package/src/widgets/distribution.ts +1 -1
- package/src/widgets/mutation-cliffs.ts +1 -1
- package/test-Peptides-7770371320b2-8cac318e.html +246 -0
- package/src/utils/invariant-map.ts +0 -163
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<html><head><meta charset="utf-8"/><title>Peptides Test Report. Datagrok version datagrok/datagrok:latest SHA=7770371320b2. Commit 8cac318e.</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">Peptides Test Report. Datagrok version datagrok/datagrok:latest SHA=7770371320b2. Commit 8cac318e.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-09-29 14:06:21</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/Peptides/src/__jest__/remote.test.ts</div><div class="suite-time warn">118.684s</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">101.87s</div></div><div class="failureMessages"> <pre class="failureMsg">Error: Evaluation failed: TypeError: Cannot read properties of null (reading 'get')
|
|
233
|
+
at __puppeteer_evaluation_script__:17:71
|
|
234
|
+
at ExecutionContext._evaluateInternal (/home/runner/work/public/public/packages/Peptides/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
|
|
235
|
+
at processTicksAndRejections (internal/process/task_queues.js:97:5)
|
|
236
|
+
at ExecutionContext.evaluate (/home/runner/work/public/public/packages/Peptides/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)</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.<anonymous> (/home/runner/work/public/public/packages/Peptides/src/__jest__/test-node.ts:62:11)
|
|
237
|
+
at Generator.next (<anonymous>)
|
|
238
|
+
at fulfilled (/home/runner/work/public/public/packages/Peptides/src/__jest__/test-node.ts:28:58)
|
|
239
|
+
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/Peptides/src/__jest__/remote.test.ts:40:11
|
|
240
|
+
at Generator.next (<anonymous>)
|
|
241
|
+
at /home/runner/work/public/public/packages/Peptides/src/__jest__/remote.test.ts:34:71
|
|
242
|
+
at new Promise (<anonymous>)
|
|
243
|
+
at Object.<anonymous>.__awaiter (/home/runner/work/public/public/packages/Peptides/src/__jest__/remote.test.ts:30:12)
|
|
244
|
+
at Object.<anonymous> (/home/runner/work/public/public/packages/Peptides/src/__jest__/remote.test.ts:38:23)
|
|
245
|
+
at Promise.then.completed (/home/runner/work/public/public/packages/Peptides/node_modules/jest-circus/build/utils.js:391:28)
|
|
246
|
+
at new Promise (<anonymous>)</pre><pre class="suite-consolelog-item-message">Testing Peptides package</pre></div></div></div></div></body></html>
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import * as ui from 'datagrok-api/ui';
|
|
2
|
-
import * as DG from 'datagrok-api/dg';
|
|
3
|
-
|
|
4
|
-
import * as C from './constants';
|
|
5
|
-
import {PeptidesModel} from '../model';
|
|
6
|
-
import {isGridCellInvalid} from './misc';
|
|
7
|
-
|
|
8
|
-
const CELL_SIZE = 20; // 20px cell height and width
|
|
9
|
-
|
|
10
|
-
export class InvariantMap extends DG.Filter {
|
|
11
|
-
model: PeptidesModel | null = null;
|
|
12
|
-
chosenCells: {[position: string]: string[]} = {};
|
|
13
|
-
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get caption(): string {return 'Invariant Map';}
|
|
19
|
-
|
|
20
|
-
get filterSummary(): string {
|
|
21
|
-
let summary = '';
|
|
22
|
-
for (const [pos, aarList] of Object.entries(this.chosenCells))
|
|
23
|
-
if (aarList.length > 0)
|
|
24
|
-
summary += `${pos}: ${aarList}\n`;
|
|
25
|
-
|
|
26
|
-
return summary;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get isFiltering(): boolean {return true && super.isFiltering;}
|
|
30
|
-
|
|
31
|
-
get isReadyToApplyFilter(): boolean {return this.model != null;}
|
|
32
|
-
|
|
33
|
-
async attach(df: DG.DataFrame): Promise<void> {
|
|
34
|
-
super.attach(df);
|
|
35
|
-
this.model = await PeptidesModel.getInstance(df);
|
|
36
|
-
this.render(true);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
saveState(): any {
|
|
40
|
-
const state = super.saveState();
|
|
41
|
-
state.chosenCells = JSON.stringify(this.chosenCells);
|
|
42
|
-
return state;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
applyState(state: any): void {
|
|
46
|
-
super.applyState(state);
|
|
47
|
-
if (state.chosenCells) {
|
|
48
|
-
this.chosenCells = JSON.parse(state.chosenCells);
|
|
49
|
-
this.render();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
applyFilter(): void {
|
|
54
|
-
this.dataFrame?.filter.init((bitsetIndex) => {
|
|
55
|
-
for (const [position, aarList] of Object.entries(this.chosenCells)) {
|
|
56
|
-
if (aarList.length != 0 && !aarList.includes(this.dataFrame!.get(position, bitsetIndex)))
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
render(initChosenCells: boolean = false): void {
|
|
64
|
-
if (this.model == null)
|
|
65
|
-
return;
|
|
66
|
-
|
|
67
|
-
const invariantDf = this.model.statsDf.groupBy([C.COLUMNS_NAMES.MONOMER])
|
|
68
|
-
.pivot(C.COLUMNS_NAMES.POSITION)
|
|
69
|
-
.add('first', C.COLUMNS_NAMES.COUNT, '')
|
|
70
|
-
.aggregate();
|
|
71
|
-
invariantDf.getCol(C.COLUMNS_NAMES.MONOMER).semType = C.SEM_TYPES.MONOMER;
|
|
72
|
-
const orderedColNames = invariantDf.columns.names().sort((a, b) => {
|
|
73
|
-
const aInt = parseInt(a);
|
|
74
|
-
const bInt = parseInt(b);
|
|
75
|
-
if (isNaN(aInt))
|
|
76
|
-
return -1;
|
|
77
|
-
else if (isNaN(bInt))
|
|
78
|
-
return 1;
|
|
79
|
-
return aInt - bInt;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Create grid and set properties
|
|
83
|
-
const invariantGrid = invariantDf.plot.grid();
|
|
84
|
-
const gridCols = invariantGrid.columns;
|
|
85
|
-
gridCols.rowHeader!.visible = false;
|
|
86
|
-
gridCols.setOrder(orderedColNames);
|
|
87
|
-
|
|
88
|
-
for (let gridColIndex = 0; gridColIndex < gridCols.length; ++gridColIndex) {
|
|
89
|
-
const gridCol = gridCols.byIndex(gridColIndex)!
|
|
90
|
-
if (gridCol.name != C.COLUMNS_NAMES.MONOMER)
|
|
91
|
-
gridCol.width = CELL_SIZE;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (initChosenCells) {
|
|
95
|
-
this.chosenCells = {};
|
|
96
|
-
for (const col of invariantDf.columns)
|
|
97
|
-
if (col.name != C.COLUMNS_NAMES.MONOMER)
|
|
98
|
-
this.chosenCells[col.name] = [];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
invariantGrid.root.addEventListener('click', (ev) => {
|
|
102
|
-
invariantDf.currentRowIdx = -1;
|
|
103
|
-
const gridCell = invariantGrid.hitTest(ev.offsetX, ev.offsetY);
|
|
104
|
-
if (isGridCellInvalid(gridCell) || gridCell!.tableColumn!.name == C.COLUMNS_NAMES.MONOMER)
|
|
105
|
-
return;
|
|
106
|
-
|
|
107
|
-
const position = gridCell!.tableColumn!.name;
|
|
108
|
-
const aar = invariantDf.get(C.COLUMNS_NAMES.MONOMER, gridCell!.tableRowIndex!);
|
|
109
|
-
const aarList = this.chosenCells[position];
|
|
110
|
-
const aarIndex = aarList.indexOf(aar);
|
|
111
|
-
|
|
112
|
-
if (aarIndex != -1)
|
|
113
|
-
aarList.splice(aarIndex, 1);
|
|
114
|
-
else
|
|
115
|
-
aarList.push(aar);
|
|
116
|
-
|
|
117
|
-
invariantGrid.invalidate();
|
|
118
|
-
this.applyFilter();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
invariantGrid.onCellRender.subscribe((args) => {
|
|
122
|
-
//FIXME: for some reason it doesn't work when I set right away
|
|
123
|
-
const gridProps = invariantGrid.props;
|
|
124
|
-
gridProps.allowBlockSelection = false;
|
|
125
|
-
gridProps.allowColSelection = false;
|
|
126
|
-
gridProps.allowRowSelection = false;
|
|
127
|
-
gridProps.allowEdit = false;
|
|
128
|
-
gridProps.rowHeight = CELL_SIZE;
|
|
129
|
-
|
|
130
|
-
const gc = args.cell;
|
|
131
|
-
const tableColName = gc.tableColumn?.name;
|
|
132
|
-
const tableRowIndex = gc.tableRowIndex;
|
|
133
|
-
|
|
134
|
-
if (isGridCellInvalid(gc) || tableColName == C.COLUMNS_NAMES.MONOMER ||
|
|
135
|
-
tableRowIndex == null || tableRowIndex == -1)
|
|
136
|
-
return;
|
|
137
|
-
|
|
138
|
-
const currentPosition: string = tableColName !== C.COLUMNS_NAMES.MEAN_DIFFERENCE ?
|
|
139
|
-
tableColName : invariantDf.get(C.COLUMNS_NAMES.POSITION, tableRowIndex);
|
|
140
|
-
const currentAAR: string = invariantDf.get(C.COLUMNS_NAMES.MONOMER, tableRowIndex);
|
|
141
|
-
const canvasContext = args.g;
|
|
142
|
-
const bound = args.bounds;
|
|
143
|
-
|
|
144
|
-
canvasContext.font = '10px Roboto';
|
|
145
|
-
canvasContext.textAlign = 'center';
|
|
146
|
-
canvasContext.textBaseline = 'middle';
|
|
147
|
-
canvasContext.fillStyle = '#000';
|
|
148
|
-
canvasContext.fillText(gc.cell.value, bound.x + (bound.width / 2), bound.y + (bound.height / 2), bound.width);
|
|
149
|
-
|
|
150
|
-
const aarSelection = this.chosenCells[currentPosition];
|
|
151
|
-
if (aarSelection.includes(currentAAR)) {
|
|
152
|
-
canvasContext.strokeStyle = '#000';
|
|
153
|
-
canvasContext.lineWidth = 1;
|
|
154
|
-
canvasContext.strokeRect(bound.x + 1, bound.y + 1, bound.width - 1, bound.height - 1);
|
|
155
|
-
}
|
|
156
|
-
args.preventDefault();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const gridHost = ui.box(invariantGrid.root);
|
|
160
|
-
gridHost.style.width = '100%';
|
|
161
|
-
this.root.appendChild(gridHost);
|
|
162
|
-
}
|
|
163
|
-
}
|