@datagrok/peptides 0.4.1 → 0.4.2
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/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/peptides",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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": "
|
|
9
|
+
"datagrok-api": ">=0.95.11",
|
|
10
10
|
"dayjs": "latest",
|
|
11
11
|
"jaro-winkler-typescript": "^1.0.1",
|
|
12
12
|
"jstat": "^1.9.5",
|
package/src/describe.ts
CHANGED
|
@@ -404,10 +404,10 @@ export async function describe(
|
|
|
404
404
|
}
|
|
405
405
|
if (
|
|
406
406
|
!cell.isColHeader &&
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
407
|
+
cell.tableColumn !== null &&
|
|
408
|
+
cell.tableColumn.name == aminoAcidResidue &&
|
|
409
|
+
cell.cell.value !== null &&
|
|
410
|
+
cell.tableRowIndex !== null
|
|
411
411
|
) {
|
|
412
412
|
if (grouping) {
|
|
413
413
|
const currentGroup = groupDescription[cell.cell.value];
|
package/src/peptides.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
1
|
import * as ui from 'datagrok-api/ui';
|
|
3
2
|
import * as DG from 'datagrok-api/dg';
|
|
4
3
|
import {createPeptideSimilaritySpaceViewer} from './utils/peptide-similarity-space';
|
|
@@ -6,13 +5,13 @@ import {addViewerToHeader} from './viewers/stacked-barchart-viewer';
|
|
|
6
5
|
|
|
7
6
|
export class Peptides {
|
|
8
7
|
async init(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
tableGrid: DG.Grid,
|
|
9
|
+
view: DG.TableView,
|
|
10
|
+
currentDf: DG.DataFrame,
|
|
11
|
+
options: {[key: string]: string},
|
|
12
|
+
col: DG.Column,
|
|
13
|
+
activityColumnChoice: string,
|
|
14
|
+
) {
|
|
16
15
|
for (let i = 0; i < tableGrid.columns.length; i++) {
|
|
17
16
|
const col = tableGrid.columns.byIndex(i);
|
|
18
17
|
if (col &&
|
|
@@ -30,7 +29,7 @@ export class Peptides {
|
|
|
30
29
|
const sarNode = view.dockManager.dock(sarViewer, DG.DOCK_TYPE.DOWN, null, 'SAR Viewer');
|
|
31
30
|
|
|
32
31
|
const sarViewerVertical = view.addViewer('peptide-sar-viewer-vertical');
|
|
33
|
-
|
|
32
|
+
view.dockManager.dock(sarViewerVertical, DG.DOCK_TYPE.RIGHT, sarNode, 'SAR Vertical Viewer');
|
|
34
33
|
|
|
35
34
|
const peptideSpaceViewer = await createPeptideSimilaritySpaceViewer(
|
|
36
35
|
currentDf,
|
|
@@ -41,34 +40,37 @@ export class Peptides {
|
|
|
41
40
|
view,
|
|
42
41
|
`${activityColumnChoice}Scaled`,
|
|
43
42
|
);
|
|
44
|
-
|
|
43
|
+
view.dockManager.dock(peptideSpaceViewer, DG.DOCK_TYPE.LEFT, sarNode, 'Peptide Space Viewer', 0.3);
|
|
45
44
|
|
|
46
45
|
const StackedBarchartProm = currentDf.plot.fromType('StackedBarChartAA');
|
|
47
46
|
addViewerToHeader(tableGrid, StackedBarchartProm);
|
|
48
47
|
|
|
49
48
|
const hideIcon = ui.iconFA('window-close', () => { //undo?, times?
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
49
|
+
const viewers = [];
|
|
50
|
+
for (const viewer of view.viewers) {
|
|
51
|
+
if (viewer.type !== DG.VIEWER.GRID) {
|
|
52
|
+
viewers.push(viewer);
|
|
55
53
|
}
|
|
56
|
-
|
|
54
|
+
}
|
|
55
|
+
viewers.forEach((v) => v.close());
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
57
|
+
const cols = (currentDf.columns as DG.ColumnList);
|
|
58
|
+
for (const colName of cols.names()) {
|
|
59
|
+
if (!originalDfColumns.includes(colName)) {
|
|
60
|
+
cols.remove(colName);
|
|
63
61
|
}
|
|
62
|
+
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
currentDf.selection.setAll(false);
|
|
65
|
+
currentDf.filter.setAll(true);
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
tableGrid.setOptions({'colHeaderHeight': 20});
|
|
68
|
+
tableGrid.columns.setVisible(originalDfColumns);
|
|
69
|
+
|
|
70
|
+
view.setRibbonPanels(ribbonPanels);
|
|
69
71
|
}, 'Close viewers and restore dataframe');
|
|
70
|
-
|
|
72
|
+
|
|
71
73
|
const ribbonPanels = view.getRibbonPanels();
|
|
72
74
|
view.setRibbonPanels([[hideIcon]]);
|
|
73
75
|
}
|
|
74
|
-
}
|
|
76
|
+
}
|
|
@@ -23,7 +23,12 @@ export class ChemPalette {
|
|
|
23
23
|
if (s in ChemPalette.AAFullNames) {
|
|
24
24
|
toDisplay = [ui.divText(ChemPalette.AANames[ChemPalette.AAFullNames[s]])];
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const options = {
|
|
27
|
+
autoCrop: true,
|
|
28
|
+
autoCropMargin: 0,
|
|
29
|
+
suppressChiralText: true,
|
|
30
|
+
};
|
|
31
|
+
const sketch = grok.chem.svgMol(ChemPalette.AASmiles[aar], undefined, undefined, options);
|
|
27
32
|
toDisplay.push(sketch);
|
|
28
33
|
}
|
|
29
34
|
ui.tooltip.show(ui.divV(toDisplay), x, y);
|
|
@@ -15,8 +15,8 @@ import {kendallsTau} from '@datagrok-libraries/statistics/src/correlation-coeffi
|
|
|
15
15
|
* @param {Matrix} matrix A matrix.
|
|
16
16
|
* @return {DG.DataFrame} The data frame.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
return DG.DataFrame.fromColumns(matrix.map((v, i) => DG.Column.fromFloat32Array(`${i+1}`, v)));
|
|
18
|
+
export function matrix2DataFrame(matrix: Matrix): DG.DataFrame {
|
|
19
|
+
return DG.DataFrame.fromColumns(matrix.map((v, i) => DG.Column.fromFloat32Array(`${i+1}`, v)));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -10,15 +10,6 @@ import {DimensionalityReducer} from '@datagrok-libraries/utils/src/reduce-dimens
|
|
|
10
10
|
import {Measurer} from '@datagrok-libraries/utils/src/string-measure';
|
|
11
11
|
import {Coordinates} from '@datagrok-libraries/utils/src/type-declarations';
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Creates a worker to perform a dimensionality reduction.
|
|
15
|
-
*
|
|
16
|
-
* @param {any[]} columnData Samples to process.
|
|
17
|
-
* @param {string} method Embedding method.
|
|
18
|
-
* @param {string} measure Distance metric.
|
|
19
|
-
* @param {number} cyclesCount Number of cycles to repeat.
|
|
20
|
-
* @return {Promise<unknown>} Promise.
|
|
21
|
-
*/
|
|
22
13
|
function createDimensinalityReducingWorker(
|
|
23
14
|
columnData: any[],
|
|
24
15
|
method: string,
|
|
@@ -65,6 +56,7 @@ function inferActivityColumnsName(table: DG.DataFrame): string | null {
|
|
|
65
56
|
* @param {string} method Embedding method to apply.
|
|
66
57
|
* @param {string} measure Distance metric.
|
|
67
58
|
* @param {number} cyclesCount Number of cycles to repeat.
|
|
59
|
+
* @param {(DG.TableView | null)} view View to add scatter plot to
|
|
68
60
|
* @param {(string | null)} [activityColumnName] Activity containing column to assign it to points radius.
|
|
69
61
|
* @param {boolean} [zoom=false] Whether to fit view.
|
|
70
62
|
* @return {Promise<DG.ScatterPlotViewer>} A viewer.
|
|
@@ -156,6 +148,7 @@ export class PeptideSimilaritySpaceWidget {
|
|
|
156
148
|
/**
|
|
157
149
|
* Creates an instance of PeptideSimilaritySpaceWidget.
|
|
158
150
|
* @param {DG.Column} alignedSequencesColumn The column to get amino acid sequences from.
|
|
151
|
+
* @param {DG.TableView} view Current view
|
|
159
152
|
* @memberof PeptideSimilaritySpaceWidget
|
|
160
153
|
*/
|
|
161
154
|
constructor(alignedSequencesColumn: DG.Column, view: DG.TableView) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as grok from 'datagrok-api/grok';
|
|
2
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
3
|
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
import {
|
|
4
|
+
import {Peptides} from '../peptides';
|
|
5
5
|
|
|
6
6
|
export async function analyzePeptidesWidget(
|
|
7
7
|
col: DG.Column, view: DG.TableView, tableGrid: DG.Grid, currentDf: DG.DataFrame,
|
|
@@ -70,8 +70,8 @@ export async function analyzePeptidesWidget(
|
|
|
70
70
|
'activityScalingMethod': activityScalingMethod.value,
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
await peptides.init(tableGrid, view, currentDf, options, col, activityColumnChoice.value.name);
|
|
73
|
+
const peptides = new Peptides();
|
|
74
|
+
await peptides.init(tableGrid, view, currentDf, options, col, activityColumnChoice.value.name);
|
|
75
75
|
|
|
76
76
|
progress.close();
|
|
77
77
|
} else {
|