@datagrok/peptides 0.4.2 → 0.6.1
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/detectors.js +1 -1
- package/package.json +5 -3
- package/src/describe.ts +36 -40
- package/src/package.ts +27 -44
- package/src/peptides.ts +70 -6
- package/src/styles.css +37 -0
- package/src/utils/cell-renderer.ts +126 -19
- package/src/utils/chem-palette.ts +317 -214
- package/src/utils/correlation-analysis.ts +149 -71
- package/src/utils/peptide-similarity-space.ts +23 -19
- package/src/utils/split-aligned.ts +8 -1
- package/src/viewers/logo-viewer.ts +48 -5
- package/src/viewers/model.ts +27 -0
- package/src/viewers/sar-viewer.ts +99 -38
- package/src/viewers/spiral-plot.ts +97 -0
- package/src/viewers/stacked-barchart-viewer.ts +82 -7
- package/src/viewers/subst-viewer.ts +276 -0
- package/src/widgets/analyze-peptides.ts +14 -4
- package/src/widgets/manual-alignment.ts +11 -4
- package/src/widgets/peptide-molecule.ts +7 -0
- package/webpack.config.js +4 -0
package/detectors.js
CHANGED
|
@@ -3,7 +3,7 @@ class PeptidesPackageDetectors extends DG.Package {
|
|
|
3
3
|
//input: column col
|
|
4
4
|
//output: string semType
|
|
5
5
|
detectAligned(col) {
|
|
6
|
-
const regexp = new RegExp(/^([^-^\n]*-){
|
|
6
|
+
const regexp = new RegExp(/^([^-^\n]*-){7,49}(\w|\(|\))+$/);
|
|
7
7
|
return DG.Detector.sampleCategories(col, (s) => regexp.test(s.trim())) ? 'alignedSequence' : null;
|
|
8
8
|
}
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/peptides",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@keckelt/tsne": "^1.0.2",
|
|
7
7
|
"cash-dom": "latest",
|
|
8
8
|
"d3": "latest",
|
|
9
|
-
"datagrok-api": ">=0.
|
|
9
|
+
"datagrok-api": ">=0.104.0",
|
|
10
10
|
"dayjs": "latest",
|
|
11
11
|
"jaro-winkler-typescript": "^1.0.1",
|
|
12
12
|
"jstat": "^1.9.5",
|
|
13
13
|
"logojs-react": "^2.1.1",
|
|
14
14
|
"rxjs": "^6.5.5",
|
|
15
15
|
"umap-js": "^1.3.3",
|
|
16
|
-
"@datagrok-libraries/utils": ">=0.0.
|
|
16
|
+
"@datagrok-libraries/utils": ">=0.0.13",
|
|
17
17
|
"@datagrok-libraries/statistics": ">=0.1.5",
|
|
18
18
|
"@types/d3": "^7.0.0",
|
|
19
19
|
"@types/jquery": "^3.5.6"
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"typescript": "^4.4.4",
|
|
23
23
|
"ts-loader": "^9.2.5",
|
|
24
|
+
"css-loader": "^5.2.4",
|
|
25
|
+
"style-loader": "^2.0.0",
|
|
24
26
|
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
|
25
27
|
"@typescript-eslint/parser": "^4.29.1",
|
|
26
28
|
"eslint": "^7.32.0",
|
package/src/describe.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
|
2
|
-
import * as grok from 'datagrok-api/grok';
|
|
3
1
|
import * as ui from 'datagrok-api/ui';
|
|
4
2
|
import * as DG from 'datagrok-api/dg';
|
|
5
3
|
import {splitAlignedPeptides} from './utils/split-aligned';
|
|
@@ -10,7 +8,7 @@ import {setAARRenderer} from './utils/cell-renderer';
|
|
|
10
8
|
|
|
11
9
|
const cp = new ChemPalette('grok');
|
|
12
10
|
|
|
13
|
-
const aarGroups = {
|
|
11
|
+
export const aarGroups = {
|
|
14
12
|
'R': 'PC',
|
|
15
13
|
'H': 'PC',
|
|
16
14
|
'K': 'PC',
|
|
@@ -47,6 +45,15 @@ const groupDescription: {[key: string]: {'description': string, 'aminoAcids': st
|
|
|
47
45
|
'-': {'description': 'Unknown Amino Acid', 'aminoAcids': ['-']},
|
|
48
46
|
};
|
|
49
47
|
|
|
48
|
+
/*function customGridColumnHeader(cell: DG.GridCell) {
|
|
49
|
+
if (cell.isColHeader && cell.tableColumn != null) {
|
|
50
|
+
if (highlightedColumns.includes(parseInt(cell.tableColumn.name))) {
|
|
51
|
+
cell.style.backColor = 0xff1f77b4;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}*/
|
|
55
|
+
|
|
56
|
+
//TODO: decomposition!
|
|
50
57
|
export async function describe(
|
|
51
58
|
df: DG.DataFrame,
|
|
52
59
|
activityColumn: string,
|
|
@@ -62,6 +69,7 @@ export async function describe(
|
|
|
62
69
|
const col: DG.Column = df.columns.bySemType('alignedSequence');
|
|
63
70
|
[splitSeqDf, invalidIndexes] = splitAlignedPeptides(col);
|
|
64
71
|
splitSeqDf.name = 'Split sequence';
|
|
72
|
+
|
|
65
73
|
const positionColumns = splitSeqDf.columns.names();
|
|
66
74
|
const activityColumnScaled = `${activityColumn}Scaled`;
|
|
67
75
|
const renderColNames: string[] = splitSeqDf.columns.names();
|
|
@@ -170,7 +178,7 @@ export async function describe(
|
|
|
170
178
|
|
|
171
179
|
//calculate p-values based on t-test
|
|
172
180
|
let position: string;
|
|
173
|
-
let
|
|
181
|
+
let aar: string;
|
|
174
182
|
let currentActivity: number[];
|
|
175
183
|
let otherActivity: number[];
|
|
176
184
|
let testResult;
|
|
@@ -182,17 +190,17 @@ export async function describe(
|
|
|
182
190
|
const pValCol: DG.Column = matrixDf.columns.addNewFloat('pValue');
|
|
183
191
|
for (let i = 0; i < matrixDf.rowCount; i++) {
|
|
184
192
|
position = matrixDf.get(positionColName, i);
|
|
185
|
-
|
|
193
|
+
aar = matrixDf.get(aminoAcidResidue, i);
|
|
186
194
|
|
|
187
195
|
//@ts-ignore
|
|
188
|
-
splitSeqDf.rows.select((row) => groupMapping[row[position]] ===
|
|
196
|
+
splitSeqDf.rows.select((row) => groupMapping[row[position]] === aar);
|
|
189
197
|
currentActivity = splitSeqDf
|
|
190
198
|
.clone(splitSeqDf.selection, [activityColumnScaled])
|
|
191
199
|
.getCol(activityColumnScaled)
|
|
192
200
|
.toList();
|
|
193
201
|
|
|
194
202
|
//@ts-ignore
|
|
195
|
-
splitSeqDf.rows.select((row) => groupMapping[row[position]] !==
|
|
203
|
+
splitSeqDf.rows.select((row) => groupMapping[row[position]] !== aar);
|
|
196
204
|
otherActivity = splitSeqDf
|
|
197
205
|
.clone(splitSeqDf.selection, [activityColumnScaled])
|
|
198
206
|
.getCol(activityColumnScaled)
|
|
@@ -240,11 +248,9 @@ export async function describe(
|
|
|
240
248
|
aarList.sort((first, second) => getWeight(second) - getWeight(first));
|
|
241
249
|
|
|
242
250
|
matrixDf.getCol(aminoAcidResidue).setCategoryOrder(aarList);
|
|
243
|
-
//const sequenceDf = segregateBestAtAllCateg(statsDf, twoColorMode);
|
|
244
251
|
|
|
245
252
|
// SAR vertical table (naive, choose best Mean difference from pVals <= 0.01)
|
|
246
253
|
// TODO: aquire ALL of the positions
|
|
247
|
-
|
|
248
254
|
let sequenceDf = statsDf.groupBy(['Mean difference', aminoAcidResidue, positionColName, 'Count', 'Ratio', 'pValue'])
|
|
249
255
|
.where('pValue <= 0.1')
|
|
250
256
|
.aggregate();
|
|
@@ -265,23 +271,23 @@ export async function describe(
|
|
|
265
271
|
renderColNames.push('Mean difference');
|
|
266
272
|
|
|
267
273
|
// !!! DRAWING PHASE !!!
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
274
|
+
const sarGrid = matrixDf.plot.grid();
|
|
275
|
+
sarGrid.sort([aminoAcidResidue]);
|
|
276
|
+
sarGrid.columns.setOrder([aminoAcidResidue].concat(positionColumns));
|
|
271
277
|
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
278
|
+
const sarVGrid = sequenceDf.plot.grid();
|
|
279
|
+
sarVGrid.sort([positionColName]);
|
|
280
|
+
sarVGrid.col('pValue')!.format = 'four digits after comma';
|
|
281
|
+
sarVGrid.col('pValue')!.name = 'P-Value';
|
|
276
282
|
|
|
277
283
|
if (!grouping) {
|
|
278
284
|
let tempCol = matrixDf.columns.byName(aminoAcidResidue);
|
|
279
285
|
if (tempCol) {
|
|
280
|
-
setAARRenderer(tempCol,
|
|
286
|
+
setAARRenderer(tempCol, sarGrid);
|
|
281
287
|
}
|
|
282
288
|
tempCol = sequenceDf.columns.byName(aminoAcidResidue);
|
|
283
289
|
if (tempCol) {
|
|
284
|
-
setAARRenderer(tempCol,
|
|
290
|
+
setAARRenderer(tempCol, sarGrid);
|
|
285
291
|
}
|
|
286
292
|
}
|
|
287
293
|
|
|
@@ -298,19 +304,6 @@ export async function describe(
|
|
|
298
304
|
return;
|
|
299
305
|
}
|
|
300
306
|
|
|
301
|
-
// if (args.cell.isColHeader) {
|
|
302
|
-
// if (args.cell.gridColumn.name != aminoAcidResidue) {
|
|
303
|
-
// const textSize = args.g.measureText(args.cell.gridColumn.name);
|
|
304
|
-
// args.g.fillStyle = '#4b4b4a';
|
|
305
|
-
// args.g.fillText(
|
|
306
|
-
// args.cell.gridColumn.name,
|
|
307
|
-
// args.bounds.x + (args.bounds.width - textSize.width) / 2,
|
|
308
|
-
// args.bounds.y + (textSize.actualBoundingBoxAscent + textSize.actualBoundingBoxDescent),
|
|
309
|
-
// );
|
|
310
|
-
// }
|
|
311
|
-
// args.preventDefault();
|
|
312
|
-
// }
|
|
313
|
-
|
|
314
307
|
if (
|
|
315
308
|
args.cell.isTableCell &&
|
|
316
309
|
args.cell.tableRowIndex !== null &&
|
|
@@ -365,8 +358,8 @@ export async function describe(
|
|
|
365
358
|
}
|
|
366
359
|
args.g.restore();
|
|
367
360
|
};
|
|
368
|
-
|
|
369
|
-
|
|
361
|
+
sarGrid.onCellRender.subscribe(cellRendererFunc);
|
|
362
|
+
sarVGrid.onCellRender.subscribe(cellRendererFunc);
|
|
370
363
|
|
|
371
364
|
// show all the statistics in a tooltip over cell
|
|
372
365
|
const onCellTooltipFunc = function(cell: DG.GridCell, x: number, y: number) {
|
|
@@ -419,10 +412,10 @@ export async function describe(
|
|
|
419
412
|
}
|
|
420
413
|
return true;
|
|
421
414
|
};
|
|
422
|
-
|
|
423
|
-
|
|
415
|
+
sarGrid.onCellTooltip(onCellTooltipFunc);
|
|
416
|
+
sarVGrid.onCellTooltip(onCellTooltipFunc);
|
|
424
417
|
|
|
425
|
-
sourceGrid.onCellPrepare((cell) => {
|
|
418
|
+
sourceGrid.onCellPrepare((cell: DG.GridCell) => {
|
|
426
419
|
const currentRowIndex = cell.tableRowIndex;
|
|
427
420
|
if (currentRowIndex && invalidIndexes.includes(currentRowIndex) && !cell.isRowHeader) {
|
|
428
421
|
cell.style.backColor = DG.Color.lightLightGray;
|
|
@@ -430,13 +423,16 @@ export async function describe(
|
|
|
430
423
|
});
|
|
431
424
|
|
|
432
425
|
for (const col of matrixDf.columns.names()) {
|
|
433
|
-
|
|
426
|
+
sarGrid.col(col)!.width = sarGrid.props.rowHeight;
|
|
434
427
|
}
|
|
435
428
|
|
|
436
429
|
if (grouping) {
|
|
437
|
-
|
|
438
|
-
|
|
430
|
+
sarGrid.col(aminoAcidResidue)!.name = 'Groups';
|
|
431
|
+
sarVGrid.col(aminoAcidResidue)!.name = 'Groups';
|
|
439
432
|
}
|
|
440
433
|
|
|
441
|
-
|
|
434
|
+
sarGrid.props.allowEdit = false;
|
|
435
|
+
sarVGrid.props.allowEdit = false;
|
|
436
|
+
|
|
437
|
+
return [sarGrid, sarVGrid, statsDf, groupMapping];
|
|
442
438
|
}
|
package/src/package.ts
CHANGED
|
@@ -15,7 +15,8 @@ import {PeptideSimilaritySpaceWidget} from './utils/peptide-similarity-space';
|
|
|
15
15
|
import {manualAlignmentWidget} from './widgets/manual-alignment';
|
|
16
16
|
import {SARViewer, SARViewerVertical} from './viewers/sar-viewer';
|
|
17
17
|
import {peptideMoleculeWidget} from './widgets/peptide-molecule';
|
|
18
|
-
import {
|
|
18
|
+
import {SpiralPlot} from './viewers/spiral-plot';
|
|
19
|
+
import {SubstViewer} from './viewers/subst-viewer';
|
|
19
20
|
|
|
20
21
|
export const _package = new DG.Package();
|
|
21
22
|
let tableGrid: DG.Grid;
|
|
@@ -25,35 +26,13 @@ let view: DG.TableView;
|
|
|
25
26
|
|
|
26
27
|
async function main(chosenFile: string) {
|
|
27
28
|
const pi = DG.TaskBarProgressIndicator.create('Loading Peptides');
|
|
28
|
-
//let peptides =
|
|
29
|
-
// await grok.data.loadTable('https://datagrok.jnj.com/p/ejaeger.il23peptideidp5562/il-23_peptide_idp-5562');
|
|
30
29
|
const path = _package.webRoot + 'files/' + chosenFile;
|
|
31
30
|
const peptides = (await grok.data.loadTable(path));
|
|
32
31
|
peptides.name = 'Peptides';
|
|
33
32
|
peptides.setTag('dataType', 'peptides');
|
|
34
33
|
const view = grok.shell.addTableView(peptides);
|
|
35
34
|
tableGrid = view.grid;
|
|
36
|
-
// peptides.onSemanticTypeDetecting.subscribe((_: any) => {
|
|
37
|
-
// const regexp = new RegExp(/^([^-^\n]*-){2,49}(\w|\(|\))+$/);
|
|
38
|
-
// for (const col of peptides.columns) {
|
|
39
|
-
// col.semType = DG.Detector.sampleCategories(col, (s: any) => regexp.test(s.trim())) ? 'alignedSequence' : null;
|
|
40
|
-
// if (col.semType == 'alignedSequence') {
|
|
41
|
-
// expandColumn(col, tableGrid, (ent)=>{
|
|
42
|
-
// const subParts:string[] = ent.split('-');
|
|
43
|
-
// // eslint-disable-next-line no-unused-vars
|
|
44
|
-
// const [text, _] = processSequence(subParts);
|
|
45
|
-
// let textSize = 0;
|
|
46
|
-
// text.forEach((aar)=>{
|
|
47
|
-
// textSize += aar.length;
|
|
48
|
-
// });
|
|
49
|
-
// return textSize;
|
|
50
|
-
// });
|
|
51
|
-
// }
|
|
52
|
-
// }
|
|
53
|
-
// });
|
|
54
|
-
|
|
55
35
|
view.name = 'PeptidesView';
|
|
56
|
-
|
|
57
36
|
grok.shell.windows.showProperties = true;
|
|
58
37
|
|
|
59
38
|
pi.close();
|
|
@@ -67,7 +46,6 @@ export function Peptides() {
|
|
|
67
46
|
|
|
68
47
|
const appDescription = ui.info(
|
|
69
48
|
[
|
|
70
|
-
// ui.divText('\n To start the application :', {style: {'font-weight': 'bolder'}}),
|
|
71
49
|
ui.list([
|
|
72
50
|
'- automatic recognition of peptide sequences',
|
|
73
51
|
'- native integration with tons of Datagrok out-of-the box features (visualization, filtering, clustering, ' +
|
|
@@ -86,25 +64,18 @@ export function Peptides() {
|
|
|
86
64
|
'Use and analyse peptide sequence data to support your research:',
|
|
87
65
|
);
|
|
88
66
|
|
|
89
|
-
const annotationViewerDiv = ui.div();
|
|
90
|
-
|
|
91
67
|
const windows = grok.shell.windows;
|
|
92
68
|
windows.showToolbox = false;
|
|
93
69
|
windows.showHelp = false;
|
|
94
70
|
windows.showProperties = false;
|
|
95
71
|
|
|
96
|
-
const mainDiv = ui.div();
|
|
97
72
|
grok.shell.newView('Peptides', [
|
|
98
73
|
appDescription,
|
|
99
74
|
ui.info([textLink]),
|
|
100
|
-
ui.
|
|
101
|
-
ui.
|
|
102
|
-
|
|
103
|
-
ui.button('Open complex case demo', () => main('aligned_2.csv'), ''),
|
|
104
|
-
]),
|
|
105
|
-
ui.block75([annotationViewerDiv]),
|
|
75
|
+
ui.divH([
|
|
76
|
+
ui.button('Open peptide sequences demonstration set', () => main('aligned.csv'), ''),
|
|
77
|
+
ui.button('Open complex case demo', () => main('aligned_2.csv'), ''),
|
|
106
78
|
]),
|
|
107
|
-
mainDiv,
|
|
108
79
|
]);
|
|
109
80
|
}
|
|
110
81
|
|
|
@@ -113,6 +84,9 @@ export function Peptides() {
|
|
|
113
84
|
//input: column col {semType: alignedSequence}
|
|
114
85
|
//output: widget result
|
|
115
86
|
export async function peptidesPanel(col: DG.Column): Promise<DG.Widget> {
|
|
87
|
+
if (col.getTag('isAnalysisApplicable') === 'false') {
|
|
88
|
+
return new DG.Widget(ui.divText('Analysis is not applicable'));
|
|
89
|
+
}
|
|
116
90
|
view = (grok.shell.v as DG.TableView);
|
|
117
91
|
tableGrid = view.grid;
|
|
118
92
|
currentDf = col.dataFrame;
|
|
@@ -136,6 +110,14 @@ export function sarVertical(): SARViewerVertical {
|
|
|
136
110
|
return new SARViewerVertical();
|
|
137
111
|
}
|
|
138
112
|
|
|
113
|
+
//name: substitution-analysis-viewer
|
|
114
|
+
//description: Substitution Analysis Viewer
|
|
115
|
+
//tags: viewer
|
|
116
|
+
//output: viewer result
|
|
117
|
+
export function subst(): SubstViewer {
|
|
118
|
+
return new SubstViewer();
|
|
119
|
+
}
|
|
120
|
+
|
|
139
121
|
//name: StackedBarchart Widget
|
|
140
122
|
//tags: panel, widgets
|
|
141
123
|
//input: column col {semType: aminoAcids}
|
|
@@ -201,14 +183,15 @@ export async function peptideSpacePanel(col: DG.Column): Promise<DG.Widget> {
|
|
|
201
183
|
return await widget.draw();
|
|
202
184
|
}
|
|
203
185
|
|
|
204
|
-
//name:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
186
|
+
//name: Spiral Plot
|
|
187
|
+
////input: dataframe table
|
|
188
|
+
////input: column activity
|
|
189
|
+
//tags: viewer, panel
|
|
190
|
+
//output: viewer result
|
|
191
|
+
export async function spiralPlot(): Promise<DG.Viewer> {//(table: DG.DataFrame, activity: DG.Column) {
|
|
192
|
+
// Read as dataframe
|
|
193
|
+
const table = await grok.data.files.openTable('Demo:TestJobs:Files:DemoFiles/bio/peptides.csv');
|
|
194
|
+
const activity = await table.columns.addNewCalculated('-log10(Activity)', '0-Log10(${Activity})');
|
|
195
|
+
view = grok.shell.addTableView(table);
|
|
196
|
+
return view.addViewer(SpiralPlot.fromTable(table, {valuesColumnName: activity.name}));
|
|
214
197
|
}
|
package/src/peptides.ts
CHANGED
|
@@ -2,8 +2,26 @@ import * as ui from 'datagrok-api/ui';
|
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
import {createPeptideSimilaritySpaceViewer} from './utils/peptide-similarity-space';
|
|
4
4
|
import {addViewerToHeader} from './viewers/stacked-barchart-viewer';
|
|
5
|
+
// import $ from 'cash-dom';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Peptides controller class.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class Peptides
|
|
12
|
+
*/
|
|
6
13
|
export class Peptides {
|
|
14
|
+
/**
|
|
15
|
+
* Class initializer
|
|
16
|
+
*
|
|
17
|
+
* @param {DG.Grid} tableGrid Working talbe grid.
|
|
18
|
+
* @param {DG.TableView} view Working view.
|
|
19
|
+
* @param {DG.DataFrame} currentDf Working table.
|
|
20
|
+
* @param {{[key: string]: string}} options SAR viewer options
|
|
21
|
+
* @param {DG.Column} col Aligned sequences column.
|
|
22
|
+
* @param {string} activityColumnChoice Activity column name.
|
|
23
|
+
* @memberof Peptides
|
|
24
|
+
*/
|
|
7
25
|
async init(
|
|
8
26
|
tableGrid: DG.Grid,
|
|
9
27
|
view: DG.TableView,
|
|
@@ -13,10 +31,10 @@ export class Peptides {
|
|
|
13
31
|
activityColumnChoice: string,
|
|
14
32
|
) {
|
|
15
33
|
for (let i = 0; i < tableGrid.columns.length; i++) {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
const aarCol = tableGrid.columns.byIndex(i);
|
|
35
|
+
if (aarCol &&
|
|
36
|
+
aarCol.name &&
|
|
37
|
+
aarCol.column?.semType != 'aminoAcids'
|
|
20
38
|
) {
|
|
21
39
|
//@ts-ignore
|
|
22
40
|
tableGrid.columns.byIndex(i)?.visible = false;
|
|
@@ -24,12 +42,18 @@ export class Peptides {
|
|
|
24
42
|
}
|
|
25
43
|
|
|
26
44
|
const originalDfColumns = (currentDf.columns as DG.ColumnList).names();
|
|
45
|
+
const originalDfName = currentDf.name;
|
|
46
|
+
|
|
47
|
+
const substViewer = view.addViewer(
|
|
48
|
+
'substitution-analysis-viewer', {'activityColumnName': options['activityColumnName']},
|
|
49
|
+
);
|
|
50
|
+
view.dockManager.dock(substViewer, DG.DOCK_TYPE.RIGHT, null, 'Substitution Analysis');
|
|
27
51
|
|
|
28
52
|
const sarViewer = view.addViewer('peptide-sar-viewer', options);
|
|
29
53
|
const sarNode = view.dockManager.dock(sarViewer, DG.DOCK_TYPE.DOWN, null, 'SAR Viewer');
|
|
30
54
|
|
|
31
55
|
const sarViewerVertical = view.addViewer('peptide-sar-viewer-vertical');
|
|
32
|
-
view.dockManager.dock(sarViewerVertical, DG.DOCK_TYPE.RIGHT, sarNode, 'SAR Vertical Viewer');
|
|
56
|
+
const sarVNode = view.dockManager.dock(sarViewerVertical, DG.DOCK_TYPE.RIGHT, sarNode, 'SAR Vertical Viewer');
|
|
33
57
|
|
|
34
58
|
const peptideSpaceViewer = await createPeptideSimilaritySpaceViewer(
|
|
35
59
|
currentDf,
|
|
@@ -40,10 +64,13 @@ export class Peptides {
|
|
|
40
64
|
view,
|
|
41
65
|
`${activityColumnChoice}Scaled`,
|
|
42
66
|
);
|
|
43
|
-
view.dockManager.dock(peptideSpaceViewer, DG.DOCK_TYPE.LEFT, sarNode, 'Peptide Space Viewer', 0.3);
|
|
67
|
+
const psNode = view.dockManager.dock(peptideSpaceViewer, DG.DOCK_TYPE.LEFT, sarNode, 'Peptide Space Viewer', 0.3);
|
|
68
|
+
// const sarDockNodes = [sarNode, sarVNode, psNode];
|
|
69
|
+
// const sarViewers = [sarViewer, sarViewerVertical, peptideSpaceViewer];
|
|
44
70
|
|
|
45
71
|
const StackedBarchartProm = currentDf.plot.fromType('StackedBarChartAA');
|
|
46
72
|
addViewerToHeader(tableGrid, StackedBarchartProm);
|
|
73
|
+
tableGrid.props.allowEdit = false;
|
|
47
74
|
|
|
48
75
|
const hideIcon = ui.iconFA('window-close', () => { //undo?, times?
|
|
49
76
|
const viewers = [];
|
|
@@ -66,10 +93,47 @@ export class Peptides {
|
|
|
66
93
|
|
|
67
94
|
tableGrid.setOptions({'colHeaderHeight': 20});
|
|
68
95
|
tableGrid.columns.setVisible(originalDfColumns);
|
|
96
|
+
tableGrid.props.allowEdit = true;
|
|
97
|
+
currentDf.name = originalDfName;
|
|
69
98
|
|
|
70
99
|
view.setRibbonPanels(ribbonPanels);
|
|
71
100
|
}, 'Close viewers and restore dataframe');
|
|
72
101
|
|
|
102
|
+
// let substViewer: DG.Viewer | null = null;
|
|
103
|
+
// let substNode: DG.DockNode | null = null;
|
|
104
|
+
// let isSA = false;
|
|
105
|
+
// let viewLayout1: DG.ViewLayout | null = null;
|
|
106
|
+
// let viewLayout2: DG.ViewLayout | null = null;
|
|
107
|
+
// const switchViewers = ui.iconFA('toggle-on', () => {
|
|
108
|
+
// if (isSA) {
|
|
109
|
+
// viewLayout2 = view.saveLayout();
|
|
110
|
+
// // view.dockManager.close(substNode!);
|
|
111
|
+
// substViewer?.close();
|
|
112
|
+
|
|
113
|
+
// view.loadLayout(viewLayout1!);
|
|
114
|
+
|
|
115
|
+
// $(switchViewers).removeClass('fa-toggle-off');
|
|
116
|
+
// $(switchViewers).addClass('fa-toggle-on');
|
|
117
|
+
// } else {
|
|
118
|
+
// viewLayout1 = view.saveLayout();
|
|
119
|
+
// // sarDockNodes.forEach((node) => view.dockManager.close(node));
|
|
120
|
+
// sarViewers.forEach((v) => v.close());
|
|
121
|
+
|
|
122
|
+
// if (viewLayout2 === null) {
|
|
123
|
+
// substViewer = view.addViewer(
|
|
124
|
+
// 'substitution-analysis-viewer', {'activityColumnName': options['activityColumnName']},
|
|
125
|
+
// );
|
|
126
|
+
// substNode = view.dockManager.dock(substViewer, DG.DOCK_TYPE.DOWN, null, 'Substitution Analysis');
|
|
127
|
+
// } else {
|
|
128
|
+
// view.loadLayout(viewLayout2);
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// $(switchViewers).removeClass('fa-toggle-on');
|
|
132
|
+
// $(switchViewers).addClass('fa-toggle-off');
|
|
133
|
+
// }
|
|
134
|
+
// isSA = !isSA;
|
|
135
|
+
// });
|
|
136
|
+
|
|
73
137
|
const ribbonPanels = view.getRibbonPanels();
|
|
74
138
|
view.setRibbonPanels([[hideIcon]]);
|
|
75
139
|
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.pep-textarea-box {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pep-textarea-box:hover .pep-snippet-editor-icon {
|
|
6
|
+
visibility: visible;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pep-snippet-editor-icon {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 5px;
|
|
12
|
+
visibility: hidden;
|
|
13
|
+
margin: 5px;
|
|
14
|
+
z-index: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pep-reset-icon {
|
|
18
|
+
right: 10px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.pep-snippet-editor-icon i {
|
|
22
|
+
font-size: 13px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.pep-snippet-editor-icon:hover {
|
|
26
|
+
background-color: var(--steel-1);
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pep-snippet-inline-icon i {
|
|
31
|
+
font-size: 13px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.pep-textinput {
|
|
35
|
+
height: 50px;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|