@rcsb/rcsb-saguaro-3d
Version:
RCSB Molstar/Saguaro Web App
158 lines • 6.21 kB
JavaScript
const rowConfig = [{
trackId: "sequenceTrack",
trackHeight: 20,
trackColor: "#F9F9F9",
displayType: "sequence" /* RcsbFvDisplayTypes.SEQUENCE */,
nonEmptyDisplay: true,
rowTitle: "1ASH SEQUENCE",
trackData: [{
begin: 1,
label: "ANKTRELCMKSLEHAKVDTSNEARQDGIDLYKHMFENYPPLRKYFKSREEYTAEDVQNDPFFAKQGQKILLACHVLCATYDDRETFNAYTRELLDRHARDHVHMPPEVWTDFWKLFEEYLGKKTTLDEPTKQAWHEIGREFAKEINKHGR"
}]
}, {
trackId: "blockTrack",
trackHeight: 20,
trackColor: "#F9F9F9",
displayType: "block" /* RcsbFvDisplayTypes.BLOCK */,
displayColor: "#FF0000",
rowTitle: "1ASH",
trackData: [{
begin: 30,
end: 60
}]
}];
export const fvConfig1 = {
boardId: "1ash_board",
boardConfig: {
range: {
min: 1,
max: 150
},
rowTitleWidth: 190,
includeAxis: true
},
rowConfig: rowConfig,
sequenceSelectionChangeCallback: (plugin, stateManager, sequenceRegion) => {
stateManager.selectionState.clearSelection("select", { modelId: "structure_1", labelAsymId: "A" });
if (sequenceRegion.length > 0) {
const regions = sequenceRegion.map(r => {
var _a;
return ({
modelId: "structure_1",
labelAsymId: "A",
region: { begin: r.begin, end: (_a = r.end) !== null && _a !== void 0 ? _a : r.begin, source: "sequence" }
});
});
stateManager.selectionState.addSelectionFromMultipleRegions(regions, "select");
plugin.select(regions.map(r => (Object.assign(Object.assign({}, r), { begin: r.region.begin, end: r.region.end }))), "select", "set");
}
else {
plugin.clearSelection("select", { modelId: "structure_1", labelAsymId: "A" });
plugin.resetCamera();
}
},
sequenceElementClickCallback: (plugin, stateManager, d) => {
var _a;
if (d != null)
plugin.cameraFocus("structure_1", "A", d.begin, (_a = d.end) !== null && _a !== void 0 ? _a : d.begin);
},
sequenceHoverCallback: (plugin, stateManager, elements) => {
if (elements == null || elements.length == 0)
plugin.clearSelection("hover");
else
plugin.select(elements.map(e => {
var _a;
return ({
modelId: "structure_1",
labelAsymId: "A",
begin: e.begin,
end: (_a = e.end) !== null && _a !== void 0 ? _a : e.begin
});
}), "hover", "set");
},
structureSelectionCallback: (plugin, pfv, stateManager) => {
const sel = stateManager.selectionState.getSelectionWithCondition("structure_1", "A", "select");
if (sel == null) {
pfv.clearSelection("select");
plugin.resetCamera();
}
else {
pfv.setSelection({ elements: sel.regions, mode: "select" });
}
},
structureHoverCallback: (plugin, pfv, stateManager) => {
const sel = stateManager.selectionState.getSelectionWithCondition("structure_1", "A", "hover");
if (sel == null)
pfv.clearSelection("hover");
else
pfv.setSelection({ elements: sel.regions, mode: "hover" });
}
};
export const fvConfig2 = {
boardId: "1ash_board_bis",
boardConfig: {
range: {
min: 1,
max: 150
},
rowTitleWidth: 190,
includeAxis: true
},
rowConfig: rowConfig,
sequenceSelectionChangeCallback: (plugin, stateManager, sequenceRegion) => {
stateManager.selectionState.clearSelection("select", { modelId: "structure_2", labelAsymId: "A" });
if (sequenceRegion.length > 0) {
const regions = sequenceRegion.map(r => {
var _a;
return ({
modelId: "structure_2",
labelAsymId: "A",
region: { begin: r.begin, end: (_a = r.end) !== null && _a !== void 0 ? _a : r.begin, source: "sequence" }
});
});
stateManager.selectionState.addSelectionFromMultipleRegions(regions, "select");
plugin.select(regions.map(r => (Object.assign(Object.assign({}, r), { begin: r.region.begin, end: r.region.end }))), "select", "set");
}
else {
plugin.clearSelection("select", { modelId: "structure_2", labelAsymId: "A" });
plugin.resetCamera();
}
},
sequenceElementClickCallback: (plugin, stateManager, d) => {
var _a;
if (d != null)
plugin.cameraFocus("structure_2", "A", d.begin, (_a = d.end) !== null && _a !== void 0 ? _a : d.begin);
},
sequenceHoverCallback: (plugin, stateManager, elements) => {
if (elements == null || elements.length == 0)
plugin.clearSelection("hover");
else
plugin.select(elements.map(e => {
var _a;
return ({
modelId: "structure_2",
labelAsymId: "A",
begin: e.begin,
end: (_a = e.end) !== null && _a !== void 0 ? _a : e.begin
});
}), "hover", "set");
},
structureSelectionCallback: (plugin, pfv, stateManager) => {
const sel = stateManager.selectionState.getSelectionWithCondition("structure_2", "A", "select");
if (sel == null) {
pfv.clearSelection("select");
plugin.resetCamera();
}
else {
pfv.setSelection({ elements: sel.regions, mode: "select" });
}
},
structureHoverCallback: (plugin, pfv, stateManager) => {
const sel = stateManager.selectionState.getSelectionWithCondition("structure_2", "A", "hover");
if (sel == null)
pfv.clearSelection("hover");
else
pfv.setSelection({ elements: sel.regions, mode: "hover" });
}
};
//# sourceMappingURL=FeatureViewerConfig.js.map