@datagrok/peptides 0.4.2 → 0.4.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagrok/peptides",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@keckelt/tsne": "^1.0.2",
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';
@@ -240,11 +238,9 @@ export async function describe(
240
238
  aarList.sort((first, second) => getWeight(second) - getWeight(first));
241
239
 
242
240
  matrixDf.getCol(aminoAcidResidue).setCategoryOrder(aarList);
243
- //const sequenceDf = segregateBestAtAllCateg(statsDf, twoColorMode);
244
241
 
245
242
  // SAR vertical table (naive, choose best Mean difference from pVals <= 0.01)
246
243
  // TODO: aquire ALL of the positions
247
-
248
244
  let sequenceDf = statsDf.groupBy(['Mean difference', aminoAcidResidue, positionColName, 'Count', 'Ratio', 'pValue'])
249
245
  .where('pValue <= 0.1')
250
246
  .aggregate();
@@ -298,19 +294,6 @@ export async function describe(
298
294
  return;
299
295
  }
300
296
 
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
297
  if (
315
298
  args.cell.isTableCell &&
316
299
  args.cell.tableRowIndex !== null &&
package/src/package.ts CHANGED
@@ -25,35 +25,13 @@ let view: DG.TableView;
25
25
 
26
26
  async function main(chosenFile: string) {
27
27
  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
28
  const path = _package.webRoot + 'files/' + chosenFile;
31
29
  const peptides = (await grok.data.loadTable(path));
32
30
  peptides.name = 'Peptides';
33
31
  peptides.setTag('dataType', 'peptides');
34
32
  const view = grok.shell.addTableView(peptides);
35
33
  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
34
  view.name = 'PeptidesView';
56
-
57
35
  grok.shell.windows.showProperties = true;
58
36
 
59
37
  pi.close();
@@ -67,7 +45,6 @@ export function Peptides() {
67
45
 
68
46
  const appDescription = ui.info(
69
47
  [
70
- // ui.divText('\n To start the application :', {style: {'font-weight': 'bolder'}}),
71
48
  ui.list([
72
49
  '- automatic recognition of peptide sequences',
73
50
  '- native integration with tons of Datagrok out-of-the box features (visualization, filtering, clustering, ' +
@@ -107,14 +107,6 @@ export class ChemPalette {
107
107
  'white': ['rgb(230,230,230)'],
108
108
  }
109
109
 
110
- // static grokGroups: [string[], string][] = [
111
- // [['C', 'U'], 'yellow'],
112
- // [['G', 'P'], 'red'],
113
- // [['A', 'V', 'I', 'L', 'M', 'F', 'Y', 'W'], 'all_green'],
114
- // [['R', 'H', 'K'], 'light_blue'],
115
- // [['D', 'E'], 'dark_blue'],
116
- // [['S', 'T', 'N', 'Q'], 'orange'],
117
- // ];
118
110
  static grokGroups: {[key: string]: string[]} = {
119
111
  'yellow': ['C', 'U'],
120
112
  'red': ['G', 'P'],
@@ -1,6 +1,4 @@
1
1
  /* Do not change these import lines. Datagrok will import API library in exactly the same manner */
2
- //import * as grok from 'datagrok-api/grok';
3
- //import * as ui from 'datagrok-api/ui';
4
2
  import * as DG from 'datagrok-api/dg';
5
3
 
6
4
  import {AlignedSequenceEncoder} from '@datagrok-libraries/utils/src/sequence-encoder';
@@ -59,7 +57,6 @@ function melt(df: DG.DataFrame): DG.DataFrame {
59
57
  * @param {DG.DataFrame} df A data frame to process.
60
58
  * @return {DG.DataFrame} The correlation matrix.
61
59
  */
62
- // eslint-disable-next-line no-unused-vars
63
60
  function calcSpearmanRhoMatrix(df: DG.DataFrame): DG.DataFrame {
64
61
  const nItems = df.columns.length;
65
62
  const rho = new Array(nItems).fill(0).map((_) => new Float32Array(nItems).fill(0));
@@ -1,6 +1,4 @@
1
1
  /* Do not change these import lines. Datagrok will import API library in exactly the same manner */
2
- // eslint-disable-next-line no-unused-vars
3
- import * as grok from 'datagrok-api/grok';
4
2
  import * as ui from 'datagrok-api/ui';
5
3
  import * as DG from 'datagrok-api/dg';
6
4
 
@@ -45,7 +45,6 @@ export function splitAlignedPeptides(peptideColumn: DG.Column, filter: boolean =
45
45
  columnNames.push('C-terminal');
46
46
 
47
47
  // filter out the columns with the same values
48
-
49
48
  if (filter) {
50
49
  splitColumns = splitColumns.filter((positionArray, index) => {
51
50
  const isRetained = new Set(positionArray).size > 1;
@@ -61,7 +61,6 @@ export class Logo extends DG.JsViewer {
61
61
 
62
62
  init() {
63
63
  this.initialized = true;
64
- // this.reactHost = ui.div([]);
65
64
  console.log('INIT');
66
65
  this.target = this.dataFrame;
67
66
  [this.splitted] = splitAlignedPeptides(this.dataFrame!.columns.bySemType(this.colSemType));
@@ -111,10 +110,6 @@ export class Logo extends DG.JsViewer {
111
110
 
112
111
  if (typeof this.dataFrame !== 'undefined') {
113
112
  this.findLogo();
114
-
115
- // if (this.reactHost !== null) {
116
- // this.root.appendChild(this.reactHost);
117
- // }
118
113
  }
119
114
  }
120
115
 
@@ -22,7 +22,6 @@ export class SARViewer extends DG.JsViewer {
22
22
  protected currentBitset: DG.BitSet | null;
23
23
  grouping: boolean;
24
24
  groupMapping: {[key: string]: string} | null;
25
- // private df: DG.DataFrame | null;
26
25
  // protected pValueThreshold: number;
27
26
  // protected amountOfBestAARs: number;
28
27
  // duplicatesHandingMethod: string;
@@ -123,21 +122,9 @@ export class SARViewer extends DG.JsViewer {
123
122
  splitCol!.init((i) => isChosen(i) ? aarLabel : otherLabel);
124
123
 
125
124
  //TODO: use column.compact
126
-
127
- // if (this.filterMode) {
128
- // this.dataFrame.selection.setAll(false, false);
129
- // this.dataFrame.filter.init(isChosen).and(this._initialBitset!, false);
130
- // } else {
131
- // this.dataFrame.filter.copyFrom(this._initialBitset!);
132
- // this.dataFrame.selection.init(isChosen).and(this._initialBitset!, false);
133
- // }
134
125
  this.currentBitset = DG.BitSet.create(this.dataFrame.rowCount, isChosen).and(this._initialBitset!);
135
- // (this.filterMode ? this.dataFrame.selection.setAll(false) :
136
- // this.dataFrame.filter.copyFrom(this._initialBitset!)).fireChanged();
137
126
  this.sourceFilteringFunc();
138
127
 
139
-
140
- // df.getCol(splitColName).setCategoryOrder([otherLabel, aarLabel]);
141
128
  const colorMap: {[index: string]: string | number} = {};
142
129
  colorMap[otherLabel] = DG.Color.blue;
143
130
  colorMap[aarLabel] = DG.Color.orange;
@@ -267,14 +254,6 @@ export class SARViewer extends DG.JsViewer {
267
254
  //TODO: optimize. Don't calculate everything again if only view changes
268
255
  if (computeData) {
269
256
  if (typeof this.dataFrame !== 'undefined' && this.activityColumnColumnName && this.sourceGrid) {
270
- // [this.viewerGrid, this.viewerVGrid, this.statsDf] = await describe(
271
- // this.dataFrame,
272
- // this.activityColumnColumnName,
273
- // this.activityScalingMethod,
274
- // this.sourceGrid,
275
- // this.bidirectionalAnalysis,
276
- // this._initialBitset,
277
- // );
278
257
  await model?.updateData(
279
258
  this.dataFrame!,
280
259
  this.activityColumnColumnName,
@@ -287,8 +287,7 @@ export class StackedBarChart extends DG.JsViewer {
287
287
  if (h * margin / 2 <= sBarHeight - gapSize && h * margin / 2 <= w) {
288
288
  g.fillStyle = 'rgb(0,0,0)';
289
289
  g.font = `${h * margin / 2}px`;
290
- // eslint-disable-next-line no-unused-vars
291
- const [_c, aar, _p] = cp.getColorAAPivot(obj['name']);
290
+ const [, aar] = cp.getColorAAPivot(obj['name']);
292
291
  g.fillText(aar,
293
292
  x + w / 2 - h * margin / 8,
294
293
  y + h * (this.max - sum + curSum) / this.max + gapSize / 2 + (sBarHeight - gapSize)/2 - h * margin / 8);
@@ -398,11 +397,8 @@ export class StackedBarChart extends DG.JsViewer {
398
397
  return;
399
398
  }
400
399
  this.dataFrame!.selection.handleClick((i) => {
401
- //let selected = true;
402
400
  // @ts-ignore
403
401
  return this.highlighted!['aaName'] === (this.dataFrame.getCol(this.highlighted!['colName']).get(i));
404
-
405
- //&& (scope.dataFrame.selection.get(i) === selected);
406
402
  }, event);
407
403
  }
408
404
  }