pdbe-molstar 3.5.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.
- 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/alphafold-transparency.js +7 -8
- package/lib/extensions/complexes/coloring.d.ts +55 -0
- package/lib/extensions/complexes/coloring.js +129 -0
- package/lib/extensions/complexes/index.d.ts +70 -0
- package/lib/extensions/complexes/index.js +99 -0
- package/lib/extensions/complexes/superpose-by-biggest-chain.d.ts +15 -0
- package/lib/extensions/complexes/superpose-by-biggest-chain.js +141 -0
- package/lib/extensions/complexes/superpose-by-sequence-alignment.d.ts +10 -0
- package/lib/extensions/complexes/superpose-by-sequence-alignment.js +181 -0
- package/lib/helpers.d.ts +15 -1
- package/lib/helpers.js +119 -68
- package/lib/plugin-custom-state.d.ts +0 -2
- package/lib/sequence-color/behavior.d.ts +5 -0
- package/lib/sequence-color/behavior.js +54 -0
- package/lib/sequence-color/color.d.ts +11 -0
- package/lib/sequence-color/color.js +58 -0
- package/lib/sequence-color/prop.d.ts +38 -0
- package/lib/sequence-color/prop.js +38 -0
- package/lib/spec.d.ts +1 -1
- package/lib/styles/pdbe-molstar/_index.scss +7 -7
- package/lib/styles/pdbe-molstar-dark.scss +2 -2
- package/lib/styles/pdbe-molstar-light.scss +2 -2
- package/lib/superposition.d.ts +2 -2
- package/lib/superposition.js +41 -60
- package/lib/ui/alphafold-superposition.js +2 -2
- package/lib/ui/pdbe-viewport-controls.js +3 -4
- package/lib/ui/pdbe-viewport.d.ts +5 -1
- package/lib/ui/pdbe-viewport.js +23 -2
- package/lib/ui/split-ui/components.d.ts +1 -1
- package/lib/ui/split-ui/components.js +2 -2
- package/lib/viewer.d.ts +7 -1
- package/lib/viewer.js +27 -14
- package/package.json +3 -3
- package/lib/superposition-sifts-mapping.d.ts +0 -22
- package/lib/superposition-sifts-mapping.js +0 -153
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alignAndSuperposeWithSIFTSMapping = alignAndSuperposeWithSIFTSMapping;
|
|
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 element_1 = require("molstar/lib/mol-model/structure/structure/element");
|
|
7
|
-
const sifts_mapping_1 = require("./sifts-mapping");
|
|
8
|
-
function alignAndSuperposeWithSIFTSMapping(structures, options) {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
const indexMap = new Map();
|
|
11
|
-
for (let i = 0; i < structures.length; i++) {
|
|
12
|
-
let includeResidueTest = (_a = options === null || options === void 0 ? void 0 : options.includeResidueTest) !== null && _a !== void 0 ? _a : _includeAllResidues;
|
|
13
|
-
if ((options === null || options === void 0 ? void 0 : options.applyTestIndex) && !options.applyTestIndex.includes(i))
|
|
14
|
-
includeResidueTest = _includeAllResidues;
|
|
15
|
-
buildIndex(structures[i], indexMap, i, (_b = options === null || options === void 0 ? void 0 : options.traceOnly) !== null && _b !== void 0 ? _b : true, includeResidueTest);
|
|
16
|
-
}
|
|
17
|
-
const index = Array.from(indexMap.values());
|
|
18
|
-
// TODO: support non-first structure pivots
|
|
19
|
-
const pairs = findPairs(structures.length, index);
|
|
20
|
-
const zeroOverlapPairs = [];
|
|
21
|
-
const failedPairs = [];
|
|
22
|
-
const entries = [];
|
|
23
|
-
for (const p of pairs) {
|
|
24
|
-
if (p.count === 0) {
|
|
25
|
-
zeroOverlapPairs.push([p.i, p.j]);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const [a, b] = getPositionTables(index, p.i, p.j, p.count);
|
|
29
|
-
const transform = minimize_rmsd_1.MinimizeRmsd.compute({ a, b });
|
|
30
|
-
if (Number.isNaN(transform.rmsd)) {
|
|
31
|
-
failedPairs.push([p.i, p.j]);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
entries.push({ transform, pivot: p.i, other: p.j });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return { entries, zeroOverlapPairs, failedPairs };
|
|
39
|
-
}
|
|
40
|
-
function getPositionTables(index, pivot, other, N) {
|
|
41
|
-
const xs = minimize_rmsd_1.MinimizeRmsd.Positions.empty(N);
|
|
42
|
-
const ys = minimize_rmsd_1.MinimizeRmsd.Positions.empty(N);
|
|
43
|
-
let o = 0;
|
|
44
|
-
for (const { pivots } of index) {
|
|
45
|
-
const a = pivots[pivot];
|
|
46
|
-
const b = pivots[other];
|
|
47
|
-
if (!a || !b)
|
|
48
|
-
continue;
|
|
49
|
-
const l = Math.min(a[2] - a[1], b[2] - b[1]);
|
|
50
|
-
// TODO: check if residue types match?
|
|
51
|
-
for (let i = 0; i < l; i++) {
|
|
52
|
-
let eI = (a[1] + i);
|
|
53
|
-
xs.x[o] = a[0].conformation.x(eI);
|
|
54
|
-
xs.y[o] = a[0].conformation.y(eI);
|
|
55
|
-
xs.z[o] = a[0].conformation.z(eI);
|
|
56
|
-
eI = (b[1] + i);
|
|
57
|
-
ys.x[o] = b[0].conformation.x(eI);
|
|
58
|
-
ys.y[o] = b[0].conformation.y(eI);
|
|
59
|
-
ys.z[o] = b[0].conformation.z(eI);
|
|
60
|
-
o++;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return [xs, ys];
|
|
64
|
-
}
|
|
65
|
-
function findPairs(N, index) {
|
|
66
|
-
const pairwiseCounts = [];
|
|
67
|
-
for (let i = 0; i < N; i++) {
|
|
68
|
-
pairwiseCounts[i] = [];
|
|
69
|
-
for (let j = 0; j < N; j++)
|
|
70
|
-
pairwiseCounts[i][j] = 0;
|
|
71
|
-
}
|
|
72
|
-
for (const { pivots } of index) {
|
|
73
|
-
for (let i = 0; i < N; i++) {
|
|
74
|
-
if (!pivots[i])
|
|
75
|
-
continue;
|
|
76
|
-
const lI = pivots[i][2] - pivots[i][1];
|
|
77
|
-
for (let j = i + 1; j < N; j++) {
|
|
78
|
-
if (!pivots[j])
|
|
79
|
-
continue;
|
|
80
|
-
const lJ = pivots[j][2] - pivots[j][1];
|
|
81
|
-
pairwiseCounts[i][j] = pairwiseCounts[i][j] + Math.min(lI, lJ);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const ret = [];
|
|
86
|
-
for (let j = 1; j < N; j++) {
|
|
87
|
-
ret[j - 1] = { i: 0, j, count: pairwiseCounts[0][j] };
|
|
88
|
-
}
|
|
89
|
-
// TODO: support non-first structure pivots
|
|
90
|
-
// for (let i = 0; i < N - 1; i++) {
|
|
91
|
-
// let max = 0, maxJ = i;
|
|
92
|
-
// for (let j = i + 1; j < N; j++) {
|
|
93
|
-
// if (pairwiseCounts[i][j] > max) {
|
|
94
|
-
// maxJ = j;
|
|
95
|
-
// max = pairwiseCounts[i][j];
|
|
96
|
-
// }
|
|
97
|
-
// }
|
|
98
|
-
// ret[i] = { i, j: maxJ, count: max };
|
|
99
|
-
// }
|
|
100
|
-
return ret;
|
|
101
|
-
}
|
|
102
|
-
function _includeAllResidues() { return true; }
|
|
103
|
-
function buildIndex(structure, index, sI, traceOnly, includeTest) {
|
|
104
|
-
const loc = element_1.StructureElement.Location.create(structure);
|
|
105
|
-
for (const unit of structure.units) {
|
|
106
|
-
if (unit.kind !== 0 /* Unit.Kind.Atomic */)
|
|
107
|
-
continue;
|
|
108
|
-
const { elements, model } = unit;
|
|
109
|
-
loc.unit = unit;
|
|
110
|
-
const map = sifts_mapping_1.SIFTSMapping.Provider.get(model).value;
|
|
111
|
-
if (!map)
|
|
112
|
-
return;
|
|
113
|
-
const { dbName, accession, num } = map;
|
|
114
|
-
const chainsIt = int_1.Segmentation.transientSegments(unit.model.atomicHierarchy.chainAtomSegments, elements);
|
|
115
|
-
const residuesIt = int_1.Segmentation.transientSegments(unit.model.atomicHierarchy.residueAtomSegments, elements);
|
|
116
|
-
const traceElementIndex = unit.model.atomicHierarchy.derived.residue.traceElementIndex;
|
|
117
|
-
while (chainsIt.hasNext) {
|
|
118
|
-
const chainSegment = chainsIt.move();
|
|
119
|
-
residuesIt.setSegment(chainSegment);
|
|
120
|
-
while (residuesIt.hasNext) {
|
|
121
|
-
const residueSegment = residuesIt.move();
|
|
122
|
-
const rI = residueSegment.index;
|
|
123
|
-
if (!dbName[rI])
|
|
124
|
-
continue;
|
|
125
|
-
const traceElement = traceElementIndex[rI];
|
|
126
|
-
let start, end;
|
|
127
|
-
if (traceOnly) {
|
|
128
|
-
start = traceElement;
|
|
129
|
-
if (start === -1)
|
|
130
|
-
continue;
|
|
131
|
-
end = start + 1;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
start = elements[residueSegment.start];
|
|
135
|
-
end = elements[residueSegment.end - 1] + 1;
|
|
136
|
-
}
|
|
137
|
-
loc.element = (traceElement >= 0 ? traceElement : start);
|
|
138
|
-
if (!includeTest(loc, rI, start, end))
|
|
139
|
-
continue;
|
|
140
|
-
const key = `${dbName[rI]}-${accession[rI].split('-')[0]}-${num[rI]}`;
|
|
141
|
-
if (!index.has(key)) {
|
|
142
|
-
index.set(key, { key, pivots: { [sI]: [unit, start, end] } });
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
const entry = index.get(key);
|
|
146
|
-
if (!entry.pivots[sI]) {
|
|
147
|
-
entry.pivots[sI] = [unit, start, end];
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|