@datagrok/bio 2.1.11 → 2.4.2
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/README.md +11 -12
- package/css/helm.css +10 -0
- package/detectors.js +83 -59
- package/dist/package-test.js +2 -68651
- package/dist/package-test.js.map +1 -0
- package/dist/package.js +2 -66040
- package/dist/package.js.map +1 -0
- package/dockerfiles/Dockerfile +86 -0
- package/files/icons/composition-analysis.svg +17 -0
- package/files/icons/sequence-diversity-viewer.svg +4 -0
- package/files/icons/sequence-similarity-viewer.svg +4 -0
- package/files/icons/vdregions-viewer.svg +22 -0
- package/files/icons/weblogo-viewer.svg +7 -0
- package/files/tests/testUrl.csv +11 -0
- package/files/tests/toAtomicLevelTest.csv +4 -0
- package/package.json +29 -32
- package/src/analysis/sequence-activity-cliffs.ts +15 -13
- package/src/analysis/sequence-diversity-viewer.ts +3 -2
- package/src/analysis/sequence-search-base-viewer.ts +4 -2
- package/src/analysis/sequence-similarity-viewer.ts +4 -4
- package/src/analysis/sequence-space.ts +2 -1
- package/src/calculations/monomerLevelMols.ts +6 -6
- package/src/package-test.ts +9 -2
- package/src/package.ts +230 -145
- package/src/substructure-search/substructure-search.ts +25 -22
- package/src/tests/Palettes-test.ts +9 -9
- package/src/tests/WebLogo-positions-test.ts +131 -68
- package/src/tests/_first-tests.ts +9 -0
- package/src/tests/activity-cliffs-tests.ts +8 -7
- package/src/tests/activity-cliffs-utils.ts +17 -9
- package/src/tests/bio-tests.ts +30 -21
- package/src/tests/checkInputColumn-tests.ts +17 -17
- package/src/tests/converters-test.ts +81 -46
- package/src/tests/detectors-benchmark-tests.ts +17 -17
- package/src/tests/detectors-tests.ts +190 -178
- package/src/tests/fasta-export-tests.ts +2 -3
- package/src/tests/monomer-libraries-tests.ts +34 -0
- package/src/tests/pepsea-tests.ts +21 -0
- package/src/tests/renderers-test.ts +33 -29
- package/src/tests/sequence-space-test.ts +6 -4
- package/src/tests/similarity-diversity-tests.ts +4 -4
- package/src/tests/splitters-test.ts +6 -7
- package/src/tests/substructure-filters-tests.ts +23 -1
- package/src/tests/utils/sequences-generators.ts +7 -7
- package/src/tests/utils.ts +2 -1
- package/src/tests/viewers.ts +16 -0
- package/src/utils/cell-renderer.ts +116 -54
- package/src/utils/constants.ts +7 -6
- package/src/utils/convert.ts +17 -11
- package/src/utils/monomer-lib.ts +174 -0
- package/src/utils/multiple-sequence-alignment.ts +49 -26
- package/src/utils/pepsea.ts +78 -0
- package/src/utils/save-as-fasta.ts +9 -8
- package/src/utils/ui-utils.ts +15 -3
- package/src/viewers/vd-regions-viewer.ts +125 -83
- package/src/viewers/web-logo-viewer.ts +1031 -0
- package/src/widgets/bio-substructure-filter.ts +38 -24
- package/tsconfig.json +71 -72
- package/webpack.config.js +4 -11
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_workers_dimensionality-reducer_js.js +0 -8988
- package/jest.config.js +0 -33
- package/src/__jest__/remote.test.ts +0 -77
- package/src/__jest__/test-node.ts +0 -98
- package/test-Bio-91c83d8913ff-bb573307.html +0 -392
|
@@ -13,15 +13,16 @@ import {helmSubstructureSearch, linearSubstructureSearch} from '../substructure-
|
|
|
13
13
|
import {Subject, Subscription} from 'rxjs';
|
|
14
14
|
import * as C from '../utils/constants';
|
|
15
15
|
import {updateDivInnerHTML} from '../utils/ui-utils';
|
|
16
|
-
import {NOTATION} from '@datagrok-libraries/bio';
|
|
17
|
-
import {
|
|
16
|
+
import {TAGS as bioTAGS, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
17
|
+
import {delay} from '@datagrok-libraries/utils/src/test';
|
|
18
|
+
import {debounceTime} from 'rxjs/operators';
|
|
18
19
|
|
|
19
20
|
export class BioSubstructureFilter extends DG.Filter {
|
|
20
21
|
bioFilter: FastaFilter | SeparatorFilter | HelmFilter | null = null;
|
|
21
22
|
bitset: DG.BitSet | null = null;
|
|
22
23
|
loader: HTMLDivElement = ui.loader();
|
|
23
24
|
onBioFilterChangedSubs?: Subscription;
|
|
24
|
-
notation: string | undefined =
|
|
25
|
+
notation: string | undefined = undefined;
|
|
25
26
|
|
|
26
27
|
get calculating(): boolean { return this.loader.style.display == 'initial'; }
|
|
27
28
|
|
|
@@ -39,6 +40,20 @@ export class BioSubstructureFilter extends DG.Filter {
|
|
|
39
40
|
return !this.calculating && this.bitset != null;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
get _debounceTime(): number {
|
|
44
|
+
if (this.column == null)
|
|
45
|
+
return 1000;
|
|
46
|
+
const length = this.column.length;
|
|
47
|
+
const minLength = 500;
|
|
48
|
+
const maxLength = 10000;
|
|
49
|
+
const msecMax = 1000;
|
|
50
|
+
if (length < minLength) return 0;
|
|
51
|
+
if (length > maxLength) return msecMax;
|
|
52
|
+
return Math.floor(msecMax * ((length - minLength) / (maxLength - minLength)));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//column name setter overload
|
|
56
|
+
|
|
42
57
|
constructor() {
|
|
43
58
|
super();
|
|
44
59
|
this.root = ui.divV([]);
|
|
@@ -48,16 +63,18 @@ export class BioSubstructureFilter extends DG.Filter {
|
|
|
48
63
|
attach(dataFrame: DG.DataFrame): void {
|
|
49
64
|
super.attach(dataFrame);
|
|
50
65
|
this.column = dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE);
|
|
51
|
-
this.columnName
|
|
52
|
-
this.notation
|
|
66
|
+
this.columnName ??= this.column?.name;
|
|
67
|
+
this.notation ??= this.column?.getTag(DG.TAGS.UNITS);
|
|
53
68
|
this.bioFilter = this.notation === NOTATION.FASTA ?
|
|
54
69
|
new FastaFilter() : this.notation === NOTATION.SEPARATOR ?
|
|
55
|
-
new SeparatorFilter(this.column!.getTag(
|
|
70
|
+
new SeparatorFilter(this.column!.getTag(bioTAGS.separator)) : new HelmFilter();
|
|
56
71
|
this.root.appendChild(this.bioFilter!.filterPanel);
|
|
57
72
|
this.root.appendChild(this.loader);
|
|
58
73
|
|
|
59
74
|
this.onBioFilterChangedSubs?.unsubscribe();
|
|
60
|
-
|
|
75
|
+
|
|
76
|
+
let onChangedEvent: any = this.bioFilter.onChanged;
|
|
77
|
+
onChangedEvent = onChangedEvent.pipe(debounceTime(this._debounceTime));
|
|
61
78
|
this.onBioFilterChangedSubs = onChangedEvent.subscribe(async (_: any) => await this._onInputChanged());
|
|
62
79
|
}
|
|
63
80
|
|
|
@@ -79,7 +96,7 @@ export class BioSubstructureFilter extends DG.Filter {
|
|
|
79
96
|
|
|
80
97
|
/** Override to load filter state. */
|
|
81
98
|
applyState(state: any): void {
|
|
82
|
-
super.applyState(state);
|
|
99
|
+
super.applyState(state); //column, columnName
|
|
83
100
|
if (state.bioSubstructure)
|
|
84
101
|
this.bioFilter!.substructure = state.bioSubstructure;
|
|
85
102
|
|
|
@@ -133,12 +150,14 @@ abstract class BioFilterBase {
|
|
|
133
150
|
}
|
|
134
151
|
|
|
135
152
|
class FastaFilter extends BioFilterBase {
|
|
136
|
-
substructureInput: DG.InputBase<string
|
|
137
|
-
this.onChanged.next();
|
|
138
|
-
}, {placeholder: 'Substructure'});
|
|
153
|
+
readonly substructureInput: DG.InputBase<string>;
|
|
139
154
|
|
|
140
155
|
constructor() {
|
|
141
156
|
super();
|
|
157
|
+
|
|
158
|
+
this.substructureInput = ui.stringInput('', '', () => {
|
|
159
|
+
this.onChanged.next();
|
|
160
|
+
}, {placeholder: 'Substructure'});
|
|
142
161
|
}
|
|
143
162
|
|
|
144
163
|
get filterPanel() {
|
|
@@ -159,13 +178,15 @@ class FastaFilter extends BioFilterBase {
|
|
|
159
178
|
}
|
|
160
179
|
|
|
161
180
|
export class SeparatorFilter extends FastaFilter {
|
|
162
|
-
separatorInput: DG.InputBase<string
|
|
163
|
-
this.onChanged.next();
|
|
164
|
-
}, {placeholder: 'Separator'});
|
|
181
|
+
readonly separatorInput: DG.InputBase<string>;
|
|
165
182
|
colSeparator = '';
|
|
166
183
|
|
|
167
184
|
constructor(separator: string) {
|
|
168
185
|
super();
|
|
186
|
+
|
|
187
|
+
this.separatorInput = ui.stringInput('', '', () => {
|
|
188
|
+
this.onChanged.next();
|
|
189
|
+
}, {placeholder: 'Separator'});
|
|
169
190
|
this.colSeparator = separator;
|
|
170
191
|
this.separatorInput.value = separator;
|
|
171
192
|
}
|
|
@@ -212,7 +233,8 @@ export class HelmFilter extends BioFilterBase {
|
|
|
212
233
|
ui.dialog({showHeader: false, showFooter: true})
|
|
213
234
|
.add(editorDiv)
|
|
214
235
|
.onOK(() => {
|
|
215
|
-
const helmString = webEditor.canvas.getHelm(true)
|
|
236
|
+
const helmString = webEditor.canvas.getHelm(true)
|
|
237
|
+
.replace(/<\/span>/g, '').replace(/<span style='background:#bbf;'>/g, '');
|
|
216
238
|
this.helmSubstructure = helmString;
|
|
217
239
|
this.updateFilterPanel(this.substructure);
|
|
218
240
|
setTimeout(() => { this.onChanged.next(); }, 10);
|
|
@@ -242,15 +264,7 @@ export class HelmFilter extends BioFilterBase {
|
|
|
242
264
|
this._filterPanel.parentElement!.clientWidth;
|
|
243
265
|
const height = width / 2;
|
|
244
266
|
if (!helmString) {
|
|
245
|
-
const
|
|
246
|
-
width: `${width}px`,
|
|
247
|
-
height: `${height/2}px`,
|
|
248
|
-
textAlign: 'center',
|
|
249
|
-
verticalAlign: 'middle',
|
|
250
|
-
lineHeight: `${height/2}px`,
|
|
251
|
-
border: '1px solid #dbdcdf'
|
|
252
|
-
}};
|
|
253
|
-
const editDiv = ui.divText('Click to edit', editDivStyle);
|
|
267
|
+
const editDiv = ui.divText('Click to edit', 'helm-substructure-filter');
|
|
254
268
|
updateDivInnerHTML(this._filterPanel, editDiv);
|
|
255
269
|
} else {
|
|
256
270
|
updateDivInnerHTML(this._filterPanel, this.helmEditor.host);
|
package/tsconfig.json
CHANGED
|
@@ -1,74 +1,73 @@
|
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
+
"module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
+
"lib": ["es2020", "dom", "ES2021.String"], /* Specify library files to be included in the compilation. */
|
|
10
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
|
13
|
+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
+
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
+
// "outDir": "./", /* Redirect output structure to the directory. */
|
|
18
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
+
// "composite": true, /* Enable project compilation */
|
|
20
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
+
|
|
27
|
+
/* Strict Type-Checking Options */
|
|
28
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
+
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */
|
|
34
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
+
|
|
37
|
+
/* Additional Checks */
|
|
38
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
43
|
+
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
44
|
+
|
|
45
|
+
/* Module Resolution Options */
|
|
46
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
47
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
48
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
49
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
50
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
51
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
52
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
53
|
+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
54
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
55
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
56
|
+
|
|
57
|
+
/* Source Map Options */
|
|
58
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
59
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
61
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
62
|
+
|
|
63
|
+
/* Experimental Options */
|
|
64
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
65
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
66
|
+
|
|
67
|
+
/* Advanced Options */
|
|
68
|
+
"skipLibCheck": false, /* Skip type checking of declaration files. */
|
|
69
|
+
"forceConsistentCasingInFileNames": true,
|
|
70
|
+
/* Disallow inconsistently-cased references to the same file. */
|
|
71
|
+
//"jsx": "react"
|
|
73
72
|
}
|
|
74
|
-
|
|
73
|
+
}
|
package/webpack.config.js
CHANGED
|
@@ -17,19 +17,12 @@ module.exports = {
|
|
|
17
17
|
},
|
|
18
18
|
module: {
|
|
19
19
|
rules: [
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
exclude: /node_modules/,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
test: /\.css$/,
|
|
27
|
-
use: ['style-loader', 'css-loader'],
|
|
28
|
-
exclude: /node_modules/,
|
|
29
|
-
},
|
|
20
|
+
{test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], exclude: /node_modules/},
|
|
21
|
+
{test: /\.ts(x?)$/, use: 'ts-loader', exclude: /node_modules/},
|
|
22
|
+
{test: /\.css$/, use: ['style-loader', 'css-loader']},
|
|
30
23
|
],
|
|
31
24
|
},
|
|
32
|
-
devtool: '
|
|
25
|
+
devtool: 'source-map',
|
|
33
26
|
externals: {
|
|
34
27
|
'datagrok-api/dg': 'DG',
|
|
35
28
|
'datagrok-api/grok': 'grok',
|