@datagrok/sequence-translator 1.3.12 → 1.3.14
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/CHANGELOG.md +19 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +6 -6
- package/src/apps/common/view/components/colored-input/style.css +1 -0
- package/src/apps/structure/view/style.css +14 -19
- package/src/apps/structure/view/ui.ts +9 -25
- package/src/package.ts +6 -6
- package/src/polytool/pt-dialog.ts +3 -70
- package/src/polytool/pt-enumeration-helm-dialog.ts +366 -169
- package/src/polytool/pt-enumeration-helm.ts +41 -33
- package/src/polytool/pt-placeholders-input.ts +23 -9
- package/src/polytool/types.ts +2 -0
- package/src/tests/polytool-enumerate-tests.ts +41 -24
- package/src/utils/context-menu.ts +5 -3
- package/src/utils/err-info.ts +2 -1
- package/src/polytool/cyclized.ts +0 -56
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/sequence-translator",
|
|
3
3
|
"friendlyName": "Sequence Translator",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.14",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Alexey Choposky",
|
|
7
7
|
"email": "achopovsky@datagrok.ai"
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@datagrok-libraries/bio": "5.42.
|
|
25
|
+
"@datagrok-libraries/bio": "5.42.12",
|
|
26
26
|
"@datagrok-libraries/chem-meta": "^1.2.5",
|
|
27
27
|
"@datagrok-libraries/tutorials": "^1.3.13",
|
|
28
|
-
"@datagrok-libraries/utils": "^4.2.
|
|
28
|
+
"@datagrok-libraries/utils": "^4.2.29",
|
|
29
29
|
"@types/react": "^18.0.15",
|
|
30
30
|
"cash-dom": "^8.1.0",
|
|
31
31
|
"datagrok-api": "^1.20.0",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"wu": "latest"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@datagrok-libraries/helm-web-editor": "^1.1.
|
|
43
|
-
"@datagrok-libraries/js-draw-lite": "^0.0.
|
|
42
|
+
"@datagrok-libraries/helm-web-editor": "^1.1.10",
|
|
43
|
+
"@datagrok-libraries/js-draw-lite": "^0.0.8",
|
|
44
44
|
"@datagrok/bio": "^2.14.2",
|
|
45
|
-
"@datagrok/helm": "^2.4.
|
|
45
|
+
"@datagrok/helm": "^2.4.4",
|
|
46
46
|
"@datagrok/chem": "^1.11.3",
|
|
47
47
|
"@types/jquery": "^3.5.14",
|
|
48
48
|
"@types/js-yaml": "^4.0.5",
|
|
@@ -4,25 +4,6 @@
|
|
|
4
4
|
padding-right: 20px;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.st-structure-input-form {
|
|
8
|
-
text-align: right;
|
|
9
|
-
vertical-align: top;
|
|
10
|
-
min-width: 95px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.st-structure-direction-choice label {
|
|
14
|
-
min-width: 100px;
|
|
15
|
-
float: right;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.st-structure-direction-choice div {
|
|
19
|
-
justify-content: right;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.st-structure-text-input-td { /* Style for td containing textarea */
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
7
|
.st-structure-mol-img {
|
|
27
8
|
margin-right: 30px;
|
|
28
9
|
float: right;
|
|
@@ -37,3 +18,17 @@
|
|
|
37
18
|
flex-direction: row-reverse;
|
|
38
19
|
padding-top: 20px;
|
|
39
20
|
}
|
|
21
|
+
|
|
22
|
+
.st-structure-clear-buttons {
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
padding: 13px 10px 13px 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.st-direction-inputs {
|
|
28
|
+
align-items: end;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.st-structure-inputs {
|
|
32
|
+
flex-grow: 2;
|
|
33
|
+
padding-left: 10px;
|
|
34
|
+
}
|
|
@@ -33,7 +33,7 @@ class StructureAppLayout {
|
|
|
33
33
|
this.onInvalidInput = new rxjs.Subject<string>();
|
|
34
34
|
this.inputBase = Object.fromEntries(
|
|
35
35
|
STRANDS.map(
|
|
36
|
-
(key) => [key, ui.input.textArea(
|
|
36
|
+
(key) => [key, ui.input.textArea(key.toUpperCase(), {value: '', onValueChanged: () => { this.onInput.next(); }})]
|
|
37
37
|
)
|
|
38
38
|
);
|
|
39
39
|
this.useChiralInput = ui.input.bool('Use chiral', {value: true});
|
|
@@ -91,7 +91,7 @@ class StructureAppLayout {
|
|
|
91
91
|
return boolInputsAndButton;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
private getTableInput(th: ITranslationHelper):
|
|
94
|
+
private getTableInput(th: ITranslationHelper): HTMLElement {
|
|
95
95
|
const coloredInput = Object.fromEntries(
|
|
96
96
|
STRANDS.map(
|
|
97
97
|
(key) => [key, new ColoredTextInput(this.inputBase[key], th.highlightInvalidSubsequence)]
|
|
@@ -140,32 +140,16 @@ class StructureAppLayout {
|
|
|
140
140
|
}
|
|
141
141
|
));
|
|
142
142
|
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
textInput: coloredInput[strand].root,
|
|
147
|
-
clear: clearBlock[strand],
|
|
148
|
-
choiceInput: directionChoiceInput[strand].root,
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
const tableLayout = ui.table(
|
|
152
|
-
tableRows, (item) => [item.label, item.textInput, item.clear, item.choiceInput]);
|
|
153
|
-
$(tableLayout).css('margin-top', '10px');
|
|
143
|
+
const sequenseInputs = ui.form([], 'st-structure-inputs');
|
|
144
|
+
const clearButtons = ui.divV([], 'st-structure-clear-buttons');
|
|
145
|
+
const directionInputs = ui.form([], 'st-direction-inputs');
|
|
154
146
|
|
|
155
147
|
for (const strand of STRANDS) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// d4-item-table class
|
|
160
|
-
$(element).css('padding-top', '3px');
|
|
161
|
-
|
|
162
|
-
element = directionChoiceInput[strand].root.parentElement!;
|
|
163
|
-
element.classList.add('st-structure-input-form', 'st-structure-direction-choice');
|
|
164
|
-
|
|
165
|
-
element = this.inputBase[strand].root.parentElement!;
|
|
166
|
-
element.classList.add('st-structure-text-input-td');
|
|
148
|
+
sequenseInputs.append(this.inputBase[strand].root);
|
|
149
|
+
clearButtons.append(clearBlock[strand]);
|
|
150
|
+
directionInputs.append(directionChoiceInput[strand].root);
|
|
167
151
|
}
|
|
168
|
-
return
|
|
152
|
+
return ui.divH([sequenseInputs, clearButtons, directionInputs]);
|
|
169
153
|
}
|
|
170
154
|
|
|
171
155
|
private getStrandData() {
|
package/src/package.ts
CHANGED
|
@@ -16,12 +16,12 @@ import {demoOligoPatternUI, demoOligoStructureUI, demoOligoTranslatorUI} from '.
|
|
|
16
16
|
import {getExternalAppViewFactories} from './plugins/mermade';
|
|
17
17
|
|
|
18
18
|
//polytool specific
|
|
19
|
-
import {getPolyToolConversionDialog,
|
|
19
|
+
import {getPolyToolConversionDialog, polyToolEnumerateChemUI} from './polytool/pt-dialog';
|
|
20
|
+
import {polyToolEnumerateHelmUI} from './polytool/pt-enumeration-helm-dialog';
|
|
20
21
|
import {_setPeptideColumn} from './polytool/utils';
|
|
21
22
|
import {PolyToolCsvLibHandler} from './polytool/csv-to-json-monomer-lib-converter';
|
|
22
23
|
import {ITranslationHelper} from './types';
|
|
23
24
|
import {addContextMenuUI} from './utils/context-menu';
|
|
24
|
-
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
25
25
|
|
|
26
26
|
export const _package: OligoToolkitPackage = new OligoToolkitPackage(/*{debug: true}/**/);
|
|
27
27
|
|
|
@@ -152,7 +152,7 @@ async function getSpecifiedAppView(appName: string): Promise<DG.ViewBase> {
|
|
|
152
152
|
return view;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
//top-menu: Bio |
|
|
155
|
+
//top-menu: Bio | PolyTool | Convert...
|
|
156
156
|
//name: polyToolConvert
|
|
157
157
|
//description: Perform cyclization of polymers
|
|
158
158
|
export async function polyToolConvert(): Promise<void> {
|
|
@@ -165,14 +165,14 @@ export async function polyToolConvert(): Promise<void> {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
//top-menu: Bio |
|
|
168
|
+
//top-menu: Bio | PolyTool | Enumerate HELM...
|
|
169
169
|
//name: polyToolEnumerateHelm
|
|
170
170
|
//description: Perform cyclization of polymers
|
|
171
171
|
export async function polyToolEnumerateHelm(): Promise<void> {
|
|
172
|
-
await polyToolEnumerateHelmUI();
|
|
172
|
+
await polyToolEnumerateHelmUI(grok.shell.tv?.dataFrame.currentCell);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
//top-menu: Bio |
|
|
175
|
+
//top-menu: Bio | PolyTool | Enumerate Chem...
|
|
176
176
|
//name: polyToolEnumerateChem
|
|
177
177
|
//description: Perform cyclization of polymers
|
|
178
178
|
export async function polyToolEnumerateChem(): Promise<void> {
|
|
@@ -4,13 +4,8 @@ import * as ui from 'datagrok-api/ui';
|
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
5
|
|
|
6
6
|
import $ from 'cash-dom';
|
|
7
|
-
import wu from 'wu';
|
|
8
|
-
import {Unsubscribable} from 'rxjs';
|
|
9
7
|
|
|
10
|
-
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
11
8
|
import {getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
12
|
-
import {HelmAtom, HelmMol} from '@datagrok-libraries/bio/src/helm/types';
|
|
13
|
-
// import {FormsViewer} from '@datagrok-libraries/utils/src/viewers/forms-viewer';
|
|
14
9
|
|
|
15
10
|
import {RuleInputs, RULES_PATH, RULES_STORAGE_NAME} from './pt-rules';
|
|
16
11
|
import {addTransformedColumn} from './pt-conversion';
|
|
@@ -18,75 +13,13 @@ import {addTransformedColumn} from './pt-conversion';
|
|
|
18
13
|
import {handleError} from './utils';
|
|
19
14
|
import {defaultErrorHandler} from '../utils/err-info';
|
|
20
15
|
import {getLibrariesList} from './utils';
|
|
21
|
-
import {getPtEnumeratorHelm, PT_HELM_EXAMPLE} from './pt-enumeration-helm';
|
|
22
16
|
import {getEnumerationChem, PT_CHEM_EXAMPLE} from './pt-enumeration-chem';
|
|
23
17
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
PT_ERROR_DATAFRAME, PT_UI_ADD_HELM, PT_UI_DIALOG_CONVERSION, PT_UI_DIALOG_ENUMERATION,
|
|
19
|
+
PT_UI_GET_HELM, PT_UI_RULES_USED, PT_UI_USE_CHIRALITY, PT_WARNING_COLUMN
|
|
20
|
+
} from './const';
|
|
26
21
|
|
|
27
22
|
import {_package} from '../package';
|
|
28
|
-
import {PolyToolPlaceholdersInput} from './pt-placeholders-input';
|
|
29
|
-
import {InputBase} from 'datagrok-api/dg';
|
|
30
|
-
import {PT_ERROR_DATAFRAME, PT_UI_ADD_HELM, PT_UI_DIALOG_CONVERSION, PT_UI_DIALOG_ENUMERATION, PT_UI_GET_HELM, PT_UI_RULES_USED, PT_UI_USE_CHIRALITY, PT_WARNING_COLUMN} from './const';
|
|
31
|
-
import {PolyToolEnumerateDialog} from './pt-enumeration-helm-dialog';
|
|
32
|
-
|
|
33
|
-
export async function polyToolEnumerateHelmUI(cell?: DG.Cell): Promise<void> {
|
|
34
|
-
const maxWidth = window.innerWidth;
|
|
35
|
-
const maxHeight = window.innerHeight;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const resizeInputs = () => {
|
|
39
|
-
const contentHeight = $(dialog.root).find('div.d4-dialog-contents').get(0)!.clientHeight;
|
|
40
|
-
|
|
41
|
-
const fitInputs: { [idx: number]: number } = {1: 1 /*, 3: 0.5*/};
|
|
42
|
-
const fitInputsSumHeight = Object.values(fitInputs).reduce((sum, h) => sum + h, 0);
|
|
43
|
-
|
|
44
|
-
const otherInputsHeight: number = dialog.inputs.filter((input, idx) => !(idx in fitInputs))
|
|
45
|
-
.map((input) => input.root.offsetHeight).reduce((sum, h) => sum + h, 0);
|
|
46
|
-
const remainFitHeight = contentHeight - otherInputsHeight - 38;
|
|
47
|
-
dialog.inputs.forEach((input, idx) => {
|
|
48
|
-
if (idx in fitInputs) {
|
|
49
|
-
const inputFitHeight = remainFitHeight * fitInputs[idx] / fitInputsSumHeight;
|
|
50
|
-
input.root.style.height = `${inputFitHeight}px`;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
const [dialog, inputs] = await PolyToolEnumerateDialog.create2(cell, resizeInputs);
|
|
55
|
-
|
|
56
|
-
let isFirstShow = true;
|
|
57
|
-
ui.onSizeChanged(dialog.root).subscribe(() => {
|
|
58
|
-
if (isFirstShow) {
|
|
59
|
-
const dialogInputList = dialog.inputs;
|
|
60
|
-
const dialogRootCash = $(dialog.root);
|
|
61
|
-
const contentMaxHeight = maxHeight
|
|
62
|
-
- dialogRootCash.find('div.d4-dialog-header').get(0)!.offsetHeight
|
|
63
|
-
- dialogRootCash.find('div.d4-dialog-footer').get(0)!.offsetHeight;
|
|
64
|
-
|
|
65
|
-
// dialog.inputs2.macromolecule.root.style.backgroundColor = '#CCFFCC';
|
|
66
|
-
|
|
67
|
-
const dialogWidth = maxWidth * 0.7;
|
|
68
|
-
const dialogHeight = maxHeight * 0.7;
|
|
69
|
-
|
|
70
|
-
// Centered, but resizable dialog
|
|
71
|
-
dialog.root.style.width = `${Math.min(maxWidth, dialogWidth)}px`;
|
|
72
|
-
dialog.root.style.height = `${Math.min(maxHeight, dialogHeight)}px`;
|
|
73
|
-
dialog.root.style.left = `${Math.floor((maxWidth - dialog.root.offsetWidth) / 2)}px`;
|
|
74
|
-
dialog.root.style.top = `${Math.floor((maxHeight - dialog.root.offsetHeight) / 2)}px`;
|
|
75
|
-
|
|
76
|
-
isFirstShow = false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
resizeInputs();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
_package.logger.debug('PolyToolEnumerateHelmUI: dialog before show');
|
|
83
|
-
const res = dialog.show({width: Math.max(350, maxWidth * 0.7), /* center: true,*/ resizable: true});
|
|
84
|
-
_package.logger.debug('PolyToolEnumerateHelmUI: dialog after show');
|
|
85
|
-
const k = 42;
|
|
86
|
-
} catch (_err: any) {
|
|
87
|
-
grok.shell.warning('To run PolyTool Enumeration, sketch the macromolecule and select monomers to vary');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
23
|
|
|
91
24
|
export function polyToolEnumerateChemUI(cell?: DG.Cell): void {
|
|
92
25
|
getPolyToolEnumerationChemDialog(cell)
|