@datagrok/bio 2.11.34 → 2.11.36

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.
@@ -5,165 +5,245 @@ import * as DG from 'datagrok-api/dg';
5
5
  import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
6
6
  import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
7
7
  import {_package} from '../../package';
8
- import {addCommonTags} from './utils';
9
- import {HELM_WRAPPER, ALL_MONOMERS, CYCLIZATION_TYPE} from './const';
10
- import {MetaData, ConnectionData} from './types';
8
+ import {HELM_WRAPPER} from './const';
11
9
  import {getMolColumnFromHelm} from '../helm-to-molfile';
10
+ import {ALIGNMENT, ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';
12
11
 
13
- abstract class TransformationBase {
14
- constructor(helmColumn: DG.Column<string>, meta: MetaData) {
15
- this.helmColumn = helmColumn;
16
- this.leftTerminal = meta.leftTerminal;
17
- this.rightTerminal = meta.rightTerminal;
18
- }
19
-
20
- protected helmColumn: DG.Column<string>;
21
- protected leftTerminal?: string;
22
- protected rightTerminal?: string;
12
+ const RULE_PATH = 'System:AppData/Bio/polytool-rules/';
23
13
 
24
- protected abstract hasTerminals(helm: string): boolean;
25
- protected abstract getTransformedHelm(helm: string): string;
26
- protected abstract getLinkedPositions(helm: string): [number, number];
27
-
28
- transform(): string[] {
29
- const resultList = this.helmColumn.toList().map((helm: string) => {
30
- if (this.hasTerminals(helm))
31
- return this.getTransformedHelm(helm);
32
- return helm;
33
- });
34
- return resultList;
35
- }
14
+ type ConnectionData = {
15
+ allPos1: number[],
16
+ allPos2: number[],
17
+ allAttaches1: number[],
18
+ allAttaches2: number[],
36
19
  }
37
20
 
38
- class TransformationNCys extends TransformationBase {
39
- constructor(helmColumn: DG.Column<string>, meta: MetaData) {
40
- super(helmColumn, meta);
41
- }
42
-
43
- protected hasTerminals(helm: string): boolean {
44
- // if (! helm.includes(this.rightTerminal + HELM_WRAPPER.RIGHT))
45
- // return false;
46
- // if (this.leftTerminal === ALL_MONOMERS)
47
- // return true;
48
- // return helm.includes(HELM_WRAPPER.LEFT + this.leftTerminal);
49
- const positions = this.getLinkedPositions(helm);
50
- return positions.every((el) => el > 0);
51
- }
52
-
53
- protected getLinkedPositions(helm: string): [number, number] {
54
- const seq = helm.replace(HELM_WRAPPER.LEFT, '').replace(HELM_WRAPPER.RIGHT, '');
55
- const monomers = seq.split('.');
56
- const start = 0;
57
- const end = monomers.findIndex((el, idx) => el === this.rightTerminal && idx > start);
58
- return [start + 1, end + 1];
59
- }
60
-
61
- protected getTransformedHelm(helm: string): string {
62
- const positions = this.getLinkedPositions(helm);
63
- const source = {monomerPosition: positions[0], attachmentPoint: 1};
64
- const target = {monomerPosition: positions[1], attachmentPoint: 3};
65
- return getHelmCycle(helm, source, target);
66
- }
21
+ type Rule = {
22
+ code: number,
23
+ firstMonomer: string,
24
+ secondMonomer: string,
25
+ firstModification: string,
26
+ secondModification: string,
27
+ firstR: number,
28
+ secondR: number
67
29
  }
68
30
 
69
- class TransformationNO extends TransformationBase {
70
- constructor(helmColumn: DG.Column<string>, meta: MetaData) {
71
- super(helmColumn, meta);
72
- }
73
-
74
- protected hasTerminals(helm: string): boolean {
75
- if (this.leftTerminal === ALL_MONOMERS || this.rightTerminal === ALL_MONOMERS)
76
- return true;
77
- return helm.includes(HELM_WRAPPER.LEFT + this.leftTerminal) &&
78
- helm.includes(this.rightTerminal + HELM_WRAPPER.RIGHT);
79
- }
80
-
81
- protected getLinkedPositions(helm: string): [number, number] {
82
- return [1, getNumberOfMonomers(helm)];
83
- }
84
-
85
- protected getTransformedHelm(helm: string): string {
86
- const positions = this.getLinkedPositions(helm);
87
- const source = {monomerPosition: positions[0], attachmentPoint: 1};
88
- const target = {monomerPosition: positions[1], attachmentPoint: 2};
89
- return getHelmCycle(helm, source, target);
90
- }
31
+ function addCommonTags(col: DG.Column):void {
32
+ col.setTag('quality', DG.SEMTYPE.MACROMOLECULE);
33
+ col.setTag('aligned', ALIGNMENT.SEQ);
34
+ col.setTag('alphabet', ALPHABET.PT);
91
35
  }
92
36
 
93
- class TransformationR3 extends TransformationBase {
94
- constructor(helmColumn: DG.Column<string>, meta: MetaData) {
95
- super(helmColumn, meta);
37
+ class TransformationCommon {
38
+ helmColumn: DG.Column;
39
+
40
+ constructor(helmColumn: DG.Column<string>) {
41
+ this.helmColumn = helmColumn;
96
42
  }
97
43
 
98
44
  protected hasTerminals(helm: string): boolean {
99
- if (this.leftTerminal === ALL_MONOMERS || this.rightTerminal === ALL_MONOMERS)
100
- return true;
101
- const positions = this.getLinkedPositions(helm);
102
- return positions.every((el) => el > 0);
45
+ let isLinkable = false;
46
+ if (helm.includes('(1)'))
47
+ isLinkable = true;
48
+ if (helm.includes('(2)'))
49
+ isLinkable = true;
50
+
51
+ return isLinkable;
103
52
  }
104
53
 
105
- protected getLinkedPositions(helm: string): [number, number] {
54
+ protected getLinkedPositions(helm: string, rules: Rule[]): [number, number][] {
106
55
  const seq = helm.replace(HELM_WRAPPER.LEFT, '').replace(HELM_WRAPPER.RIGHT, '');
107
- const monomers = seq.split('.');
108
- const start = monomers.findIndex((el) => el === this.leftTerminal);
109
- const end = monomers.findIndex((el, idx) => el === this.rightTerminal && idx > start);
110
- return [start + 1, end + 1];
111
- }
56
+ const monomers = seq.split('.').map((m) => { return m.replace('[', '').replace(']', ''); });
57
+ const result:[number, number][] = new Array<[number, number]>(rules.length);
58
+
59
+ for (let i = 0; i < rules.length; i++) {
60
+ let firstFound = false;
61
+ let secondFound = false;
62
+ let firstIsFirst = false;
63
+ let firstEntryIndex = -1;
64
+ let secondEntryIndex = -1;
65
+ const add = `(${rules[i].code})`;
66
+ for (let j = 0; j < monomers.length; j++) {
67
+ if (monomers[j].includes(add)) {
68
+ if (firstFound) {
69
+ if (firstIsFirst && monomers[j] == rules[i].secondMonomer + add) {
70
+ secondFound = true;
71
+ secondEntryIndex = j;
72
+ break;
73
+ } else if (!firstIsFirst && monomers[j] == rules[i].firstMonomer + add) {
74
+ secondFound = true;
75
+ secondEntryIndex = j;
76
+ break;
77
+ } else {
78
+ continue;
79
+ }
80
+ //result[i][1] = j;
81
+ // secondFound = true;
82
+ // break;
83
+ } else {
84
+ if (monomers[j] == rules[i].firstMonomer + add) {
85
+ firstFound = true;
86
+ firstIsFirst = true;
87
+ firstEntryIndex = j;
88
+ } else if (monomers[j] == rules[i].secondMonomer + add) {
89
+ firstFound = true;
90
+ firstIsFirst = false;
91
+ firstEntryIndex = j;
92
+ } else {
93
+ continue;
94
+ }
95
+ //result[i] = [j, 0];
96
+ }
97
+ }
98
+ }
99
+
100
+ if (!(firstFound && secondFound))
101
+ result[i] = [-1, -1];
102
+ else if (firstIsFirst)
103
+ result[i] = [firstEntryIndex, secondEntryIndex];
104
+ else
105
+ result[i] = [secondEntryIndex, firstEntryIndex];
106
+ }
107
+
108
+
109
+ return result;
110
+ }
111
+
112
+ protected getRules(rulesTable: DG.DataFrame): Rule[] {
113
+ const ruleCount = rulesTable.rowCount;
114
+ const rules: Rule[] = new Array<Rule>(ruleCount);
115
+ const codeCol = rulesTable.columns.byName('code');
116
+ const monomer1Col = rulesTable.columns.byName('monomer1');
117
+ const monomer2Col = rulesTable.columns.byName('monomer2');
118
+ const modification1Col = rulesTable.columns.byName('modification1');
119
+ const modification2Col = rulesTable.columns.byName('modification2');
120
+ const r1Col = rulesTable.columns.byName('R1');
121
+ const r2Col = rulesTable.columns.byName('R2');
122
+
123
+ for (let i = 0; i < ruleCount; i++) {
124
+ rules[i] = {
125
+ code: codeCol.get(i),
126
+ firstMonomer: monomer1Col.get(i),
127
+ secondMonomer: monomer2Col.get(i),
128
+ firstModification: modification1Col.get(i),
129
+ secondModification: modification2Col.get(i),
130
+ firstR: r1Col.get(i),
131
+ secondR: r2Col.get(i),
132
+ };
133
+ }
134
+
135
+ return rules;
136
+ }
137
+
138
+ protected getTransformedHelm(helm: string, rules: Rule[]): string {
139
+ const ruleCount = rules.length;
140
+ const positions = this.getLinkedPositions(helm, rules);
141
+
142
+ const allPos1: number [] = [];
143
+ const allPos2: number [] = [];
144
+ const allAttaches1: number [] = [];
145
+ const allAttaches2: number [] = [];
146
+
147
+ for (let i = 0; i < ruleCount; i++) {
148
+ if (positions[i][0] == -1)
149
+ continue;
150
+
151
+ //helm = helm.replaceAll(`(${i + 1})`, '');
152
+ const seq = helm.replace(HELM_WRAPPER.LEFT, '').replace(HELM_WRAPPER.RIGHT, '');
153
+ const monomers = seq.split('.');
154
+ const firstMonomer = monomers[positions[i][0]].replace('[', '').replace(']', '');
155
+ const secondMonomer = monomers[positions[i][1]].replace('[', '').replace(']', '');
156
+
157
+ monomers[positions[i][0]] = monomers[positions[i][0]].replace(firstMonomer, rules[i].firstModification);
158
+ monomers[positions[i][1]] = monomers[positions[i][1]].replace(secondMonomer, rules[i].secondModification);
159
+
160
+ allPos1.push(positions[i][0] + 1);
161
+ allPos2.push(positions[i][1] + 1);
162
+ allAttaches1.push(rules[i].firstR);
163
+ allAttaches2.push(rules[i].secondR);
164
+
165
+ helm = HELM_WRAPPER.LEFT;
166
+ for (let i = 0; i < monomers.length; i ++) {
167
+ if (i != monomers.length - 1)
168
+ helm = helm + monomers[i] + '.';
169
+ else
170
+ helm = helm + monomers[i];
171
+ }
172
+ helm = helm + HELM_WRAPPER.RIGHT;
173
+ }
174
+
175
+
176
+ const cycledHelm = getHelmCycle(helm, {allPos1, allPos2, allAttaches1, allAttaches2});
177
+
178
+ return cycledHelm;
179
+ }
180
+
181
+ transform(rulesTable: DG.DataFrame): string[] {
182
+ const rules = this.getRules(rulesTable);
183
+ const resultList = this.helmColumn.toList().map((helm: string) => {
184
+ if (this.hasTerminals(helm))
185
+ return this.getTransformedHelm(helm, rules);
112
186
 
113
- protected getTransformedHelm(helm: string): string {
114
- const positions = this.getLinkedPositions(helm);
115
- const source = {monomerPosition: positions[0], attachmentPoint: 3};
116
- const target = {monomerPosition: positions[1], attachmentPoint: 3};
117
- return getHelmCycle(helm, source, target);
187
+ console.log(helm);
188
+ return helm;
189
+ });
190
+ return resultList;
118
191
  }
119
192
  }
120
193
 
121
194
  class PolymerTransformation {
122
195
  private constructor() {}
123
196
 
124
- static getInstance(molColumn: DG.Column<string>, meta: MetaData): TransformationBase {
125
- const cyclizationType = meta.cyclizationType;
126
- return (cyclizationType === CYCLIZATION_TYPE.R3) ? new TransformationR3(molColumn, meta) :
127
- (cyclizationType === CYCLIZATION_TYPE.NCys) ? new TransformationNCys(molColumn, meta) :
128
- new TransformationNO(molColumn, meta);
197
+ static getInstance(molColumn: DG.Column<string>) {
198
+ return new TransformationCommon(molColumn);
129
199
  }
130
200
  }
131
201
 
132
- function getNumberOfMonomers(helm: string): number {
133
- const seq = helm.replace(HELM_WRAPPER.LEFT, '').replace(HELM_WRAPPER.RIGHT, '');
134
- return seq.split('.').length;
135
- }
136
-
137
- function getHelmCycle(helm: string, source: ConnectionData, target: ConnectionData): string {
138
- return helm.replace(HELM_WRAPPER.RIGHT,
139
- `}$PEPTIDE1,PEPTIDE1,${
140
- source.monomerPosition
141
- }:R${
142
- source.attachmentPoint
143
- }-${
144
- target.monomerPosition
145
- }:R${
146
- target.attachmentPoint
147
- }${'$'.repeat(6)}`
148
- );
202
+ function getHelmCycle(helm: string, source: ConnectionData): string {
203
+ let cycled = helm.replace(HELM_WRAPPER.RIGHT, '}$');
204
+
205
+ for (let i = 0; i < source.allPos1.length; i++) {
206
+ if (i == 0)
207
+ cycled += 'PEPTIDE1,PEPTIDE1,';
208
+ else
209
+ cycled += '|PEPTIDE1,PEPTIDE1,';
210
+ cycled += `${source.allPos1[i]}:R${source.allAttaches1[i]}-${source.allPos2[i]}:R${source.allAttaches2[i]}`;
211
+ }
212
+
213
+ cycled += '$$$';
214
+ return cycled;
215
+ // return helm.replace(HELM_WRAPPER.RIGHT,
216
+ // `}$PEPTIDE1,PEPTIDE1,${
217
+ // source.monomerPosition
218
+ // }:R${
219
+ // source.attachmentPoint
220
+ // }-${
221
+ // target.monomerPosition
222
+ // }:R${
223
+ // target.attachmentPoint
224
+ // }${'$'.repeat(6)}`
225
+ // );
149
226
  }
150
227
 
151
228
  export async function addTransformedColumn(
152
- molColumn: DG.Column<string>, meta: MetaData, addHelm: boolean
229
+ molColumn: DG.Column<string>, addHelm: boolean
153
230
  ): Promise<void> {
154
231
  const df = molColumn.dataFrame;
155
232
  const uh = UnitsHandler.getOrCreate(molColumn);
156
233
  const sourceHelmCol = uh.convert(NOTATION.HELM);
157
- const pt = PolymerTransformation.getInstance(sourceHelmCol, meta);
158
- const targetList = pt.transform();
159
- const helmColName = df.columns.getUnusedName(`${meta.transformationType}(` + molColumn.name + ')');
234
+ const pt = PolymerTransformation.getInstance(sourceHelmCol);
235
+ const fileSource = new DG.FileSource(RULE_PATH);
236
+ const rulesRaw = await fileSource.readAsText('rules.csv');
237
+ const rulesTable = DG.DataFrame.fromCsv(rulesRaw);
238
+ const targetList = pt.transform(rulesTable);
239
+ const helmColName = df.columns.getUnusedName('transformed(' + molColumn.name + ')');
160
240
  const targetHelmCol = DG.Column.fromList('string', helmColName, targetList);
161
241
 
162
242
  addCommonTags(targetHelmCol);
163
243
  targetHelmCol.setTag('units', NOTATION.HELM);
164
244
 
165
245
  const molCol = await getMolColumnFromHelm(df, targetHelmCol);
166
- molCol.name = df.columns.getUnusedName(`${meta.transformationType}_molfile(` + molColumn.name + ')');
246
+ molCol.name = df.columns.getUnusedName('molfile(' + molColumn.name + ')');
167
247
 
168
248
  if (addHelm) {
169
249
  targetHelmCol.setTag('cell.renderer', 'helm');
@@ -8,90 +8,15 @@ import {MonomerLibManager} from '../monomer-lib/lib-manager';
8
8
  import {ALL_MONOMERS, CYCLIZATION_TYPE, TRANSFORMATION_TYPE} from './const';
9
9
  import {addTransformedColumn} from './transformation';
10
10
  import * as rxjs from 'rxjs';
11
- import {MetaData} from './types';
11
+ //import {MetaData} from './types';
12
12
 
13
- export function getPolyToolDialog(): DG.Dialog {
14
- function getMonomerList(cyclizationType: CYCLIZATION_TYPE): string[] {
15
- if (cyclizationType === cyclizationTypes[0]) {
16
- return [ALL_MONOMERS].concat(
17
- monomerLib.getMonomerSymbolsByType(HELM_POLYMER_TYPE.PEPTIDE)
18
- );
19
- }
20
- if (cyclizationType === cyclizationTypes[1]) {
21
- return [ALL_MONOMERS].concat(
22
- monomerLib.getMonomerSymbolsByRGroup(3, HELM_POLYMER_TYPE.PEPTIDE)
23
- );
24
- }
25
- return ['C'];
26
- }
27
-
28
- function updateMonomerList(): void {
29
- if (cyclizationTypeChoice.value === CYCLIZATION_TYPE.NCys) {
30
- monomerList1 = getMonomerList(CYCLIZATION_TYPE.NO);
31
- monomerList2 = getMonomerList(CYCLIZATION_TYPE.NCys);
32
- } else {
33
- monomerList1 = getMonomerList(cyclizationTypeChoice.value as CYCLIZATION_TYPE);
34
- monomerList2 = [...monomerList1];
35
- }
36
-
37
- leftTerminalChoice = ui.choiceInput(
38
- 'R1:', monomerList1[0], monomerList1, () => { onRGroupValueChange.next(); }
39
- );
40
- rightTerminalChoice = ui.choiceInput('R2:', monomerList2[0], monomerList2, () => { onRGroupValueChange.next(); });
41
- onRGroupValueChange.next();
42
- ui.empty(terminalControls);
43
- [leftTerminalChoice, rightTerminalChoice].forEach((el) => { terminalControls.appendChild(el.root); });
44
- }
45
-
46
- function updateMeta() {
47
- meta.cyclizationType = cyclizationTypeChoice.value!;
48
- meta.leftTerminal = leftTerminalChoice.value!;
49
- meta.rightTerminal = rightTerminalChoice.value!;
50
- meta.transformationType = transformationChoice.value!;
51
- }
52
-
53
-
54
- const onCyclizationChoice = new rxjs.Subject<string>();
55
- const onRGroupValueChange = new rxjs.Subject<string>();
56
- onCyclizationChoice.subscribe(() => {
57
- meta.cyclizationType = cyclizationTypeChoice.value!;
58
- updateMonomerList();
59
- });
60
- onRGroupValueChange.subscribe(() => {
61
- meta.rightTerminal = rightTerminalChoice.value!;
62
- meta.leftTerminal = leftTerminalChoice.value!;
63
- });
64
-
65
- const meta = {} as MetaData;
66
- const transformations = [TRANSFORMATION_TYPE.CYCLIZATION];
67
- const transformationChoice = ui.choiceInput(
68
- 'Modification', transformations[0], transformations, () => meta.transformationType = transformationChoice.value!
69
- );
70
-
71
- const cyclizationTypes = [CYCLIZATION_TYPE.NO, CYCLIZATION_TYPE.R3, CYCLIZATION_TYPE.NCys];
72
- const cyclizationTypeChoice = ui.choiceInput(
73
- 'Type', cyclizationTypes[2], cyclizationTypes, () => { onCyclizationChoice.next(); }
74
- );
75
-
76
- const monomerLib = MonomerLibManager.instance.getBioLib();
77
- let monomerList1: string[] = [];
78
- let monomerList2: string[] = [];
79
- let leftTerminalChoice = ui.choiceInput(
80
- 'R1:', monomerList1[0], monomerList1, () => {
81
- meta.leftTerminal = leftTerminalChoice.value!;
82
- }
83
- );
84
- let rightTerminalChoice = ui.choiceInput('R2:', monomerList2[0], monomerList2, () => {
85
- meta.rightTerminal = rightTerminalChoice.value!;
86
- });
87
- const terminalControls = ui.divV([leftTerminalChoice.root, rightTerminalChoice.root]);
88
- updateMonomerList();
89
-
90
- updateMeta();
13
+ const RULE_PATH = 'System:AppData/Bio/polytool-rules/';
91
14
 
15
+ export function getPolyToolDialog(): DG.Dialog {
16
+ //const monomerLib = MonomerLibManager.instance.getBioLib();
92
17
  const targetColumns = grok.shell.t.columns.bySemTypeAll(DG.SEMTYPE.MACROMOLECULE);
93
18
  if (!targetColumns)
94
- throw new Error('No dataframe with maceomolecule columns open');
19
+ throw new Error('No dataframe with macromolecule columns open');
95
20
 
96
21
  const targetColumnInput = ui.columnInput(
97
22
  'Column', grok.shell.t, targetColumns[0], null,
@@ -101,12 +26,24 @@ export function getPolyToolDialog(): DG.Dialog {
101
26
  const generateHelmChoiceInput = ui.boolInput('Get HELM', true);
102
27
  ui.tooltip.bind(generateHelmChoiceInput.root, 'Add HELM column');
103
28
 
29
+ // let rulesTable: DG.DataFrame = DG.DataFrame.create();
30
+
31
+ const ruleFileInput = ui.button('ADD RULES', () => {
32
+ DG.Utils.openFile({
33
+ accept: '.csv',
34
+ open: async (selectedFile) => {
35
+ const content = await selectedFile.text();
36
+ // rulesTable = DG.DataFrame.fromCsv(content);
37
+ await grok.dapi.files.writeAsText(RULE_PATH + `${selectedFile.name}`, content);
38
+ //console.log(df.toCsv());
39
+ },
40
+ });
41
+ });
42
+
104
43
  const div = ui.div([
105
44
  targetColumnInput,
106
- transformationChoice,
107
- cyclizationTypeChoice,
108
- terminalControls,
109
45
  generateHelmChoiceInput,
46
+ ruleFileInput
110
47
  ]);
111
48
 
112
49
  const dialog = ui.dialog('Poly Tool')
@@ -117,7 +54,7 @@ export function getPolyToolDialog(): DG.Dialog {
117
54
  grok.shell.warning('No marcomolecule column chosen!');
118
55
  return;
119
56
  }
120
- addTransformedColumn(molCol!, meta, generateHelmChoiceInput.value!);
57
+ addTransformedColumn(molCol!, generateHelmChoiceInput.value!);
121
58
  }
122
59
  );
123
60
 
@@ -3,13 +3,7 @@ import * as grok from 'datagrok-api/grok';
3
3
  import * as ui from 'datagrok-api/ui';
4
4
  import * as DG from 'datagrok-api/dg';
5
5
 
6
- import {NOTATION, ALIGNMENT, ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';
7
-
8
- export function addCommonTags(col: DG.Column):void {
9
- col.setTag('quality', DG.SEMTYPE.MACROMOLECULE);
10
- col.setTag('aligned', ALIGNMENT.SEQ);
11
- col.setTag('alphabet', ALPHABET.PT);
12
- }
6
+ import {ALPHABET, ALIGNMENT, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
13
7
 
14
8
  export function _setPeptideColumn(col: DG.Column): void {
15
9
  addCommonTags(col);
@@ -18,3 +12,9 @@ export function _setPeptideColumn(col: DG.Column): void {
18
12
  // col.setTag('cell.renderer', 'sequence');
19
13
  }
20
14
 
15
+ function addCommonTags(col: DG.Column<any>) {
16
+ col.setTag('quality', DG.SEMTYPE.MACROMOLECULE);
17
+ col.setTag('aligned', ALIGNMENT.SEQ);
18
+ col.setTag('alphabet', ALPHABET.PT);
19
+ }
20
+
@@ -87,7 +87,7 @@ export class HelmBioFilter extends BioFilterBase<BioFilterProps> /* implements I
87
87
  // webEditor = undefined;
88
88
  // });
89
89
  }));
90
- this.viewSubs.push(ui.onSizeChanged(this._filterPanel).subscribe((_) => {
90
+ this.viewSubs.push(ui.onSizeChanged(this._filterPanel).subscribe((_: any) => {
91
91
  try {
92
92
  if (!!webEditorApp) {
93
93
  const helmString = webEditorApp.canvas.getHelm(true)
@@ -110,7 +110,7 @@ export class HelmBioFilter extends BioFilterBase<BioFilterProps> /* implements I
110
110
 
111
111
  applyProps() {
112
112
  if (!this.helmEditor) return; // helmEditor is not created, the filter is not in dom yet
113
- this.helmEditor.editor.setHelm(this.props.substructure);
113
+ this.updateFilterPanel(this.props.substructure);
114
114
  }
115
115
 
116
116
  get filterPanel() {
package/webpack.config.js CHANGED
@@ -3,6 +3,9 @@ const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
3
3
  const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
4
4
 
5
5
  module.exports = {
6
+ cache: {
7
+ type: 'filesystem',
8
+ },
6
9
  mode: 'development',
7
10
  entry: {
8
11
  package: ['./src/package.ts'],
@@ -1,20 +0,0 @@
1
- import {TRANSFORMATION_TYPE, CYCLIZATION_TYPE} from './const';
2
-
3
- export type MetaData = {
4
- leftTerminal: string,
5
- rightTerminal: string,
6
- transformationType: TRANSFORMATION_TYPE,
7
- cyclizationType: CYCLIZATION_TYPE,
8
- }
9
-
10
- export type ConnectionData = {
11
- monomerPosition: number,
12
- attachmentPoint: number,
13
- }
14
-
15
- export type PolyToolLib = {
16
- 'Short Name': string,
17
- 'Medium Name': string,
18
- 'SMILES': string,
19
- 'Synonyms': string
20
- }