@datagrok/helm 0.0.5 → 1.0.0
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 +47 -47
- package/src/package.ts +44 -17
- package/src/tests/helm-tests.ts +9 -1
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
"name": "@datagrok/helm",
|
|
3
|
+
"beta": false,
|
|
4
|
+
"friendlyName": "Helm",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"datagrok-api": "^1.4.12",
|
|
9
|
+
"cash-dom": "latest",
|
|
10
|
+
"dayjs": "latest",
|
|
11
|
+
"@datagrok-libraries/utils": "latest <1.2.0"
|
|
12
|
+
},
|
|
13
|
+
"sources": [
|
|
14
|
+
"css/helm.css",
|
|
15
|
+
"https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js",
|
|
16
|
+
"helm/JSDraw/Scilligence.JSDraw2.Lite.js",
|
|
17
|
+
"helm/JSDraw/Scilligence.JSDraw2.Resources.js",
|
|
18
|
+
"helm/JSDraw/Pistoia.HELM-uncompressed.js"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"webpack": "latest",
|
|
22
|
+
"webpack-cli": "latest",
|
|
23
|
+
"ts-loader": "latest",
|
|
24
|
+
"typescript": "latest"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"link-all": "npm link datagrok-api @datagrok-libraries/utils",
|
|
28
|
+
"debug-helm": "webpack && grok publish ",
|
|
29
|
+
"release-helm": "webpack && grok publish --release",
|
|
30
|
+
"build-helm": "webpack",
|
|
31
|
+
"build": "webpack",
|
|
32
|
+
"debug-helm-dev": "grok publish dev --rebuild",
|
|
33
|
+
"release-helm-dev": "grok publish dev --rebuild --release",
|
|
34
|
+
"debug-helm-public": "grok publish public --rebuild",
|
|
35
|
+
"release-helm-public": "grok publish public --rebuild --release"
|
|
36
|
+
},
|
|
37
|
+
"canEdit": [
|
|
38
|
+
"Developers"
|
|
39
|
+
],
|
|
40
|
+
"canView": [
|
|
41
|
+
"All users"
|
|
42
|
+
],
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/datagrok-ai/public.git",
|
|
46
|
+
"directory": "packages/Helm"
|
|
47
|
+
},
|
|
48
|
+
"category": "Bioinformatics"
|
|
49
49
|
}
|
package/src/package.ts
CHANGED
|
@@ -16,16 +16,6 @@ export async function initChem(): Promise<void> {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
//name: helmCellRenderer
|
|
21
|
-
//tags: cellRenderer,cellRenderer-Macromolecule
|
|
22
|
-
//meta.cellType: Macromolecule
|
|
23
|
-
//meta-cell-renderer-sem-type: Macromolecule
|
|
24
|
-
//output: grid_cell_renderer result
|
|
25
|
-
export function helmCellRenderer(): DG.GridCellRenderer {
|
|
26
|
-
return new HelmCellRenderer();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
19
|
//tags: cellEditor
|
|
30
20
|
//description: Macromolecule
|
|
31
21
|
//input: grid_cell cell
|
|
@@ -69,14 +59,38 @@ export function detailsPanel(helmString: string){
|
|
|
69
59
|
'molecular weight': result[1],
|
|
70
60
|
'extinction coefficient': result[2],
|
|
71
61
|
'molfile': result[3],
|
|
72
|
-
'fasta': ui.wait(async () => ui.divText(await helmToFasta(helmString))),
|
|
62
|
+
/*'fasta': ui.wait(async () => ui.divText(await helmToFasta(helmString))),
|
|
73
63
|
'rna analogue sequence': ui.wait(async () => ui.divText(await helmToRNA(helmString))),
|
|
74
64
|
'smiles': ui.wait(async () => ui.divText(await helmToSmiles(helmString))),
|
|
75
|
-
'peptide analogue sequence': ui.wait(async () => ui.divText(await helmToPeptide(helmString)))
|
|
65
|
+
'peptide analogue sequence': ui.wait(async () => ui.divText(await helmToPeptide(helmString))),*/
|
|
76
66
|
})
|
|
77
67
|
)
|
|
78
68
|
}
|
|
79
69
|
|
|
70
|
+
|
|
71
|
+
async function loadDialog () {
|
|
72
|
+
//@ts-ignore
|
|
73
|
+
let res = await grok.dapi.files.list('System:AppData/Helm', false, '');
|
|
74
|
+
//@ts-ignore
|
|
75
|
+
res = res.map((e) => e.path);
|
|
76
|
+
//@ts-ignore
|
|
77
|
+
let FilesList = await ui.choiceInput('Monomer Libraries', ' ', res);
|
|
78
|
+
ui.dialog('Load library from file')
|
|
79
|
+
.add(FilesList)
|
|
80
|
+
.onOK(() => monomerManager(FilesList.value)).show();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
//name: Library
|
|
84
|
+
//tags: panel, widgets
|
|
85
|
+
//input: string helmString {semType: Macromolecule}
|
|
86
|
+
//output: widget result
|
|
87
|
+
export function libraryPanel(helmString: string) {
|
|
88
|
+
//@ts-ignore
|
|
89
|
+
let loadButton = ui.button('Load Library');
|
|
90
|
+
loadButton.addEventListener('click', loadDialog);
|
|
91
|
+
return new DG.Widget(ui.divH([loadButton]));
|
|
92
|
+
}
|
|
93
|
+
|
|
80
94
|
async function accessServer(url: string, key: string) {
|
|
81
95
|
const params: RequestInit = {
|
|
82
96
|
method: 'GET',
|
|
@@ -149,10 +163,8 @@ function getRS(smiles: string) {
|
|
|
149
163
|
return res;
|
|
150
164
|
}
|
|
151
165
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
export async function monomerManager(helmColumn: DG.Column) {
|
|
155
|
-
const file = await _package.files.readAsText('HELMCoreLibrary.json');
|
|
166
|
+
async function monomerManager(value: string) {
|
|
167
|
+
const file = await _package.files.readAsText(value.split('/')[1]);
|
|
156
168
|
const df = DG.DataFrame.fromJson(file);
|
|
157
169
|
var m;
|
|
158
170
|
for (var i = 0; i < df.rowCount; i++){
|
|
@@ -171,11 +183,26 @@ export async function monomerManager(helmColumn: DG.Column) {
|
|
|
171
183
|
}
|
|
172
184
|
|
|
173
185
|
//name: helmColumnToSmiles
|
|
174
|
-
//input: column helmColumn {semType:
|
|
186
|
+
//input: column helmColumn {semType: Macromolecule}
|
|
175
187
|
export function helmColumnToSmiles(helmColumn: DG.Column) {
|
|
176
188
|
//todo: add column with smiles to col.dataFrame.
|
|
177
189
|
}
|
|
178
190
|
|
|
191
|
+
//name: findMonomers
|
|
192
|
+
//input: string helmString { semType: Macromolecule }
|
|
193
|
+
export async function findMonomers(helmString: string) {
|
|
194
|
+
const types = Object.keys(org.helm.webeditor.monomerTypeList());
|
|
195
|
+
const monomers = [];
|
|
196
|
+
const monomer_names = [];
|
|
197
|
+
for (var i = 0; i < types.length; i++) {
|
|
198
|
+
monomers.push(new scil.helm.Monomers.getMonomerSet(types[i]));
|
|
199
|
+
Object.keys(monomers[i]).forEach(k => {
|
|
200
|
+
monomer_names.push(monomers[i][k].id);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const split_string = helmString.match(/[^\s.,\/\\(){}$]+/gim);
|
|
204
|
+
return new Set(split_string.filter(val => !monomer_names.includes(val)));
|
|
205
|
+
}
|
|
179
206
|
|
|
180
207
|
class HelmCellRenderer extends DG.GridCellRenderer {
|
|
181
208
|
|
package/src/tests/helm-tests.ts
CHANGED
|
@@ -25,11 +25,19 @@ category('Helm', () => {
|
|
|
25
25
|
expect(await helmToPeptide('PEPTIDE1{A.R.C.A.A.K.T.C.D.A}$PEPTIDE1,PEPTIDE1,8:R3-3:R3$$$'), 'ARCAAKTCDA');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
test('detectMacromolecule', async () => {
|
|
29
|
+
const file = await _package.files.readAsText('test.csv')
|
|
30
|
+
const df = DG.DataFrame.fromCsv(file);
|
|
31
|
+
let col = df.columns.byName('HELM string');
|
|
32
|
+
await grok.data.detectSemanticTypes(df);
|
|
33
|
+
expect(col.semType, DG.SEMTYPE.MACROMOLECULE);
|
|
34
|
+
});
|
|
35
|
+
|
|
28
36
|
test('detectHelm', async () => {
|
|
29
37
|
const file = await _package.files.readAsText('test.csv')
|
|
30
38
|
const df = DG.DataFrame.fromCsv(file);
|
|
31
39
|
let col = df.columns.byName('HELM string');
|
|
32
40
|
await grok.data.detectSemanticTypes(df);
|
|
33
|
-
expect(col.
|
|
41
|
+
expect(col.tags[DG.TAGS.UNITS], "HELM");
|
|
34
42
|
});
|
|
35
43
|
});
|