Browse Source

`FocusResidueColorTheme` used in assembly view

bioinsilico 1 year ago
parent
commit
6f6ba2e41f

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [4.0.5] - 2023-12-04
+### Improvement
+- `FocusResidueColorTheme` used in assembly view
+
 ## [4.0.4] - 2023-11-30
 ### Dependency update
 - rcsb-saguaro v3.0.4

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "4.0.4",
+  "version": "4.0.5",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/app.js",
   "files": [

+ 10 - 0
src/RcsbFvStructure/StructureViewers/MolstarViewer/TrajectoryPresetProvider/AssemblyRepresentationPresetProvider.ts

@@ -14,6 +14,8 @@ import {StructureBuilder} from "molstar/lib/mol-plugin-state/builder/structure";
 import {StructureRepresentationBuilder} from "molstar/lib/mol-plugin-state/builder/structure/representation";
 import {createSelectionExpressions} from "@rcsb/rcsb-molstar/build/src/viewer/helpers/selection";
 import {StateTransform} from "molstar/lib/mol-state/transform";
+import {FOCUS_RESIDUE_COLOR} from "./FocusTheme/FocusColoring";
+import updateFocusRepr = StructureRepresentationPresetProvider.updateFocusRepr;
 
 type ComponentType = Awaited<ReturnType<InstanceType<typeof StructureBuilder>["tryCreateComponentFromExpression"]>>;
 type RepresentationType = ReturnType<InstanceType<typeof StructureRepresentationBuilder>["buildRepresentation"]>;
@@ -113,6 +115,14 @@ export const AssemblyRepresentationPresetProvider = StructureRepresentationPrese
             await update.commit({ revertOnError: false });
         }
 
+        structure.inheritedPropertyData.reprList = Object.values(representationMap).filter(repr=>typeof repr != "undefined");
+        await updateFocusRepr(
+            plugin,
+            structure,
+            FOCUS_RESIDUE_COLOR,
+            {}
+        );
+
         return {
             components: componentMap,
             representations: representationMap

+ 3 - 0
src/RcsbFvStructure/StructureViewers/MolstarViewer/TrajectoryPresetProvider/AssemblyTrajectoryPresetProvider.ts

@@ -10,6 +10,7 @@ import {StateTransformer} from "molstar/lib/mol-state/transformer";
 import {PluginContext} from "molstar/lib/mol-plugin/context";
 import {AssemblyRepresentationPresetProvider} from "./AssemblyRepresentationPresetProvider";
 import {Structure, StructureElement, StructureProperties as SP} from "molstar/lib/mol-model/structure";
+import {FocusResidueColorThemeProvider} from "./FocusTheme/FocusColoring";
 
 type StructureObject = StateObjectSelector<PluginStateObject.Molecule.Structure, StateTransformer<StateObject<any, StateObject.Type<any>>, StateObject<any, StateObject.Type<any>>, any>>
 
@@ -64,6 +65,8 @@ export const AssemblyTrajectoryPresetProvider = TrajectoryHierarchyPresetProvide
         }
 
         const structureProperties: StructureObject = await builder.insertStructureProperties(structure);
+        if (!plugin.representation.structure.themes.colorThemeRegistry.has(FocusResidueColorThemeProvider))
+            plugin.representation.structure.themes.colorThemeRegistry.add(FocusResidueColorThemeProvider);
         const unitcell: StateObjectSelector | undefined = await builder.tryCreateUnitcell(modelProperties, undefined, { isHidden: true });
         const representation: StructureRepresentationPresetProvider.Result | undefined = await plugin.builders.structure.representation.applyPreset(structureProperties, AssemblyRepresentationPresetProvider);
 

+ 1 - 1
src/RcsbFvStructure/StructureViewers/MolstarViewer/TrajectoryPresetProvider/FocusTheme/FocusColoring.ts

@@ -18,7 +18,7 @@ import {
 } from "molstar/lib/mol-theme/color/element-symbol";
 
 export const FOCUS_RESIDUE_COLOR = 'focus-residue-color' as ColorTheme.BuiltIn;
-export function FocusResidueColorTheme(ctx: ThemeDataContext, props: ParamDefinition.Values<ElementSymbolColorThemeParams>): ColorTheme<ElementSymbolColorThemeParams> {
+function FocusResidueColorTheme(ctx: ThemeDataContext, props: ParamDefinition.Values<ElementSymbolColorThemeParams>): ColorTheme<ElementSymbolColorThemeParams> {
 
     const L = StructureElement.Location.create();