pdbe-molstar 3.7.1 → 3.8.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/build/pdbe-molstar-component.js +2 -2
- package/build/pdbe-molstar-light.css +2 -2
- package/build/pdbe-molstar-plugin.js +2 -2
- package/build/pdbe-molstar-plugin.js.LICENSE.txt +1 -1
- package/build/pdbe-molstar.css +2 -2
- package/lib/extensions/complexes/index.d.ts +1 -2
- package/lib/extensions/complexes/superpose-by-biggest-chain.js +1 -2
- package/lib/extensions/complexes/superpose-by-sequence-alignment.js +1 -2
- package/lib/helpers.d.ts +26 -14
- package/lib/helpers.js +4 -0
- package/lib/sequence-color/behavior.js +16 -11
- package/lib/sequence-color/color.d.ts +7 -3
- package/lib/sequence-color/color.js +69 -22
- package/lib/sequence-color/{prop.d.ts → sequence-color-annotations-prop.d.ts} +9 -5
- package/lib/sequence-color/{prop.js → sequence-color-annotations-prop.js} +15 -12
- package/lib/sequence-color/sequence-color-theme-prop.d.ts +46 -0
- package/lib/sequence-color/sequence-color-theme-prop.js +60 -0
- package/lib/spec.d.ts +7 -1
- package/lib/styles/pdbe-molstar/_index.scss +8 -3
- package/lib/superposition.js +0 -1
- package/lib/ui/layout-no-controls-unless-expanded.d.ts +1 -1
- package/lib/ui/layout-no-controls-unless-expanded.js +2 -2
- package/lib/ui/overlay.js +1 -1
- package/lib/ui/pdbe-viewport-controls.js +4 -1
- package/lib/viewer.d.ts +32 -2
- package/lib/viewer.js +74 -0
- package/package.json +3 -2
- package/lib/ui/_layout.d.ts +0 -15
- package/lib/ui/_layout.js +0 -162
|
@@ -5,40 +5,87 @@ const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
|
|
|
5
5
|
const structure_1 = require("molstar/lib/mol-model/structure");
|
|
6
6
|
const color_1 = require("molstar/lib/mol-util/color");
|
|
7
7
|
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
8
|
-
const
|
|
8
|
+
const sequence_color_annotations_prop_1 = require("./sequence-color-annotations-prop");
|
|
9
|
+
const sequence_color_theme_prop_1 = require("./sequence-color-theme-prop");
|
|
9
10
|
/** Special color value meaning "no color assigned" */
|
|
10
11
|
const NoColor = (0, color_1.Color)(-1);
|
|
11
12
|
var CustomSequenceColorTheme;
|
|
12
13
|
(function (CustomSequenceColorTheme) {
|
|
14
|
+
/** Provider name (key) for this color theme */
|
|
15
|
+
CustomSequenceColorTheme.Name = 'custom-sequence-color';
|
|
16
|
+
/** Parameter definition for this color theme */
|
|
13
17
|
CustomSequenceColorTheme.Params = {};
|
|
14
|
-
function Theme(ctx, props) {
|
|
15
|
-
let color = () => NoColor;
|
|
16
|
-
if (ctx.structure && !ctx.structure.isEmpty) {
|
|
17
|
-
const colorData = prop_1.SequenceColorProperty.Provider.get(ctx.structure).value;
|
|
18
|
-
if (colorData && colorData.items.length > 0) {
|
|
19
|
-
color = location => structure_1.StructureElement.Location.is(location) ? sequenceColorForLocation(colorData, location) : NoColor;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
18
|
+
function Theme(ctx, props, colorThemeRegistry) {
|
|
22
19
|
return {
|
|
23
|
-
factory: Theme,
|
|
20
|
+
factory: (ctx_, props_) => Theme(ctx_, props_, colorThemeRegistry),
|
|
24
21
|
granularity: 'groupInstance',
|
|
25
|
-
color:
|
|
22
|
+
color: colorFn(ctx, colorThemeRegistry),
|
|
26
23
|
props: props,
|
|
27
|
-
description: 'Assigns colors based on custom structure property `SequenceColorProperty`.',
|
|
24
|
+
description: 'Assigns colors based on custom structure property `SequenceColorProperty` and `SequenceColorBackgroundProperty`.',
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
CustomSequenceColorTheme.Theme = Theme;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
/** Create a provider for this color theme */
|
|
29
|
+
function makeProvider(colorThemeRegistry) {
|
|
30
|
+
return {
|
|
31
|
+
name: CustomSequenceColorTheme.Name,
|
|
32
|
+
label: 'Custom Sequence Color',
|
|
33
|
+
category: 'Miscellaneous',
|
|
34
|
+
factory: (ctx, props) => Theme(ctx, props, colorThemeRegistry),
|
|
35
|
+
getParams: ctx => CustomSequenceColorTheme.Params,
|
|
36
|
+
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(CustomSequenceColorTheme.Params),
|
|
37
|
+
isApplicable: (ctx) => !!ctx.structure,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
CustomSequenceColorTheme.makeProvider = makeProvider;
|
|
41
41
|
})(CustomSequenceColorTheme || (exports.CustomSequenceColorTheme = CustomSequenceColorTheme = {}));
|
|
42
|
+
/** Create color function based on `SequenceColorAnnotationsProperty` and `SequenceColorThemeProperty` */
|
|
43
|
+
function colorFn(ctx, colorThemeRegistry) {
|
|
44
|
+
const background = themeColorFn(ctx, colorThemeRegistry);
|
|
45
|
+
const foreground = annotColorFn(ctx);
|
|
46
|
+
if (foreground && background) {
|
|
47
|
+
return (location, isSecondary) => {
|
|
48
|
+
const fgColor = foreground(location, isSecondary);
|
|
49
|
+
if (fgColor >= 0)
|
|
50
|
+
return fgColor;
|
|
51
|
+
else
|
|
52
|
+
return background(location, isSecondary);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (foreground)
|
|
56
|
+
return foreground;
|
|
57
|
+
if (background)
|
|
58
|
+
return background;
|
|
59
|
+
return () => NoColor;
|
|
60
|
+
}
|
|
61
|
+
/** Create color function based on `SequenceColorThemeProperty` */
|
|
62
|
+
function themeColorFn(ctx, colorThemeRegistry) {
|
|
63
|
+
var _a;
|
|
64
|
+
if (!colorThemeRegistry)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (!ctx.structure || ctx.structure.isEmpty)
|
|
67
|
+
return undefined;
|
|
68
|
+
const data = sequence_color_theme_prop_1.SequenceColorThemeProperty.Provider.get(ctx.structure).value;
|
|
69
|
+
if (!(data === null || data === void 0 ? void 0 : data.useTheme))
|
|
70
|
+
return undefined;
|
|
71
|
+
const theme = (_a = colorThemeRegistry.get(data.theme.name)) === null || _a === void 0 ? void 0 : _a.factory(ctx, data.theme.params);
|
|
72
|
+
if (!theme || !('color' in theme))
|
|
73
|
+
return undefined;
|
|
74
|
+
if (data.themeStrength === 1)
|
|
75
|
+
return theme.color;
|
|
76
|
+
if (data.themeStrength === 0)
|
|
77
|
+
return () => data.dilutionColor;
|
|
78
|
+
return (location, isSecondary) => color_1.Color.interpolate(data.dilutionColor, theme.color(location, isSecondary), data.themeStrength);
|
|
79
|
+
}
|
|
80
|
+
/** Create color function based on `SequenceColorAnnotationsProperty` */
|
|
81
|
+
function annotColorFn(ctx) {
|
|
82
|
+
if (!ctx.structure || ctx.structure.isEmpty)
|
|
83
|
+
return undefined;
|
|
84
|
+
const colorData = sequence_color_annotations_prop_1.SequenceColorAnnotationsProperty.Provider.get(ctx.structure).value;
|
|
85
|
+
if (!colorData || colorData.items.length === 0)
|
|
86
|
+
return undefined;
|
|
87
|
+
return location => structure_1.StructureElement.Location.is(location) ? sequenceColorForLocation(colorData, location) : NoColor;
|
|
88
|
+
}
|
|
42
89
|
function sequenceColorForLocation(colorData, location) {
|
|
43
90
|
var _a, _b;
|
|
44
91
|
var _c, _d, _e;
|
|
@@ -3,13 +3,17 @@ import { CustomStructureProperty } from 'molstar/lib/mol-model-props/common/cust
|
|
|
3
3
|
import { ElementIndex } from 'molstar/lib/mol-model/structure';
|
|
4
4
|
import { Color } from 'molstar/lib/mol-util/color';
|
|
5
5
|
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
|
|
6
|
-
export declare namespace
|
|
7
|
-
/**
|
|
6
|
+
export declare namespace SequenceColorAnnotationsProperty {
|
|
7
|
+
/** Provider name (key) for this custom property */
|
|
8
|
+
const Name = "sequence-color-annotations";
|
|
9
|
+
/** Parameter definition for this custom property */
|
|
8
10
|
type Params = typeof Params;
|
|
9
11
|
const Params: {
|
|
10
12
|
colors: PD.ObjectList<PD.Normalize<{
|
|
11
13
|
color: Color;
|
|
12
14
|
selector: PD.NamedParams<"all" | "polymer" | "water" | "branched" | "ligand" | "ion" | "lipid" | "protein" | "nucleic" | "non-standard" | "coarse", "static"> | PD.NamedParams<import("molstar/lib/mol-script/script").Script, "script"> | PD.NamedParams<import("molstar/lib/mol-script/language/expression").Expression, "expression"> | PD.NamedParams<import("molstar/lib/mol-model/structure/structure/element/bundle").Bundle, "bundle"> | PD.NamedParams<PD.Normalize<{
|
|
15
|
+
label: string;
|
|
16
|
+
nullIfEmpty: boolean | undefined;
|
|
13
17
|
annotationId: string;
|
|
14
18
|
fieldName: string;
|
|
15
19
|
fieldValues: PD.NamedParams<PD.Normalize<unknown>, "all"> | PD.NamedParams<PD.Normalize<{
|
|
@@ -18,9 +22,9 @@ export declare namespace SequenceColorProperty {
|
|
|
18
22
|
}>, "annotation">;
|
|
19
23
|
}>>;
|
|
20
24
|
};
|
|
21
|
-
/**
|
|
25
|
+
/** Type of parameter values for this custom property */
|
|
22
26
|
type Props = PD.Values<Params>;
|
|
23
|
-
/**
|
|
27
|
+
/** Type of values of this custom property */
|
|
24
28
|
interface Data {
|
|
25
29
|
items: {
|
|
26
30
|
selector: Selector;
|
|
@@ -33,6 +37,6 @@ export declare namespace SequenceColorProperty {
|
|
|
33
37
|
};
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
|
-
/** Provider for custom
|
|
40
|
+
/** Provider for this custom property */
|
|
37
41
|
const Provider: CustomStructureProperty.Provider<Params, Data>;
|
|
38
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SequenceColorAnnotationsProperty = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
|
|
6
6
|
const custom_structure_property_1 = require("molstar/lib/mol-model-props/common/custom-structure-property");
|
|
@@ -8,31 +8,34 @@ const custom_property_1 = require("molstar/lib/mol-model/custom-property");
|
|
|
8
8
|
const color_1 = require("molstar/lib/mol-util/color");
|
|
9
9
|
const names_1 = require("molstar/lib/mol-util/color/names");
|
|
10
10
|
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
11
|
-
var
|
|
12
|
-
(function (
|
|
13
|
-
|
|
11
|
+
var SequenceColorAnnotationsProperty;
|
|
12
|
+
(function (SequenceColorAnnotationsProperty) {
|
|
13
|
+
/** Provider name (key) for this custom property */
|
|
14
|
+
SequenceColorAnnotationsProperty.Name = 'sequence-color-annotations';
|
|
15
|
+
SequenceColorAnnotationsProperty.Params = {
|
|
14
16
|
colors: param_definition_1.ParamDefinition.ObjectList({
|
|
15
17
|
color: param_definition_1.ParamDefinition.Color(names_1.ColorNames.grey, { description: 'Color to apply to a substructure' }),
|
|
16
18
|
selector: selector_1.SelectorParams,
|
|
17
19
|
}, obj => color_1.Color.toHexStyle(obj.color), { description: 'List of substructure-color assignments' }),
|
|
18
20
|
};
|
|
19
|
-
/** Provider for custom
|
|
20
|
-
|
|
21
|
-
label: 'Sequence Color',
|
|
21
|
+
/** Provider for this custom property */
|
|
22
|
+
SequenceColorAnnotationsProperty.Provider = custom_structure_property_1.CustomStructureProperty.createProvider({
|
|
23
|
+
label: 'Sequence Color Annotations',
|
|
22
24
|
descriptor: (0, custom_property_1.CustomPropertyDescriptor)({
|
|
23
|
-
name:
|
|
25
|
+
name: SequenceColorAnnotationsProperty.Name,
|
|
24
26
|
}),
|
|
25
27
|
type: 'root',
|
|
26
|
-
defaultParams:
|
|
27
|
-
getParams: (data) =>
|
|
28
|
+
defaultParams: SequenceColorAnnotationsProperty.Params,
|
|
29
|
+
getParams: (data) => SequenceColorAnnotationsProperty.Params,
|
|
28
30
|
isApplicable: (data) => data.root === data,
|
|
29
31
|
obtain: (ctx, data, props) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const fullProps = Object.assign(Object.assign({}, param_definition_1.ParamDefinition.getDefaultValues(
|
|
32
|
+
const fullProps = Object.assign(Object.assign({}, param_definition_1.ParamDefinition.getDefaultValues(SequenceColorAnnotationsProperty.Params)), props);
|
|
31
33
|
const items = fullProps.colors.map(t => ({
|
|
34
|
+
// creating a copy, so we don't polute props later
|
|
32
35
|
selector: t.selector,
|
|
33
36
|
color: t.color,
|
|
34
37
|
}));
|
|
35
38
|
return { value: { items, colorCache: {} } };
|
|
36
39
|
}),
|
|
37
40
|
});
|
|
38
|
-
})(
|
|
41
|
+
})(SequenceColorAnnotationsProperty || (exports.SequenceColorAnnotationsProperty = SequenceColorAnnotationsProperty = {}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CustomStructureProperty } from 'molstar/lib/mol-model-props/common/custom-structure-property';
|
|
2
|
+
import { ColorTheme } from 'molstar/lib/mol-theme/color';
|
|
3
|
+
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
|
|
4
|
+
export declare namespace SequenceColorThemeProperty {
|
|
5
|
+
/** Provider name (key) for this custom property */
|
|
6
|
+
const Name = "sequence-color-theme";
|
|
7
|
+
/** Parameter definition for this custom property */
|
|
8
|
+
type Params = ReturnType<typeof makeParams>;
|
|
9
|
+
/** Create parameter definition for this custom property, using information from a color theme registry.
|
|
10
|
+
* If `colorThemeRegistry` is undefined, the `theme` parameter will be typed as `any` (i.e. no UI support). */
|
|
11
|
+
function makeParams(colorThemeRegistry: ColorTheme.Registry | undefined): {
|
|
12
|
+
useTheme: PD.BooleanParam;
|
|
13
|
+
theme: PD.Mapped<PD.NamedParams<unknown, string>> | PD.Group<PD.Normalize<{
|
|
14
|
+
name: string;
|
|
15
|
+
params: any;
|
|
16
|
+
}>>;
|
|
17
|
+
themeStrength: PD.Numeric;
|
|
18
|
+
dilutionColor: PD.Color;
|
|
19
|
+
};
|
|
20
|
+
/** Type of parameter values for this custom property */
|
|
21
|
+
type Props = PD.Values<Params>;
|
|
22
|
+
/** Type of values of this custom property */
|
|
23
|
+
type Data = Props;
|
|
24
|
+
/** Create a provider for this custom property, using information from a color theme registry.
|
|
25
|
+
* If `colorThemeRegistry` is undefined, the provider will work, but parameter definitions will not be inferred (i.e. limited UI support). */
|
|
26
|
+
function makeProvider(colorThemeRegistry: ColorTheme.Registry | undefined): CustomStructureProperty.Provider<Params, Data>;
|
|
27
|
+
/** Default provider for this custom property, without type information from a color theme registry (i.e. limited UI support).
|
|
28
|
+
* Use `makeProvider` to get a provider with full UI support. */
|
|
29
|
+
const Provider: CustomStructureProperty.Provider<{
|
|
30
|
+
useTheme: PD.BooleanParam;
|
|
31
|
+
theme: PD.Mapped<PD.NamedParams<unknown, string>> | PD.Group<PD.Normalize<{
|
|
32
|
+
name: string;
|
|
33
|
+
params: any;
|
|
34
|
+
}>>;
|
|
35
|
+
themeStrength: PD.Numeric;
|
|
36
|
+
dilutionColor: PD.Color;
|
|
37
|
+
}, PD.Values<{
|
|
38
|
+
useTheme: PD.BooleanParam;
|
|
39
|
+
theme: PD.Mapped<PD.NamedParams<unknown, string>> | PD.Group<PD.Normalize<{
|
|
40
|
+
name: string;
|
|
41
|
+
params: any;
|
|
42
|
+
}>>;
|
|
43
|
+
themeStrength: PD.Numeric;
|
|
44
|
+
dilutionColor: PD.Color;
|
|
45
|
+
}>>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceColorThemeProperty = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const custom_structure_property_1 = require("molstar/lib/mol-model-props/common/custom-structure-property");
|
|
6
|
+
const custom_property_1 = require("molstar/lib/mol-model/custom-property");
|
|
7
|
+
const structure_1 = require("molstar/lib/mol-model/structure");
|
|
8
|
+
const names_1 = require("molstar/lib/mol-util/color/names");
|
|
9
|
+
const object_1 = require("molstar/lib/mol-util/object");
|
|
10
|
+
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
11
|
+
const AnyParams = param_definition_1.ParamDefinition.Value({}, { description: 'Parameter description not available' });
|
|
12
|
+
var SequenceColorThemeProperty;
|
|
13
|
+
(function (SequenceColorThemeProperty) {
|
|
14
|
+
/** Provider name (key) for this custom property */
|
|
15
|
+
SequenceColorThemeProperty.Name = 'sequence-color-theme';
|
|
16
|
+
/** Create parameter definition for this custom property, using information from a color theme registry.
|
|
17
|
+
* If `colorThemeRegistry` is undefined, the `theme` parameter will be typed as `any` (i.e. no UI support). */
|
|
18
|
+
function makeParams(colorThemeRegistry) {
|
|
19
|
+
return {
|
|
20
|
+
useTheme: param_definition_1.ParamDefinition.Boolean(false, { description: 'Turn on/off background sequence color theme' }),
|
|
21
|
+
theme: colorThemeRegistry ?
|
|
22
|
+
param_definition_1.ParamDefinition.Mapped('uniform', colorThemeRegistry.types, name => {
|
|
23
|
+
try {
|
|
24
|
+
return param_definition_1.ParamDefinition.Group(colorThemeRegistry.get(name).getParams({ structure: structure_1.Structure.Empty }));
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.warn(`Failed to obtain parameter definition for theme "${name}"`);
|
|
28
|
+
return AnyParams;
|
|
29
|
+
}
|
|
30
|
+
}, { hideIf: p => !p.useTheme })
|
|
31
|
+
: param_definition_1.ParamDefinition.Group({ name: param_definition_1.ParamDefinition.Text(), params: AnyParams }, { hideIf: p => !p.useTheme }),
|
|
32
|
+
themeStrength: param_definition_1.ParamDefinition.Numeric(1, { min: 0, max: 1, step: 0.01 }, { hideIf: p => !p.useTheme, description: 'Allows to "dilute" color coming from background sequence color theme' }),
|
|
33
|
+
dilutionColor: param_definition_1.ParamDefinition.Color(names_1.ColorNames.white, { hideIf: p => !p.useTheme || p.themeStrength === 1, description: 'Color used for "diluting" background sequence color theme' }),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
SequenceColorThemeProperty.makeParams = makeParams;
|
|
37
|
+
/** Create a provider for this custom property, using information from a color theme registry.
|
|
38
|
+
* If `colorThemeRegistry` is undefined, the provider will work, but parameter definitions will not be inferred (i.e. limited UI support). */
|
|
39
|
+
function makeProvider(colorThemeRegistry) {
|
|
40
|
+
const params = makeParams(colorThemeRegistry);
|
|
41
|
+
return custom_structure_property_1.CustomStructureProperty.createProvider({
|
|
42
|
+
label: 'Sequence Color Theme',
|
|
43
|
+
descriptor: (0, custom_property_1.CustomPropertyDescriptor)({
|
|
44
|
+
name: SequenceColorThemeProperty.Name,
|
|
45
|
+
}),
|
|
46
|
+
type: 'root',
|
|
47
|
+
defaultParams: params,
|
|
48
|
+
getParams: (data) => params,
|
|
49
|
+
isApplicable: (data) => data.root === data,
|
|
50
|
+
obtain: (ctx, data, props) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const fullProps = Object.assign(Object.assign({}, param_definition_1.ParamDefinition.getDefaultValues(params)), props);
|
|
52
|
+
return { value: (0, object_1.deepClone)(fullProps) };
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
SequenceColorThemeProperty.makeProvider = makeProvider;
|
|
57
|
+
/** Default provider for this custom property, without type information from a color theme registry (i.e. limited UI support).
|
|
58
|
+
* Use `makeProvider` to get a provider with full UI support. */
|
|
59
|
+
SequenceColorThemeProperty.Provider = makeProvider(undefined);
|
|
60
|
+
})(SequenceColorThemeProperty || (exports.SequenceColorThemeProperty = SequenceColorThemeProperty = {}));
|
package/lib/spec.d.ts
CHANGED
|
@@ -72,7 +72,13 @@ export interface InitParams {
|
|
|
72
72
|
};
|
|
73
73
|
/** Specify parts of the structure to highlight with different colors */
|
|
74
74
|
selection?: {
|
|
75
|
-
data: QueryParam
|
|
75
|
+
data: (QueryParam & {
|
|
76
|
+
color?: AnyColor;
|
|
77
|
+
sideChain?: boolean;
|
|
78
|
+
representation?: string;
|
|
79
|
+
representationColor?: any;
|
|
80
|
+
focus?: boolean;
|
|
81
|
+
})[];
|
|
76
82
|
nonSelectedColor?: AnyColor;
|
|
77
83
|
};
|
|
78
84
|
/** Display 3D State Gallery */
|
|
@@ -197,9 +197,14 @@ $viewport-button-spacing: 4px;
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
.pdbemolstar-pdbe-logo {
|
|
200
|
-
height:
|
|
201
|
-
width:
|
|
202
|
-
|
|
200
|
+
height: 16px;
|
|
201
|
+
width: 16px;
|
|
202
|
+
position: relative;
|
|
203
|
+
|
|
204
|
+
svg {
|
|
205
|
+
position: absolute;
|
|
206
|
+
inset: 0;
|
|
207
|
+
}
|
|
203
208
|
}
|
|
204
209
|
}
|
|
205
210
|
|
package/lib/superposition.js
CHANGED
|
@@ -375,7 +375,6 @@ function renderSuperposition(plugin, segmentIndex, entryList) {
|
|
|
375
375
|
const data = plugin.state.data.select(strInstance.ref)[0].obj.data;
|
|
376
376
|
const carbChainSel = script_1.Script.getStructureSelection(carbEntityChainInVicinity, data);
|
|
377
377
|
if (carbChainSel && carbChainSel.kind === 'sequence') {
|
|
378
|
-
// console.log(carbEntityChainId + ' chain present in 5 A radius');
|
|
379
378
|
const carbLigands = [];
|
|
380
379
|
const carbLigNamesAndCount = {};
|
|
381
380
|
const carbLigList = [];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FullLayoutNoControlsUnlessExpanded = void 0;
|
|
4
|
+
const plugin_1 = require("molstar/lib/mol-plugin-ui/plugin");
|
|
4
5
|
const config_1 = require("molstar/lib/mol-plugin/config");
|
|
5
6
|
const plugin_custom_state_1 = require("../plugin-custom-state");
|
|
6
|
-
|
|
7
|
-
class FullLayoutNoControlsUnlessExpanded extends _layout_1.Layout {
|
|
7
|
+
class FullLayoutNoControlsUnlessExpanded extends plugin_1.Layout {
|
|
8
8
|
componentDidMount() {
|
|
9
9
|
super.componentDidMount();
|
|
10
10
|
// Hide Toggle Controls button unless expanded:
|
package/lib/ui/overlay.js
CHANGED
|
@@ -29,5 +29,5 @@ function WithLoadingOverlay(MainContent, OverlayContent = PDBeLoadingOverlayBox)
|
|
|
29
29
|
}
|
|
30
30
|
/** Overlay component with animated PDBe logo */
|
|
31
31
|
function PDBeLoadingOverlayBox() {
|
|
32
|
-
return (0, jsx_runtime_1.
|
|
32
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'pdbemolstar-overlay-box', children: [(0, jsx_runtime_1.jsxs)("svg", { className: 'pdbe-animated-logo', viewBox: '0 0 300 300', children: [(0, jsx_runtime_1.jsx)("path", { className: 'path-bg', fill: 'transparent', stroke: '#E13D3D', strokeWidth: '30', d: 'M 150 200 L 150 100 A 50 50 0 1 0 100 150 L 200 150 A 50 50 0 1 0 150 100 L 150 200 A 50 50 0 1 0 200 150 L 100 150 A 50 50 0 1 0 150 200 ' }), (0, jsx_runtime_1.jsx)("path", { className: 'path-cross', fill: 'transparent', stroke: '#72B260', strokeWidth: '30', d: 'M 150 100 L 150 200 M 100 150 L 200 150' }), (0, jsx_runtime_1.jsx)("path", { className: 'path-fg', fill: 'transparent', stroke: '#72B260', strokeWidth: '30', d: 'M 100 150 A 50 50 0 1 1 150 100 L 150 170 L 150 100 L 150 170 L 150 100 L 150 100 A 50 50 0 1 1 200 150 L 130 150 L 200 150 L 130 150 L 200 150 L 200 150 A 50 50 0 1 1 150 200 L 150 130 L 150 200 L 150 130 L 150 200 L 150 200 A 50 50 0 1 1 100 150 L 170 150 L 100 150 L 170 150 L 100 150' })] }), ";"] });
|
|
33
33
|
}
|
|
@@ -10,7 +10,10 @@ class PDBeViewportControls extends viewport_1.ViewportControls {
|
|
|
10
10
|
const initParams = (0, plugin_custom_state_1.PluginCustomState)(this.plugin).initParams;
|
|
11
11
|
const showPDBeLink = (initParams === null || initParams === void 0 ? void 0 : initParams.moleculeId) && (initParams === null || initParams === void 0 ? void 0 : initParams.pdbeLink) && !(initParams === null || initParams === void 0 ? void 0 : initParams.superposition);
|
|
12
12
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showPDBeLink &&
|
|
13
|
-
(0, jsx_runtime_1.jsx)("div", { className: 'msp-viewport-controls', children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-viewport-controls-buttons', children: (0, jsx_runtime_1.jsxs)("div", { className: 'pdbemolstar-pdbe-link-box', children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-semi-transparent-background' }), (0, jsx_runtime_1.jsx)("a", { target: '_blank', href: `https://pdbe.org/${initParams.moleculeId}`, style: { textDecoration: 'none', color: 'initial' }, children: (0, jsx_runtime_1.jsxs)(common_1.Button, { className: 'msp-btn-link-toggle-on pdbemolstar-pdbe-link', title: 'Go to PDBe Pages', children: [(0, jsx_runtime_1.jsx)("
|
|
13
|
+
(0, jsx_runtime_1.jsx)("div", { className: 'msp-viewport-controls', children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-viewport-controls-buttons', children: (0, jsx_runtime_1.jsxs)("div", { className: 'pdbemolstar-pdbe-link-box', children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-semi-transparent-background' }), (0, jsx_runtime_1.jsx)("a", { target: '_blank', href: `https://pdbe.org/${initParams.moleculeId}`, style: { textDecoration: 'none', color: 'initial' }, children: (0, jsx_runtime_1.jsxs)(common_1.Button, { className: 'msp-btn-link-toggle-on pdbemolstar-pdbe-link', title: 'Go to PDBe Pages', children: [(0, jsx_runtime_1.jsx)("div", { className: 'pdbemolstar-pdbe-logo', children: (0, jsx_runtime_1.jsx)(PDBeLogo, {}) }), initParams.moleculeId] }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: showPDBeLink ? 'pdbemolstar-viewport-controls-shifted' : 'pdbemolstar-viewport-controls-normal', children: super.render() })] });
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.PDBeViewportControls = PDBeViewportControls;
|
|
17
|
+
function PDBeLogo({ className }) {
|
|
18
|
+
return (0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: '0 0 300 300', children: [(0, jsx_runtime_1.jsx)("path", { className: 'path-bg', fill: 'transparent', stroke: '#E13D3D', strokeWidth: '35', d: 'M 150 200 L 150 100 A 50 50 0 1 0 100 150 L 200 150 A 50 50 0 1 0 150 100 L 150 200 A 50 50 0 1 0 200 150 L 100 150 A 50 50 0 1 0 150 200 ' }), (0, jsx_runtime_1.jsx)("path", { className: 'path-fg', fill: 'transparent', stroke: '#72B260', strokeWidth: '35', d: 'M 200 150 A 50 50 0 1 0 150 100 L 150 200 A 50 50 0 1 0 200 150 L 100 150 A 50 50 0 1 0 150 200 ' })] });
|
|
19
|
+
}
|
package/lib/viewer.d.ts
CHANGED
|
@@ -140,7 +140,13 @@ export declare class PDBeMolstarPlugin {
|
|
|
140
140
|
* If `structureNumber` is provided, apply to the specified structure (numbered from 1!); otherwise apply to all loaded structures.
|
|
141
141
|
* Remove any previously added coloring and extra representations, unless `keepColors` and/or `keepRepresentations` is set. */
|
|
142
142
|
select: (params: {
|
|
143
|
-
data: QueryParam
|
|
143
|
+
data: (QueryParam & {
|
|
144
|
+
color?: AnyColor;
|
|
145
|
+
sideChain?: boolean;
|
|
146
|
+
representation?: string;
|
|
147
|
+
representationColor?: any;
|
|
148
|
+
focus?: boolean;
|
|
149
|
+
})[];
|
|
144
150
|
nonSelectedColor?: AnyColor;
|
|
145
151
|
structureId?: string;
|
|
146
152
|
structureNumber?: number;
|
|
@@ -155,12 +161,36 @@ export declare class PDBeMolstarPlugin {
|
|
|
155
161
|
keepColors?: boolean;
|
|
156
162
|
keepRepresentations?: boolean;
|
|
157
163
|
}) => Promise<void>;
|
|
164
|
+
/** Color the parts of sequence in the sequence panel defined by `data`. Color the rest of the sequence in `nonSelectedColor` if provided.
|
|
165
|
+
* If `structureId` or `structureNumber` is provided, apply to the specified structure (`structureNumber` numbered from 1!); otherwise apply to all loaded structures.
|
|
166
|
+
* Remove any previously added coloring, unless `keepColors` is set. */
|
|
167
|
+
sequenceColor: (params: {
|
|
168
|
+
data: (QueryParam & {
|
|
169
|
+
color?: AnyColor;
|
|
170
|
+
})[];
|
|
171
|
+
nonSelectedColor?: AnyColor;
|
|
172
|
+
theme?: {
|
|
173
|
+
name: string;
|
|
174
|
+
params?: any;
|
|
175
|
+
themeStrength?: number;
|
|
176
|
+
dilutionColor?: AnyColor;
|
|
177
|
+
};
|
|
178
|
+
structureId?: string;
|
|
179
|
+
structureNumber?: number;
|
|
180
|
+
keepColors?: boolean;
|
|
181
|
+
}) => Promise<void>;
|
|
182
|
+
/** Remove any sequence coloring previously added by the `sequenceColor` method.
|
|
183
|
+
* `structureNumberOrId` is either index (numbered from 1!) or the ID that was provided when loading the structure;
|
|
184
|
+
* if not provided, will apply to all loaded structures. */
|
|
185
|
+
clearSequenceColor: (structureNumberOrId?: number | string) => Promise<void>;
|
|
158
186
|
/** Add interactive tooltips to parts of the structure. The added tooltips will be shown on a separate line in the tooltip box.
|
|
159
187
|
* Repeated call to this function removes any previously added tooltips.
|
|
160
188
|
* `structureNumber` counts from 1; if not provided, tooltips will be applied to all loaded structures.
|
|
161
189
|
* Example: `await this.visual.tooltips({ data: [{ struct_asym_id: 'A', tooltip: 'Chain A' }, { struct_asym_id: 'B', tooltip: 'Chain B' }] });`. */
|
|
162
190
|
tooltips: (params: {
|
|
163
|
-
data: QueryParam
|
|
191
|
+
data: (QueryParam & {
|
|
192
|
+
tooltip?: string;
|
|
193
|
+
})[];
|
|
164
194
|
structureId?: string;
|
|
165
195
|
structureNumber?: number;
|
|
166
196
|
}) => Promise<void>;
|
package/lib/viewer.js
CHANGED
|
@@ -40,6 +40,7 @@ const mol_state_1 = require("molstar/lib/mol-state");
|
|
|
40
40
|
const element_symbol_1 = require("molstar/lib/mol-theme/color/element-symbol");
|
|
41
41
|
const assets_1 = require("molstar/lib/mol-util/assets");
|
|
42
42
|
const color_1 = require("molstar/lib/mol-util/color/color");
|
|
43
|
+
const names_1 = require("molstar/lib/mol-util/color/names");
|
|
43
44
|
const rx_event_helper_1 = require("molstar/lib/mol-util/rx-event-helper");
|
|
44
45
|
const custom_events_1 = require("./custom-events");
|
|
45
46
|
const behavior_4 = require("./domain-annotations/behavior");
|
|
@@ -51,6 +52,9 @@ const manager_1 = require("./extensions/state-gallery/manager");
|
|
|
51
52
|
const ui_1 = require("./extensions/state-gallery/ui");
|
|
52
53
|
const helpers_1 = require("./helpers");
|
|
53
54
|
const plugin_custom_state_1 = require("./plugin-custom-state");
|
|
55
|
+
const behavior_6 = require("./sequence-color/behavior");
|
|
56
|
+
const sequence_color_annotations_prop_1 = require("./sequence-color/sequence-color-annotations-prop");
|
|
57
|
+
const sequence_color_theme_prop_1 = require("./sequence-color/sequence-color-theme-prop");
|
|
54
58
|
const spec_2 = require("./spec");
|
|
55
59
|
const spec_from_html_1 = require("./spec-from-html");
|
|
56
60
|
const subscribe_events_1 = require("./subscribe-events");
|
|
@@ -308,6 +312,74 @@ class PDBeMolstarPlugin {
|
|
|
308
312
|
}
|
|
309
313
|
}
|
|
310
314
|
}),
|
|
315
|
+
/** Color the parts of sequence in the sequence panel defined by `data`. Color the rest of the sequence in `nonSelectedColor` if provided.
|
|
316
|
+
* If `structureId` or `structureNumber` is provided, apply to the specified structure (`structureNumber` numbered from 1!); otherwise apply to all loaded structures.
|
|
317
|
+
* Remove any previously added coloring, unless `keepColors` is set. */
|
|
318
|
+
sequenceColor: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
319
|
+
var _a, _b;
|
|
320
|
+
const structureNumberOrId = (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber;
|
|
321
|
+
const update = this.plugin.build();
|
|
322
|
+
for (const struct of this.getStructures(structureNumberOrId)) {
|
|
323
|
+
const propsCell = (_b = struct.structureRef.properties) === null || _b === void 0 ? void 0 : _b.cell;
|
|
324
|
+
if (!propsCell) {
|
|
325
|
+
console.warn(`Custom structure properties not found (structure node ref "${struct.structureRef.cell.transform.ref}")`);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (propsCell.transform.transformer.id !== model_1.CustomStructureProperties.id) {
|
|
329
|
+
console.warn(`Custom structure properties node is of wrong type "${propsCell.transform.transformer.id}"`);
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const newColors = [];
|
|
333
|
+
if (params.nonSelectedColor) {
|
|
334
|
+
newColors.push({
|
|
335
|
+
selector: { name: 'static', params: 'all' },
|
|
336
|
+
color: (0, helpers_1.normalizeColor)(params.nonSelectedColor),
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
for (const selection of this.getSelections(params.data, struct.number)) {
|
|
340
|
+
if (!selection.param.color)
|
|
341
|
+
continue;
|
|
342
|
+
newColors.push({
|
|
343
|
+
selector: { name: 'bundle', params: selection.bundle },
|
|
344
|
+
color: (0, helpers_1.normalizeColor)(selection.param.color),
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
update.to(propsCell).update(model_1.CustomStructureProperties, old => {
|
|
348
|
+
var _a, _b, _c, _d, _e, _f;
|
|
349
|
+
const annotProps = { colors: newColors };
|
|
350
|
+
const oldColors = (_b = (_a = old.properties) === null || _a === void 0 ? void 0 : _a[sequence_color_annotations_prop_1.SequenceColorAnnotationsProperty.Name]) === null || _b === void 0 ? void 0 : _b.colors;
|
|
351
|
+
if (params.keepColors && !params.nonSelectedColor && oldColors) {
|
|
352
|
+
annotProps.colors = oldColors.concat(newColors);
|
|
353
|
+
}
|
|
354
|
+
let themeProps;
|
|
355
|
+
if (params.theme) {
|
|
356
|
+
themeProps = {
|
|
357
|
+
useTheme: true,
|
|
358
|
+
theme: { name: params.theme.name, params: (_c = params.theme.params) !== null && _c !== void 0 ? _c : {} },
|
|
359
|
+
themeStrength: (_d = params.theme.themeStrength) !== null && _d !== void 0 ? _d : 1,
|
|
360
|
+
dilutionColor: (0, helpers_1.normalizeColor)(params.theme.dilutionColor, names_1.ColorNames.white),
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
else if (params.keepColors) {
|
|
364
|
+
themeProps = (_f = (_e = old.properties) === null || _e === void 0 ? void 0 : _e[sequence_color_theme_prop_1.SequenceColorThemeProperty.Name]) !== null && _f !== void 0 ? _f : { useTheme: false };
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
themeProps = { useTheme: false };
|
|
368
|
+
}
|
|
369
|
+
return Object.assign(Object.assign({}, old), { properties: Object.assign(Object.assign({}, old.properties), { [sequence_color_annotations_prop_1.SequenceColorAnnotationsProperty.Name]: annotProps, [sequence_color_theme_prop_1.SequenceColorThemeProperty.Name]: themeProps }) });
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
yield update.commit();
|
|
373
|
+
}),
|
|
374
|
+
/** Remove any sequence coloring previously added by the `sequenceColor` method.
|
|
375
|
+
* `structureNumberOrId` is either index (numbered from 1!) or the ID that was provided when loading the structure;
|
|
376
|
+
* if not provided, will apply to all loaded structures. */
|
|
377
|
+
clearSequenceColor: (structureNumberOrId) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
if (typeof structureNumberOrId === 'number')
|
|
379
|
+
yield this.visual.sequenceColor({ data: [], structureNumber: structureNumberOrId });
|
|
380
|
+
else
|
|
381
|
+
yield this.visual.sequenceColor({ data: [], structureId: structureNumberOrId });
|
|
382
|
+
}),
|
|
311
383
|
/** Add interactive tooltips to parts of the structure. The added tooltips will be shown on a separate line in the tooltip box.
|
|
312
384
|
* Repeated call to this function removes any previously added tooltips.
|
|
313
385
|
* `structureNumber` counts from 1; if not provided, tooltips will be applied to all loaded structures.
|
|
@@ -480,6 +552,7 @@ class PDBeMolstarPlugin {
|
|
|
480
552
|
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(pdbe_1.PDBeStructureQualityReport, { autoAttach: false, showTooltip: false }));
|
|
481
553
|
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(behavior_4.PDBeDomainAnnotations, { autoAttach: false, showTooltip: false }));
|
|
482
554
|
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(behavior_1.AssemblySymmetry));
|
|
555
|
+
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(behavior_6.SequenceColor));
|
|
483
556
|
pdbePluginSpec.config.push([behavior_1.AssemblySymmetryConfig.DefaultServerType, 'pdbe'], [behavior_1.AssemblySymmetryConfig.DefaultServerUrl, 'https://www.ebi.ac.uk/pdbe/aggregated-api/pdb/symmetry'], [behavior_1.AssemblySymmetryConfig.ApplyColors, false]);
|
|
484
557
|
if (this.initParams.galleryView) {
|
|
485
558
|
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(behavior_5.StateGallery));
|
|
@@ -541,6 +614,7 @@ class PDBeMolstarPlugin {
|
|
|
541
614
|
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowAnimation, false]);
|
|
542
615
|
if (this.initParams.hideCanvasControls.includes('trajectory'))
|
|
543
616
|
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowTrajectoryControls, false]);
|
|
617
|
+
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowXR, 'never']);
|
|
544
618
|
// override default event bindings
|
|
545
619
|
if (this.initParams.selectBindings) {
|
|
546
620
|
pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(representation_2.SelectLoci, { bindings: this.initParams.selectBindings }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdbe-molstar",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Molstar implementation for PDBe",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@types/d3": "^7.4.0",
|
|
53
53
|
"@types/react": "^18.0.17",
|
|
54
54
|
"@types/react-dom": "^18.0.6",
|
|
55
|
+
"@types/webxr": "^0.5.23",
|
|
55
56
|
"babel-loader": "^8.2.5",
|
|
56
57
|
"concurrently": "^7.3.0",
|
|
57
58
|
"cpx2": "^7.0.1",
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
"d3-scale": "^4.0.2",
|
|
79
80
|
"d3-selection": "^3.0.0",
|
|
80
81
|
"lit": "^3.1.1",
|
|
81
|
-
"molstar": "
|
|
82
|
+
"molstar": "5.0.0",
|
|
82
83
|
"path-browserify": "^1.0.1",
|
|
83
84
|
"stream-browserify": "^3.0.0",
|
|
84
85
|
"vm-browserify": "^1.1.2"
|
package/lib/ui/_layout.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PluginUIComponent } from 'molstar/lib/mol-plugin-ui/base';
|
|
2
|
-
type RegionKind = 'top' | 'left' | 'right' | 'bottom' | 'main';
|
|
3
|
-
/** Copy of `Layout` in molstar/src/mol-plugin-ui/plugin.tsx, TODO export from core Molstar and remove here */
|
|
4
|
-
export declare class Layout extends PluginUIComponent {
|
|
5
|
-
componentDidMount(): void;
|
|
6
|
-
region(kind: RegionKind, Element?: React.ComponentClass | React.FC): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
get layoutVisibilityClassName(): string;
|
|
8
|
-
get layoutClassName(): string;
|
|
9
|
-
onDrop: (ev: React.DragEvent<HTMLDivElement>) => void;
|
|
10
|
-
onDragOver: (ev: React.DragEvent<HTMLDivElement>) => void;
|
|
11
|
-
private showDragOverlay;
|
|
12
|
-
onDragEnter: (ev: React.DragEvent<HTMLDivElement>) => void;
|
|
13
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
}
|
|
15
|
-
export {};
|