@datagrok/bio 2.4.17 → 2.4.19
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/dist/864.js +1 -1
- package/dist/864.js.map +1 -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 +3 -3
- package/src/demo/bio01-similarity-diversity.ts +14 -12
- package/src/demo/bio01a-hierarchical-clustering-and-sequence-space.ts +12 -10
- package/src/demo/bio01b-hierarchical-clustering-and-activity-cliffs.ts +13 -10
- package/src/demo/bio03-atomic-level.ts +66 -0
- package/src/demo/bio05-helm-msa-sequence-space.ts +11 -9
- package/src/package-test.ts +1 -0
- package/src/package.ts +31 -23
- package/src/tests/mm-distance-tests.ts +138 -0
- package/src/tests/monomer-libraries-tests.ts +2 -2
- package/src/utils/monomer-lib.ts +35 -5
package/src/utils/monomer-lib.ts
CHANGED
|
@@ -15,6 +15,31 @@ export const LIB_STORAGE_NAME = 'Libraries';
|
|
|
15
15
|
export const LIB_PATH = 'System:AppData/Bio/libraries/';
|
|
16
16
|
export const LIB_DEFAULT: { [fileName: string]: string } = {'HELMCoreLibrary.json': 'HELMCoreLibrary.json'};
|
|
17
17
|
|
|
18
|
+
/** Type for user settings of monomer library set to use. */
|
|
19
|
+
export type LibSettings = {
|
|
20
|
+
exclude: string[],
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function getLibFileNameList(): Promise<string[]> {
|
|
24
|
+
const res: string[] = (await grok.dapi.files.list(`${LIB_PATH}`, false, ''))
|
|
25
|
+
.map((it) => it.fileName);
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function getUserLibSettings(): Promise<LibSettings> {
|
|
30
|
+
const resStr: string = await grok.dapi.userDataStorage.getValue(LIB_STORAGE_NAME, 'Settings', true);
|
|
31
|
+
const res: LibSettings = resStr ? JSON.parse(resStr) : {exclude: []};
|
|
32
|
+
|
|
33
|
+
// Fix empty object returned in case there is no settings stored for user
|
|
34
|
+
res.exclude = res.exclude instanceof Array ? res.exclude : [];
|
|
35
|
+
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function setUserLibSetting(value: LibSettings): Promise<void> {
|
|
40
|
+
await grok.dapi.userDataStorage.postValue(LIB_STORAGE_NAME, 'Settings', JSON.stringify(value), true);
|
|
41
|
+
}
|
|
42
|
+
|
|
18
43
|
export class MonomerLib implements IMonomerLib {
|
|
19
44
|
private _monomers: { [type: string]: { [name: string]: Monomer } } = {};
|
|
20
45
|
private _onChanged = new Subject<any>();
|
|
@@ -104,11 +129,16 @@ export class MonomerLibHelper implements IMonomerLibHelper {
|
|
|
104
129
|
*/
|
|
105
130
|
async loadLibraries(reload: boolean = false): Promise<void> {
|
|
106
131
|
return this.loadLibrariesPromise = this.loadLibrariesPromise.then(async () => {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
132
|
+
const [libFileNameList, settings]: [string[], LibSettings] = await Promise.all([
|
|
133
|
+
getLibFileNameList(),
|
|
134
|
+
getUserLibSettings()
|
|
135
|
+
]);
|
|
136
|
+
const libs: IMonomerLib[] = await Promise.all(libFileNameList
|
|
137
|
+
.filter((libFileName) => !settings.exclude.includes(libFileName))
|
|
138
|
+
.map((libFileName) => {
|
|
139
|
+
//TODO handle whether files are in place
|
|
140
|
+
return this.readLibrary(LIB_PATH, libFileName);
|
|
141
|
+
}));
|
|
112
142
|
this._monomerLib.updateLibs(libs, reload);
|
|
113
143
|
});
|
|
114
144
|
}
|