|
@@ -1,42 +1,65 @@
|
|
|
-import {RcsbFv3DCustom, RcsbFv3DCustomInterface} from "../../RcsbFv3D/RcsbFv3DCustom";
|
|
|
+import { RcsbFv3DCustomInterface} from "../../RcsbFv3D/RcsbFv3DCustom";
|
|
|
import { DebugUtil } from "./tmdet-extension/debug-utils";
|
|
|
import { createFeatureViewerConfing } from "./FeatureViewConfig";
|
|
|
import { registerRegionDescriptorData } from "./UniTmpHelper";
|
|
|
+import { TmFv3DCustom } from "./tmdet-viewer/TmFv3DCustom";
|
|
|
|
|
|
export { DebugUtil };
|
|
|
|
|
|
-document.addEventListener("DOMContentLoaded", (event) => {
|
|
|
- (async function(event) {
|
|
|
-
|
|
|
- DebugUtil.enableLog();
|
|
|
-
|
|
|
- const pdbEntry = "6f7h";
|
|
|
- const labelAsymId = "C";
|
|
|
- const params = {
|
|
|
- side1: "Inside",
|
|
|
- htpEntry: "AQP10_HUMAN",
|
|
|
- pdbEntry: pdbEntry,
|
|
|
- labelAsymId: labelAsymId,
|
|
|
- pdbtmEntry: `${pdbEntry}_${labelAsymId}`
|
|
|
- };
|
|
|
-
|
|
|
- const descriptorUrl = `/${pdbEntry}.json`;
|
|
|
- registerRegionDescriptorData(descriptorUrl, params.side1 as any);
|
|
|
-
|
|
|
- const { sequenceConfig, molstarConfig } = await createFeatureViewerConfing(params);
|
|
|
- const panel3dConfig: RcsbFv3DCustomInterface = {
|
|
|
- elementId: "null",
|
|
|
- sequencePanelConfig: sequenceConfig,
|
|
|
- structurePanelConfig: molstarConfig
|
|
|
- };
|
|
|
- molstarConfig.structureViewerConfig.viewerProps.layoutShowSequence = true;
|
|
|
- (molstarConfig as any).loadConfig.loadParams.params = {
|
|
|
- preset: { modelIndex: 0 }
|
|
|
- }
|
|
|
- DebugUtil.log('Panel config', panel3dConfig);
|
|
|
-
|
|
|
- const panel3d = new RcsbFv3DCustom(panel3dConfig);
|
|
|
- panel3d.render();
|
|
|
-
|
|
|
- })();
|
|
|
+export function createViewer(configParams: any) {
|
|
|
+ document.addEventListener("DOMContentLoaded", (event) => {
|
|
|
+ (async function(event) {
|
|
|
+
|
|
|
+ DebugUtil.enableLog();
|
|
|
+
|
|
|
+ const panel3dConfig = await createConfig({
|
|
|
+ elementId: configParams.elementId,
|
|
|
+ pdbEntry: configParams.pdbEntry,
|
|
|
+ labelAsymId: configParams.labelAsymId,
|
|
|
+ side1: configParams.side1,
|
|
|
+ htpEntry: configParams.htpEntry,
|
|
|
+ });
|
|
|
+ DebugUtil.log('Panel config', panel3dConfig);
|
|
|
+
|
|
|
+ const panel3d = new TmFv3DCustom(panel3dConfig);
|
|
|
+ panel3d.render();
|
|
|
+
|
|
|
+ })();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+async function createConfig(configParams: any): Promise<RcsbFv3DCustomInterface> {
|
|
|
+ const pdbEntry = configParams.pdbEntry;
|
|
|
+ const labelAsymId = configParams.labelAsymId;
|
|
|
+ const params = {
|
|
|
+ side1: configParams.side1,
|
|
|
+ htpEntry: configParams.htpEntry,
|
|
|
+ pdbEntry: configParams.pdbEntry,
|
|
|
+ labelAsymId: labelAsymId,
|
|
|
+ pdbtmEntry: `${pdbEntry}_${labelAsymId}`
|
|
|
+ };
|
|
|
+
|
|
|
+ const descriptorUrl = `/${pdbEntry}.json`;
|
|
|
+ registerRegionDescriptorData(descriptorUrl, params.side1 as any);
|
|
|
+
|
|
|
+ const { sequenceConfig, molstarConfig } = await createFeatureViewerConfing(params);
|
|
|
+ const panel3dConfig: RcsbFv3DCustomInterface = {
|
|
|
+ elementId: configParams.elementId,
|
|
|
+ sequencePanelConfig: sequenceConfig,
|
|
|
+ structurePanelConfig: molstarConfig
|
|
|
+ };
|
|
|
+ molstarConfig.structureViewerConfig.viewerProps.layoutShowSequence = true;
|
|
|
+ (molstarConfig as any).loadConfig.loadParams.params = {
|
|
|
+ preset: { modelIndex: 0 }
|
|
|
+ }
|
|
|
+
|
|
|
+ return panel3dConfig;
|
|
|
+}
|
|
|
+
|
|
|
+createViewer({
|
|
|
+ elementId: "tmSaguaro",
|
|
|
+ pdbEntry: "6f7h",
|
|
|
+ labelAsymId: "C",
|
|
|
+ side1: "Inside",
|
|
|
+ htpEntry: "AQP10_HUMAN"
|
|
|
});
|