|
@@ -13,7 +13,6 @@ import {
|
|
|
LoadMolstarInterface, LoadMolstarReturnType
|
|
|
} from "../../RcsbFvStructure/StructureViewers/MolstarViewer/MolstarActionManager";
|
|
|
import {RcsbFvStateManager} from "../../RcsbFvState/RcsbFvStateManager";
|
|
|
-import { pdbEntry } from ".";
|
|
|
|
|
|
export const rowConfig: Array<RcsbFvRowConfigInterface> = [
|
|
|
{
|
|
@@ -32,74 +31,76 @@ export const rowConfig: Array<RcsbFvRowConfigInterface> = [
|
|
|
}
|
|
|
];
|
|
|
|
|
|
-// TODO: must be set by a more clever way
|
|
|
-const modelId = `1afo_model`;
|
|
|
-console.log('PDBENTRY:', pdbEntry);
|
|
|
|
|
|
-export const fvConfig: FeatureViewInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType> = {
|
|
|
- boardId: `${pdbEntry}_board`,
|
|
|
- boardConfig: {
|
|
|
- rowTitleWidth: 190,
|
|
|
- includeAxis: true
|
|
|
- },
|
|
|
- rowConfig: rowConfig,
|
|
|
- sequenceSelectionChangeCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, sequenceRegion: Array<RcsbFvTrackDataElementInterface>) => {
|
|
|
- stateManager.selectionState.clearSelection("select", {modelId: modelId, labelAsymId:"A"});
|
|
|
- if(sequenceRegion.length > 0) {
|
|
|
- const regions = sequenceRegion.map(r => ({
|
|
|
- modelId: modelId,
|
|
|
- labelAsymId: "A",
|
|
|
- region: {begin: r.begin, end: r.end ?? r.begin, source: "sequence"} as RegionSelectionInterface
|
|
|
- }));
|
|
|
- stateManager.selectionState.addSelectionFromMultipleRegions(regions, "select");
|
|
|
- plugin.select(regions.map(r => ({
|
|
|
- ...r,
|
|
|
- begin: r.region.begin,
|
|
|
- end: r.region.end
|
|
|
- })), "select", "set");
|
|
|
- }else{
|
|
|
- plugin.clearSelection("select", {modelId: modelId, labelAsymId: "A"})
|
|
|
- plugin.resetCamera();
|
|
|
- }
|
|
|
- },
|
|
|
- sequenceElementClickCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, d: RcsbFvTrackDataElementInterface) => {
|
|
|
- if(d!=null)
|
|
|
- plugin.cameraFocus(modelId, "A", d.begin, d.end ?? d.begin);
|
|
|
- },
|
|
|
- sequenceHoverCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, elements: Array<RcsbFvTrackDataElementInterface>) => {
|
|
|
- console.log('HOEVER...', elements);
|
|
|
- if(elements == null || elements.length == 0)
|
|
|
- plugin.clearSelection("hover");
|
|
|
- else {
|
|
|
- const e = elements[0];
|
|
|
- console.log({
|
|
|
+export function createFeatureViewerConfing(pdbEntry: string, labelAsymId: string) {
|
|
|
+ const modelId = `${pdbEntry}_model`;
|
|
|
+
|
|
|
+ const fvConfig: FeatureViewInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType> = {
|
|
|
+ boardId: `${pdbEntry}_board`,
|
|
|
+ boardConfig: {
|
|
|
+ rowTitleWidth: 190,
|
|
|
+ includeAxis: true
|
|
|
+ },
|
|
|
+ rowConfig: rowConfig,
|
|
|
+ sequenceSelectionChangeCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, sequenceRegion: Array<RcsbFvTrackDataElementInterface>) => {
|
|
|
+ stateManager.selectionState.clearSelection("select", {modelId: modelId, labelAsymId: labelAsymId});
|
|
|
+ if(sequenceRegion.length > 0) {
|
|
|
+ const regions = sequenceRegion.map(r => ({
|
|
|
+ modelId: modelId,
|
|
|
+ labelAsymId: labelAsymId,
|
|
|
+ region: {begin: r.begin, end: r.end ?? r.begin, source: "sequence"} as RegionSelectionInterface
|
|
|
+ }));
|
|
|
+ stateManager.selectionState.addSelectionFromMultipleRegions(regions, "select");
|
|
|
+ plugin.select(regions.map(r => ({
|
|
|
+ ...r,
|
|
|
+ begin: r.region.begin,
|
|
|
+ end: r.region.end
|
|
|
+ })), "select", "set");
|
|
|
+ }else{
|
|
|
+ plugin.clearSelection("select", {modelId: modelId, labelAsymId: labelAsymId})
|
|
|
+ plugin.resetCamera();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sequenceElementClickCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, d: RcsbFvTrackDataElementInterface) => {
|
|
|
+ if(d!=null)
|
|
|
+ plugin.cameraFocus(modelId, "A", d.begin, d.end ?? d.begin);
|
|
|
+ },
|
|
|
+ sequenceHoverCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, stateManager: RcsbFvStateManager, elements: Array<RcsbFvTrackDataElementInterface>) => {
|
|
|
+ console.log('HOEVER...', elements);
|
|
|
+ if(elements == null || elements.length == 0)
|
|
|
+ plugin.clearSelection("hover");
|
|
|
+ else {
|
|
|
+ const e = elements[0];
|
|
|
+ console.log({
|
|
|
+ modelId: modelId,
|
|
|
+ labelAsymId: labelAsymId,
|
|
|
+ begin: e.begin,
|
|
|
+ end: e.end ?? e.begin
|
|
|
+ });
|
|
|
+ plugin.select(elements.map(e=>({
|
|
|
modelId: modelId,
|
|
|
- labelAsymId: "A",
|
|
|
+ labelAsymId: labelAsymId,
|
|
|
begin: e.begin,
|
|
|
end: e.end ?? e.begin
|
|
|
- });
|
|
|
- plugin.select(elements.map(e=>({
|
|
|
- modelId: modelId,
|
|
|
- labelAsymId: "A",
|
|
|
- begin: e.begin,
|
|
|
- end: e.end ?? e.begin
|
|
|
- })), "hover", "set");
|
|
|
- }
|
|
|
- },
|
|
|
- structureSelectionCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, pfv: RcsbFv, stateManager: RcsbFvStateManager) => {
|
|
|
- const sel: SaguaroRegionList | undefined = stateManager.selectionState.getSelectionWithCondition(modelId, "A", "select");
|
|
|
- if(sel == null) {
|
|
|
- pfv.clearSelection("select");
|
|
|
- plugin.resetCamera();
|
|
|
- }else {
|
|
|
- pfv.setSelection({elements: sel.regions, mode: "select"});
|
|
|
+ })), "hover", "set");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ structureSelectionCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, pfv: RcsbFv, stateManager: RcsbFvStateManager) => {
|
|
|
+ const sel: SaguaroRegionList | undefined = stateManager.selectionState.getSelectionWithCondition(modelId, "A", "select");
|
|
|
+ if(sel == null) {
|
|
|
+ pfv.clearSelection("select");
|
|
|
+ plugin.resetCamera();
|
|
|
+ }else {
|
|
|
+ pfv.setSelection({elements: sel.regions, mode: "select"});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ structureHoverCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, pfv: RcsbFv, stateManager: RcsbFvStateManager) => {
|
|
|
+ const sel: SaguaroRegionList | undefined = stateManager.selectionState.getSelectionWithCondition(modelId, "A", "hover");
|
|
|
+ if(sel == null)
|
|
|
+ pfv.clearSelection("hover");
|
|
|
+ else
|
|
|
+ pfv.setSelection({elements:sel.regions, mode:"hover"});
|
|
|
}
|
|
|
- },
|
|
|
- structureHoverCallback: (plugin: StructureViewerPublicInterface<LoadMolstarInterface<unknown,unknown>,LoadMolstarReturnType>, pfv: RcsbFv, stateManager: RcsbFvStateManager) => {
|
|
|
- const sel: SaguaroRegionList | undefined = stateManager.selectionState.getSelectionWithCondition(modelId, "A", "hover");
|
|
|
- if(sel == null)
|
|
|
- pfv.clearSelection("hover");
|
|
|
- else
|
|
|
- pfv.setSelection({elements:sel.regions, mode:"hover"});
|
|
|
}
|
|
|
+ return fvConfig;
|
|
|
}
|