pdbe-molstar 3.6.0 → 3.7.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.
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.superposeBySequenceAlignment = superposeBySequenceAlignment;
4
+ const int_1 = require("molstar/lib/mol-data/int");
5
+ const minimize_rmsd_1 = require("molstar/lib/mol-math/linear-algebra/3d/minimize-rmsd");
6
+ const alignment_1 = require("molstar/lib/mol-model/sequence/alignment/alignment");
7
+ const structure_1 = require("molstar/lib/mol-model/structure");
8
+ const superposition_1 = require("molstar/lib/mol-model/structure/structure/util/superposition");
9
+ const helpers_1 = require("../../helpers");
10
+ /** Superpose structures based on the largest common component (measured the by number of residues), components being defined by `mappingsA` and `mappingsB`.
11
+ * Residue-residue correspondence is determined by sequence alignment. */
12
+ function superposeBySequenceAlignment(structA, structB, mappingsA, mappingsB) {
13
+ const sortedA = sortAccessionsAndUnits(structA, mappingsA);
14
+ const sortedB = sortAccessionsAndUnits(structB, mappingsB);
15
+ const bestMatch = bestMappingMatch(sortedA, sortedB);
16
+ if (!bestMatch) {
17
+ return undefined;
18
+ }
19
+ const accession = bestMatch.accession;
20
+ const lociA = helpers_1.QueryHelper.getInteractivityLoci(mappingsA[accession], structA);
21
+ const lociB = helpers_1.QueryHelper.getInteractivityLoci(mappingsB[accession], structB);
22
+ const superposition = alignAndSuperpose(lociA, lociB);
23
+ if (!isNaN(superposition.rmsd)) {
24
+ return Object.assign(Object.assign({}, superposition), { method: 'sequence-alignment', accession: bestMatch.accession });
25
+ }
26
+ else {
27
+ return undefined;
28
+ }
29
+ }
30
+ /** Sort units for each accession by decreasing size and sort accessions by decreasing biggest unit size. */
31
+ function sortAccessionsAndUnits(struct, mappings) {
32
+ const unitsByAccession = {};
33
+ for (const accession in mappings) {
34
+ const loci = helpers_1.QueryHelper.getInteractivityLoci(mappings[accession], struct);
35
+ const units = [];
36
+ for (const u of loci.elements) {
37
+ const unitId = u.unit.id.toString();
38
+ const elements = [];
39
+ int_1.OrderedSet.forEach(u.indices, elementUnitIndex => {
40
+ const elementIndex = u.unit.elements[elementUnitIndex];
41
+ if (int_1.SortedArray.has(u.unit.polymerElements, elementIndex))
42
+ elements.push(elementIndex);
43
+ });
44
+ units.push({ unitId, size: elements.length, elements: int_1.SortedArray.ofSortedArray(elements) });
45
+ }
46
+ units.sort((a, b) => b.size - a.size);
47
+ unitsByAccession[accession] = units;
48
+ }
49
+ return {
50
+ /** Accessions sorted by decreasing biggest unit size */
51
+ accessions: Object.keys(unitsByAccession).sort((a, b) => unitsByAccession[b][0].size - unitsByAccession[a][0].size),
52
+ /** Units per accession, sorted by decreasing unit size */
53
+ units: unitsByAccession,
54
+ };
55
+ }
56
+ function bestMappingMatch(sortedA, sortedB) {
57
+ let bestMatch = undefined;
58
+ let bestScore = 0;
59
+ for (const accession of sortedA.accessions) {
60
+ const unitsA = sortedA.units[accession];
61
+ const unitsB = sortedB.units[accession];
62
+ if (!unitsB)
63
+ continue;
64
+ for (const ua of unitsA) {
65
+ if (ua.size <= bestScore)
66
+ break;
67
+ for (const ub of unitsB) {
68
+ if (ub.size <= bestScore || ua.size <= bestScore)
69
+ break;
70
+ const score = Math.min(ua.size, ub.size);
71
+ if (score > bestScore) {
72
+ bestScore = score;
73
+ bestMatch = { accession, unitA: ua.unitId, unitB: ub.unitId, elementsA: ua.elements, elementsB: ub.elements, nMatchedElements: score };
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return bestMatch;
79
+ }
80
+ const reProtein = /(polypeptide|cyclic-pseudo-peptide)/i;
81
+ function alignAndSuperpose(lociA, lociB) {
82
+ const location = structure_1.StructureElement.Loci.getFirstLocation(lociA);
83
+ const subtype = structure_1.StructureProperties.entity.subtype(location);
84
+ const substMatrix = subtype.match(reProtein) ? 'blosum62' : 'default';
85
+ const { matchedA, matchedB } = computeAlignment(lociA.elements[0], lociB.elements[0], { substMatrix });
86
+ const n = int_1.OrderedSet.size(matchedA.indices);
87
+ const coordsA = (0, superposition_1.getPositionTable)(structure_1.StructureElement.Loci(lociA.structure, [matchedA]), n);
88
+ const coordsB = (0, superposition_1.getPositionTable)(structure_1.StructureElement.Loci(lociB.structure, [matchedB]), n);
89
+ const superposition = minimize_rmsd_1.MinimizeRmsd.compute({ a: coordsA, b: coordsB });
90
+ return Object.assign(Object.assign({}, superposition), { nAlignedElements: n });
91
+ // TODO remove explicit nAlignedElements, once in core Molstar
92
+ }
93
+ function computeAlignment(a, b, options = {}) {
94
+ const seqA = getSequenceFromLoci(a);
95
+ const seqB = getSequenceFromLoci(b);
96
+ const { aliA, aliB, score } = (0, alignment_1.align)(seqA.sequence.map(getOneLetterCode), seqB.sequence.map(getOneLetterCode), options);
97
+ const indicesA = [];
98
+ const indicesB = [];
99
+ let seqIdxA = 0, seqIdxB = 0;
100
+ for (let i = 0, n = aliA.length; i < n; ++i) {
101
+ if (aliA[i] !== '-' && aliB[i] !== '-') {
102
+ indicesA.push(seqA.unitElements[seqIdxA]);
103
+ indicesB.push(seqB.unitElements[seqIdxB]);
104
+ }
105
+ if (aliA[i] !== '-')
106
+ seqIdxA += 1;
107
+ if (aliB[i] !== '-')
108
+ seqIdxB += 1;
109
+ }
110
+ return {
111
+ matchedA: { unit: a.unit, indices: int_1.OrderedSet.ofSortedArray(indicesA) },
112
+ matchedB: { unit: b.unit, indices: int_1.OrderedSet.ofSortedArray(indicesB) },
113
+ score,
114
+ };
115
+ }
116
+ /** Extract sequence and array of corresponding trace atoms. */
117
+ function getSequenceFromLoci(loci) {
118
+ const { unit, indices } = loci;
119
+ const unitElements = [];
120
+ const sequence = [];
121
+ int_1.OrderedSet.forEach(indices, elementUnitIndex => {
122
+ const elementIndex = unit.elements[elementUnitIndex];
123
+ if (int_1.OrderedSet.has(unit.polymerElements, elementIndex)) {
124
+ unitElements.push(elementUnitIndex);
125
+ const compId = unit.model.atomicHierarchy.atoms.label_comp_id.value(elementIndex);
126
+ sequence.push(compId);
127
+ }
128
+ });
129
+ return { sequence, unitElements };
130
+ }
131
+ function getOneLetterCode(compId) {
132
+ var _a;
133
+ return (_a = OneLetterCodes[compId]) !== null && _a !== void 0 ? _a : 'X';
134
+ }
135
+ // Copied from Molstar
136
+ const OneLetterCodes = {
137
+ 'HIS': 'H',
138
+ 'ARG': 'R',
139
+ 'LYS': 'K',
140
+ 'ILE': 'I',
141
+ 'PHE': 'F',
142
+ 'LEU': 'L',
143
+ 'TRP': 'W',
144
+ 'ALA': 'A',
145
+ 'MET': 'M',
146
+ 'PRO': 'P',
147
+ 'CYS': 'C',
148
+ 'ASN': 'N',
149
+ 'VAL': 'V',
150
+ 'GLY': 'G',
151
+ 'SER': 'S',
152
+ 'GLN': 'Q',
153
+ 'TYR': 'Y',
154
+ 'ASP': 'D',
155
+ 'GLU': 'E',
156
+ 'THR': 'T',
157
+ 'SEC': 'U', // as per IUPAC definition
158
+ 'PYL': 'O', // as per IUPAC definition
159
+ // charmm ff
160
+ 'HSD': 'H', 'HSE': 'H', 'HSP': 'H',
161
+ 'LSN': 'K',
162
+ 'ASPP': 'D',
163
+ 'GLUP': 'E',
164
+ // amber ff
165
+ 'HID': 'H', 'HIE': 'H', 'HIP': 'H',
166
+ 'LYN': 'K',
167
+ 'ASH': 'D',
168
+ 'GLH': 'E',
169
+ // DNA
170
+ 'DA': 'A',
171
+ 'DC': 'C',
172
+ 'DG': 'G',
173
+ 'DT': 'T',
174
+ 'DU': 'U',
175
+ // RNA
176
+ 'A': 'A',
177
+ 'C': 'C',
178
+ 'G': 'G',
179
+ 'T': 'T',
180
+ 'U': 'U',
181
+ };
package/lib/helpers.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Mat3, Mat4 } from 'molstar/lib/mol-math/linear-algebra';
3
3
  import { Model, Structure } from 'molstar/lib/mol-model/structure';
4
4
  import { BuiltInTrajectoryFormat } from 'molstar/lib/mol-plugin-state/formats/trajectory';
5
5
  import { StructureRef } from 'molstar/lib/mol-plugin-state/manager/structure/hierarchy-state';
6
+ import { InitVolumeStreaming } from 'molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers';
6
7
  import { PluginConfigItem } from 'molstar/lib/mol-plugin/config';
7
8
  import { PluginContext } from 'molstar/lib/mol-plugin/context';
8
9
  import { PluginLayoutStateProps } from 'molstar/lib/mol-plugin/layout';
@@ -22,9 +23,15 @@ export interface LoadParams {
22
23
  id?: string;
23
24
  }
24
25
  export interface MapParams {
26
+ /** Volume streaming view type (`'off' | 'box' | 'selection-box' | 'camera-target' | 'cell' | 'auto'`) */
27
+ defaultView?: PDBeVolumes.InitVolumeStreamingProps['defaultView'];
28
+ /** Style for EM map */
25
29
  'em'?: MapStyle;
30
+ /** Style for X-ray 2Fo-Fc map */
26
31
  '2fo-fc'?: MapStyle;
32
+ /** Style for X-ray Fo-Fc(+ve) map */
27
33
  'fo-fc(+ve)'?: MapStyle;
34
+ /** Style for X-ray Fo-Fc(-ve) map */
28
35
  'fo-fc(-ve)'?: MapStyle;
29
36
  }
30
37
  interface MapStyle {
@@ -32,7 +39,8 @@ interface MapStyle {
32
39
  wireframe?: boolean;
33
40
  }
34
41
  export declare namespace PDBeVolumes {
35
- function mapParams(defaultParams: any, mapParams?: MapParams, ref?: string | number): any;
42
+ type InitVolumeStreamingProps = ReturnType<(typeof InitVolumeStreaming)['createDefaultParams']>;
43
+ function mapParams(defaultParams: InitVolumeStreamingProps, mapParams?: MapParams): InitVolumeStreamingProps;
36
44
  function displayUsibilityMessage(plugin: PluginContext): void;
37
45
  function toggle(plugin: PluginContext): void;
38
46
  }
@@ -88,6 +96,8 @@ export interface QueryParam {
88
96
  uniprot_residue_number?: number;
89
97
  start_uniprot_residue_number?: number;
90
98
  end_uniprot_residue_number?: number;
99
+ /** List of element type symbols (e.g. ['C', 'N', 'FE']) */
100
+ type_symbol?: string[];
91
101
  }
92
102
  export declare function queryParamsToMvsComponentExpressions(params: QueryParam[]): ComponentExpressionT[];
93
103
  export declare namespace QueryHelper {
package/lib/helpers.js CHANGED
@@ -34,9 +34,12 @@ const sleep_1 = require("molstar/lib/mol-util/sleep");
34
34
  const sifts_mapping_1 = require("./sifts-mapping");
35
35
  var PDBeVolumes;
36
36
  (function (PDBeVolumes) {
37
- function mapParams(defaultParams, mapParams, ref) {
37
+ function mapParams(defaultParams, mapParams) {
38
38
  const pdbeParams = Object.assign({}, defaultParams);
39
- pdbeParams.options.behaviorRef = 'volume-streaming' + '' + Math.floor(Math.random() * Math.floor(100));
39
+ if (mapParams === null || mapParams === void 0 ? void 0 : mapParams.defaultView) {
40
+ pdbeParams.defaultView = mapParams.defaultView;
41
+ }
42
+ pdbeParams.options.behaviorRef = `volume-streaming${Math.floor(Math.random() * 100)}`;
40
43
  pdbeParams.options.emContourProvider = 'pdbe';
41
44
  pdbeParams.options.serverUrl = 'https://www.ebi.ac.uk/pdbe/volume-server';
42
45
  const MAIN_MAP_DEFAULTS = { opacity: 0.49, wireframe: false };
@@ -152,7 +155,7 @@ var LigandView;
152
155
  LigandView.branchedQuery = branchedQuery;
153
156
  })(LigandView || (exports.LigandView = LigandView = {}));
154
157
  function queryParamsToMvsComponentExpressions(params) {
155
- const broadcasted = broadcast(params, ['atoms', 'atom_id']);
158
+ const broadcasted = broadcast(params, ['atoms', 'atom_id', 'type_symbol']);
156
159
  return broadcasted.map(item => {
157
160
  var _a;
158
161
  return ({
@@ -168,7 +171,7 @@ function queryParamsToMvsComponentExpressions(params) {
168
171
  end_auth_seq_id: item.end_auth_residue_number,
169
172
  label_atom_id: item.atoms,
170
173
  auth_atom_id: undefined,
171
- type_symbol: undefined,
174
+ type_symbol: item.type_symbol,
172
175
  atom_id: item.atom_id,
173
176
  atom_index: undefined,
174
177
  label_comp_id: item.label_comp_id,
@@ -282,6 +285,9 @@ var QueryHelper;
282
285
  if (param.atom_id) {
283
286
  predicates.atom.push(l => param.atom_id.includes(structure_1.StructureProperties.atom.id(l.element)));
284
287
  }
288
+ if (param.type_symbol) {
289
+ predicates.atom.push(l => param.type_symbol.includes(structure_1.StructureProperties.atom.type_symbol(l.element)));
290
+ }
285
291
  selections.push({
286
292
  entityTest: predicateConjunction(predicates.entity),
287
293
  chainTest: predicateConjunction(predicates.chain),
@@ -289,7 +295,7 @@ var QueryHelper;
289
295
  atomTest: predicateConjunction(predicates.atom),
290
296
  });
291
297
  }
292
- const atmGroupsQueries = selections.map(selection => structure_1.Queries.generators.atoms(selection));
298
+ const atmGroupsQueries = selections.map(selection => structure_1.Queries.modifiers.union(structure_1.Queries.generators.atoms(selection)));
293
299
  return structure_1.Queries.combinators.merge(atmGroupsQueries);
294
300
  }
295
301
  QueryHelper.getQueryObject = getQueryObject;
@@ -1,4 +1,3 @@
1
- import { SymmetryOperator } from 'molstar/lib/mol-math/geometry';
2
1
  import { Mat4 } from 'molstar/lib/mol-math/linear-algebra';
3
2
  import { PluginContext } from 'molstar/lib/mol-plugin/context';
4
3
  import { StateSelection, StateTransform } from 'molstar/lib/mol-state';
@@ -55,7 +54,6 @@ export interface PluginCustomState {
55
54
  visibility: boolean[];
56
55
  transforms: Mat4[];
57
56
  rmsds: string[][];
58
- coordinateSystems: (SymmetryOperator | undefined)[];
59
57
  };
60
58
  };
61
59
  superpositionError?: string;
@@ -0,0 +1,5 @@
1
+ import { PluginBehavior } from 'molstar/lib/mol-plugin/behavior';
2
+ /** Allows coloring residues in sequence panel */
3
+ export declare const SequenceColor: import("molstar/lib/mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {
4
+ autoAttach: boolean;
5
+ }>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SequenceColor = void 0;
4
+ const model_1 = require("molstar/lib/mol-plugin-state/transforms/model");
5
+ const context_1 = require("molstar/lib/mol-plugin-ui/context");
6
+ const behavior_1 = require("molstar/lib/mol-plugin/behavior");
7
+ const param_definition_1 = require("molstar/lib/mol-util/param-definition");
8
+ const rxjs_1 = require("rxjs");
9
+ const color_1 = require("./color");
10
+ const prop_1 = require("./prop");
11
+ /** Allows coloring residues in sequence panel */
12
+ exports.SequenceColor = behavior_1.PluginBehavior.create({
13
+ name: 'sequence-color',
14
+ category: 'misc',
15
+ display: {
16
+ name: 'Sequence Color',
17
+ description: 'Sequence Color extension, allows assigning custom residue colors to be shown in the sequence panel, based on a custom structure property',
18
+ },
19
+ ctor: class extends behavior_1.PluginBehavior.Handler {
20
+ register() {
21
+ var _a, _b;
22
+ this.ctx.customStructureProperties.register(prop_1.SequenceColorProperty.Provider, this.params.autoAttach);
23
+ if (this.ctx instanceof context_1.PluginUIContext) {
24
+ const customUIState = (_a = this.ctx.customUIState) !== null && _a !== void 0 ? _a : {}; // TODO remove this hack once `customUIState` is available in core Molstar
25
+ const theme = (_b = customUIState.experimentalSequenceColorTheme) !== null && _b !== void 0 ? _b : (customUIState.experimentalSequenceColorTheme = new rxjs_1.BehaviorSubject(undefined));
26
+ this.sub = this.ctx.state.events.cell.stateUpdated.subscribe(s => {
27
+ if (s.cell.transform.transformer === model_1.CustomStructureProperties) {
28
+ theme.next(color_1.CustomSequenceColorTheme.Provider);
29
+ }
30
+ });
31
+ }
32
+ }
33
+ update(p) {
34
+ const updated = this.params.autoAttach !== p.autoAttach;
35
+ this.params.autoAttach = p.autoAttach;
36
+ this.ctx.customStructureProperties.setDefaultAutoAttach(prop_1.SequenceColorProperty.Provider.descriptor.name, this.params.autoAttach);
37
+ return updated;
38
+ }
39
+ unregister() {
40
+ var _a, _b;
41
+ this.ctx.customStructureProperties.unregister(prop_1.SequenceColorProperty.Provider.descriptor.name);
42
+ (_a = this.sub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
43
+ this.sub = undefined;
44
+ if (this.ctx instanceof context_1.PluginUIContext) {
45
+ const customUIState = (_b = this.ctx.customUIState) !== null && _b !== void 0 ? _b : {}; // TODO remove this hack once `customUIState` is available in core Molstar
46
+ const theme = customUIState.experimentalSequenceColorTheme;
47
+ theme === null || theme === void 0 ? void 0 : theme.next(undefined);
48
+ }
49
+ }
50
+ },
51
+ params: () => ({
52
+ autoAttach: param_definition_1.ParamDefinition.Boolean(true),
53
+ }),
54
+ });
@@ -0,0 +1,11 @@
1
+ import { ColorTheme } from 'molstar/lib/mol-theme/color';
2
+ import { ThemeDataContext } from 'molstar/lib/mol-theme/theme';
3
+ import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
4
+ export declare namespace CustomSequenceColorTheme {
5
+ const Params: {};
6
+ type Params = typeof Params;
7
+ type Props = PD.Values<Params>;
8
+ function Theme(ctx: ThemeDataContext, props: Props): ColorTheme<Props>;
9
+ /** A thingy that is needed to register color theme "MVS Annotation" */
10
+ const Provider: ColorTheme.Provider<Params, 'custom-sequence-color'>;
11
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomSequenceColorTheme = void 0;
4
+ const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
5
+ const structure_1 = require("molstar/lib/mol-model/structure");
6
+ const color_1 = require("molstar/lib/mol-util/color");
7
+ const param_definition_1 = require("molstar/lib/mol-util/param-definition");
8
+ const prop_1 = require("./prop");
9
+ /** Special color value meaning "no color assigned" */
10
+ const NoColor = (0, color_1.Color)(-1);
11
+ var CustomSequenceColorTheme;
12
+ (function (CustomSequenceColorTheme) {
13
+ 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
+ }
22
+ return {
23
+ factory: Theme,
24
+ granularity: 'groupInstance',
25
+ color: color,
26
+ props: props,
27
+ description: 'Assigns colors based on custom structure property `SequenceColorProperty`.',
28
+ };
29
+ }
30
+ CustomSequenceColorTheme.Theme = Theme;
31
+ /** A thingy that is needed to register color theme "MVS Annotation" */
32
+ CustomSequenceColorTheme.Provider = {
33
+ name: 'custom-sequence-color',
34
+ label: 'Custom Sequence Color',
35
+ category: 'Miscellaneous',
36
+ factory: Theme,
37
+ getParams: ctx => CustomSequenceColorTheme.Params,
38
+ defaultValues: param_definition_1.ParamDefinition.getDefaultValues(CustomSequenceColorTheme.Params),
39
+ isApplicable: (ctx) => !!ctx.structure,
40
+ };
41
+ })(CustomSequenceColorTheme || (exports.CustomSequenceColorTheme = CustomSequenceColorTheme = {}));
42
+ function sequenceColorForLocation(colorData, location) {
43
+ var _a, _b;
44
+ var _c, _d, _e;
45
+ const unitCache = (_a = (_c = colorData.colorCache)[_d = location.unit.id]) !== null && _a !== void 0 ? _a : (_c[_d] = {});
46
+ return (_b = unitCache[_e = location.element]) !== null && _b !== void 0 ? _b : (unitCache[_e] = findSequenceColorForLocation(colorData, location));
47
+ }
48
+ function findSequenceColorForLocation(colorData, location) {
49
+ var _a;
50
+ for (let i = colorData.items.length - 1; i >= 0; i--) { // last color matters
51
+ const item = colorData.items[i];
52
+ const elements = (_a = item.elementSet) !== null && _a !== void 0 ? _a : (item.elementSet = selector_1.ElementSet.fromSelector(location.structure, item.selector));
53
+ if (selector_1.ElementSet.has(elements, location)) {
54
+ return item.color;
55
+ }
56
+ }
57
+ return NoColor;
58
+ }
@@ -0,0 +1,38 @@
1
+ import { ElementSet, Selector } from 'molstar/lib/extensions/mvs/components/selector';
2
+ import { CustomStructureProperty } from 'molstar/lib/mol-model-props/common/custom-structure-property';
3
+ import { ElementIndex } from 'molstar/lib/mol-model/structure';
4
+ import { Color } from 'molstar/lib/mol-util/color';
5
+ import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
6
+ export declare namespace SequenceColorProperty {
7
+ /** Parameter definition for custom structure property `SequenceColorProperty` */
8
+ type Params = typeof Params;
9
+ const Params: {
10
+ colors: PD.ObjectList<PD.Normalize<{
11
+ color: Color;
12
+ 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<{
13
+ annotationId: string;
14
+ fieldName: string;
15
+ fieldValues: PD.NamedParams<PD.Normalize<unknown>, "all"> | PD.NamedParams<PD.Normalize<{
16
+ value: any;
17
+ }>[], "selected">;
18
+ }>, "annotation">;
19
+ }>>;
20
+ };
21
+ /** Parameter values of custom structure property `SequenceColorProperty` */
22
+ type Props = PD.Values<Params>;
23
+ /** Values of custom structure property `SequenceColorProperty` */
24
+ interface Data {
25
+ items: {
26
+ selector: Selector;
27
+ color: Color;
28
+ elementSet?: ElementSet;
29
+ }[];
30
+ colorCache: {
31
+ [unitId: number]: {
32
+ [elemIdx: ElementIndex]: Color;
33
+ };
34
+ };
35
+ }
36
+ /** Provider for custom structure property `SequenceColorProperty` */
37
+ const Provider: CustomStructureProperty.Provider<Params, Data>;
38
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SequenceColorProperty = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
6
+ const custom_structure_property_1 = require("molstar/lib/mol-model-props/common/custom-structure-property");
7
+ const custom_property_1 = require("molstar/lib/mol-model/custom-property");
8
+ const color_1 = require("molstar/lib/mol-util/color");
9
+ const names_1 = require("molstar/lib/mol-util/color/names");
10
+ const param_definition_1 = require("molstar/lib/mol-util/param-definition");
11
+ var SequenceColorProperty;
12
+ (function (SequenceColorProperty) {
13
+ SequenceColorProperty.Params = {
14
+ colors: param_definition_1.ParamDefinition.ObjectList({
15
+ color: param_definition_1.ParamDefinition.Color(names_1.ColorNames.grey, { description: 'Color to apply to a substructure' }),
16
+ selector: selector_1.SelectorParams,
17
+ }, obj => color_1.Color.toHexStyle(obj.color), { description: 'List of substructure-color assignments' }),
18
+ };
19
+ /** Provider for custom structure property `SequenceColorProperty` */
20
+ SequenceColorProperty.Provider = custom_structure_property_1.CustomStructureProperty.createProvider({
21
+ label: 'Sequence Color',
22
+ descriptor: (0, custom_property_1.CustomPropertyDescriptor)({
23
+ name: 'sequence-color',
24
+ }),
25
+ type: 'root',
26
+ defaultParams: SequenceColorProperty.Params,
27
+ getParams: (data) => SequenceColorProperty.Params,
28
+ isApplicable: (data) => data.root === data,
29
+ 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(SequenceColorProperty.Params)), props);
31
+ const items = fullProps.colors.map(t => ({
32
+ selector: t.selector,
33
+ color: t.color,
34
+ }));
35
+ return { value: { items, colorCache: {} } };
36
+ }),
37
+ });
38
+ })(SequenceColorProperty || (exports.SequenceColorProperty = SequenceColorProperty = {}));
@@ -8,8 +8,8 @@ import { ClusterMember } from './plugin-custom-state';
8
8
  export declare const SuperpositionColorPalette: ColorListEntry[];
9
9
  export declare function getNextColor(plugin: PluginContext, segmentIndex: number): ColorListEntry;
10
10
  export declare function initSuperposition(plugin: PluginContext, completeSubject?: Subject<boolean>): Promise<void>;
11
- export declare function loadAfStructure(plugin: PluginContext): Promise<string | false>;
12
- export declare function superposeAf(plugin: PluginContext, traceOnly: boolean, segmentIndex?: number): Promise<true | undefined>;
11
+ export declare function loadAfStructure(plugin: PluginContext): Promise<string | undefined>;
12
+ export declare function superposeAf(plugin: PluginContext, traceOnly: boolean): Promise<boolean>;
13
13
  export declare function renderSuperposition(plugin: PluginContext, segmentIndex: number, entryList: ClusterMember[]): Promise<void>;
14
14
  /** Apply tranformation to a structure. Only use once per structure, combining multiple transformations is not implemented. */
15
15
  export declare function transform(plugin: PluginContext, s: StateObjectRef<PSO.Molecule.Structure>, matrix: Mat4): Promise<StateObjectSelector<PSO.Molecule.Structure, import("molstar/lib/mol-state").StateTransformer<import("molstar/lib/mol-state").StateObject<any, import("molstar/lib/mol-state").StateObject.Type<any>>, import("molstar/lib/mol-state").StateObject<any, import("molstar/lib/mol-state").StateObject.Type<any>>, any>>>;