Browse Source

drop DefaultQueryRuntimeTable, wip moving

JonStargaryen 4 years ago
parent
commit
cbdc4a3e9d

+ 10 - 10
src/mol-model-props/computed/membrane-orientation/ANVIL.ts → src/extensions/membrane-orientation/ANVIL.ts

@@ -5,17 +5,17 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Task, RuntimeContext } from '../../../mol-task';
-import { ParamDefinition as PD } from '../../../mol-util/param-definition';
-import { Structure, StructureElement, StructureProperties } from '../../../mol-model/structure';
-import { getElementMoleculeType } from '../../../mol-model/structure/util';
-import { MoleculeType } from '../../../mol-model/structure/model/types';
-import { CentroidHelper } from '../../../mol-math/geometry/centroid-helper';
-import { Vec3 } from '../../../mol-math/linear-algebra';
-import { AccessibleSurfaceArea } from '../accessible-surface-area/shrake-rupley';
-import { AccessibleSurfaceAreaProvider } from '../accessible-surface-area';
 import { ANVILContext } from './anvil/common';
-import { MembraneOrientation } from '../../../mol-model/structure/model/properties/membrane-orientation';
+import { Structure, StructureElement, StructureProperties } from '../../mol-model/structure';
+import { Task, RuntimeContext } from '../../mol-task';
+import { CentroidHelper } from '../../mol-math/geometry/centroid-helper';
+import { AccessibleSurfaceAreaProvider } from '../../mol-model-props/computed/accessible-surface-area';
+import { Vec3 } from '../../mol-math/linear-algebra';
+import { getElementMoleculeType } from '../../mol-model/structure/util';
+import { MoleculeType } from '../../mol-model/structure/model/types';
+import { AccessibleSurfaceArea } from '../../mol-model-props/computed/accessible-surface-area/shrake-rupley';
+import { MembraneOrientation } from '../../mol-model/structure/model/properties/membrane-orientation';
+import { ParamDefinition as PD } from '../../mol-util/param-definition';
 
 export const ANVILParams = {
     numberOfSpherePoints: PD.Numeric(120, { min: 35, max: 700, step: 1 }, { description: 'Number of spheres/directions to test for membrane placement. Original value is 350.' }),

+ 0 - 0
src/mol-model-props/computed/membrane-orientation/anvil/common.ts → src/extensions/membrane-orientation/anvil/common.ts


+ 4 - 7
src/extensions/membrane-orientation/behavior.ts

@@ -7,17 +7,17 @@
 
 import { ParamDefinition as PD } from '../../mol-util/param-definition';
 import { StructureRepresentationPresetProvider, PresetStructureRepresentations } from '../../mol-plugin-state/builder/structure/representation-preset';
-import { MembraneOrientationProvider } from '../../mol-model-props/computed/membrane-orientation';
+import { MembraneOrientationProvider } from './membrane-orientation';
 import { StateObjectRef } from '../../mol-state';
 import { Task } from '../../mol-task';
 import { PluginBehavior } from '../../mol-plugin/behavior';
 import { StructureSelectionQuery, StructureSelectionCategory } from '../../mol-plugin-state/helpers/structure-selection-query';
 import { MolScriptBuilder as MS } from '../../mol-script/language/builder';
-import { DefaultQueryRuntimeTable, QuerySymbolRuntime } from '../../mol-script/runtime/query/base';
+import { QuerySymbolRuntime } from '../../mol-script/runtime/query/base';
 import { MembraneOrientationRepresentationProvider } from './representation';
 import { CustomPropSymbol } from '../../mol-script/language/symbol';
 import Type from '../../mol-script/language/type';
-import { isInMembranePlane } from '../../mol-model-props/computed/membrane-orientation/ANVIL';
+import { isInMembranePlane } from './ANVIL';
 import { StructureProperties } from '../../mol-model/structure';
 import { Vec3 } from '../../mol-math/linear-algebra';
 import { HydrophobicityColorThemeProvider } from '../../mol-theme/color/hydrophobicity';
@@ -33,8 +33,6 @@ export const MembraneOrientationData = PluginBehavior.create<{ autoAttach: boole
         private provider = MembraneOrientationProvider
 
         register(): void {
-            DefaultQueryRuntimeTable.addCustomProp(this.provider.descriptor);
-
             this.ctx.customStructureProperties.register(this.provider, this.params.autoAttach);
 
             this.ctx.representation.structure.themes.colorThemeRegistry.add(HydrophobicityColorThemeProvider);
@@ -53,7 +51,6 @@ export const MembraneOrientationData = PluginBehavior.create<{ autoAttach: boole
         }
 
         unregister() {
-            DefaultQueryRuntimeTable.removeCustomProp(this.provider.descriptor);
             this.ctx.customStructureProperties.unregister(this.provider.descriptor.name);
 
             this.ctx.representation.structure.themes.colorThemeRegistry.remove(HydrophobicityColorThemeProvider);
@@ -119,6 +116,6 @@ export const MembraneOrientationPreset = StructureRepresentationPresetProvider({
         }));
 
         const colorTheme = HydrophobicityColorThemeProvider.name as any;
-        return await PresetStructureRepresentations.auto.apply(ref, { ...params, globalThemeName: colorTheme }, plugin);
+        return await PresetStructureRepresentations.auto.apply(ref, { ...params, theme: { globalName: colorTheme, focus: { name: colorTheme } } }, plugin);
     }
 });

+ 0 - 63
src/extensions/membrane-orientation/color.ts

@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- * @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
- */
-
-import { ThemeDataContext } from '../../mol-theme/theme';
-import { ColorTheme, LocationColor } from '../../mol-theme/color';
-import { ParamDefinition as PD } from '../../mol-util/param-definition';
-import { Color } from '../../mol-util/color';
-import { TableLegend } from '../../mol-util/legend';
-import { StructureElement, Unit, StructureProperties } from '../../mol-model/structure';
-import { isHydrophobic } from '../../mol-model-props/computed/membrane-orientation/ANVIL';
-import { Location } from '../../mol-model/location';
-
-const DefaultColor = Color(0x909090);
-
-const HydrophobicColor = Color(0x2166ac);
-const HydrophilicColor = Color(0xfee08b);
-
-const ColorLegend = TableLegend([
-    ['Data unavailable', DefaultColor],
-    ['Hydrophobic', HydrophobicColor],
-    ['Hydrophilic', HydrophilicColor],
-]);
-
-export function HydrophobicityColorTheme(ctx: ThemeDataContext, props: {}): ColorTheme<{}> {
-    let color: LocationColor = () => DefaultColor;
-    const { label_comp_id } = StructureProperties.residue;
-
-    if (ctx.structure) {
-        color = (location: Location): Color => {
-            if (StructureElement.Location.is(location) && Unit.isAtomic(location.unit)) {
-                if (isHydrophobic(label_comp_id(location))) {
-                    return HydrophobicColor;
-                } else {
-                    return HydrophilicColor;
-                }
-            }
-            return DefaultColor;
-        };
-    }
-
-    return {
-        factory: HydrophobicityColorTheme,
-        granularity: 'group',
-        color,
-        props,
-        description: 'Assigns residue colors according to their hydrophobicity.',
-        legend: ColorLegend
-    };
-}
-
-export const HydrophobicityColorThemeProvider: ColorTheme.Provider<{}, 'hydrophobicity'> = {
-    name: 'hydrophobicity',
-    label: 'Hydrophobicity',
-    category: ColorTheme.Category.Residue,
-    factory: HydrophobicityColorTheme,
-    getParams: () => ({}),
-    defaultValues: PD.getDefaultValues({}),
-    isApplicable: (ctx: ThemeDataContext) => !!ctx.structure
-};

+ 4 - 4
src/mol-model-props/computed/membrane-orientation.ts → src/extensions/membrane-orientation/membrane-orientation.ts

@@ -7,12 +7,12 @@
 
 import { ParamDefinition as PD } from '../../mol-util/param-definition';
 import { Structure } from '../../mol-model/structure';
-import { CustomStructureProperty } from '../common/custom-structure-property';
-import { CustomProperty } from '../common/custom-property';
 import { CustomPropertyDescriptor } from '../../mol-model/custom-property';
-import { ANVILParams, ANVILProps, computeANVIL } from './membrane-orientation/ANVIL';
-import { AccessibleSurfaceAreaProvider } from './accessible-surface-area';
+import { ANVILParams, ANVILProps, computeANVIL } from './ANVIL';
 import { MembraneOrientation } from '../../mol-model/structure/model/properties/membrane-orientation';
+import { CustomStructureProperty } from '../../mol-model-props/common/custom-structure-property';
+import { CustomProperty } from '../../mol-model-props/common/custom-property';
+import { AccessibleSurfaceAreaProvider } from '../../mol-model-props/computed/accessible-surface-area';
 
 export const MembraneOrientationParams = {
     ...ANVILParams

+ 1 - 1
src/extensions/membrane-orientation/representation.ts

@@ -11,7 +11,6 @@ import { Representation, RepresentationContext, RepresentationParamsGetter } fro
 import { Structure } from '../../mol-model/structure';
 import { Spheres } from '../../mol-geo/geometry/spheres/spheres';
 import { SpheresBuilder } from '../../mol-geo/geometry/spheres/spheres-builder';
-import { MembraneOrientationProvider } from '../../mol-model-props/computed/membrane-orientation';
 import { StructureRepresentationProvider, StructureRepresentation, StructureRepresentationStateBuilder } from '../../mol-repr/structure/representation';
 import { MembraneOrientation } from '../../mol-model/structure/model/properties/membrane-orientation';
 import { ThemeRegistryContext } from '../../mol-theme/theme';
@@ -25,6 +24,7 @@ import { LinesBuilder } from '../../mol-geo/geometry/lines/lines-builder';
 import { Circle } from '../../mol-geo/primitive/circle';
 import { transformPrimitive } from '../../mol-geo/primitive/primitive';
 import { MeshBuilder } from '../../mol-geo/geometry/mesh/mesh-builder';
+import { MembraneOrientationProvider } from './membrane-orientation';
 
 const SharedParams = {
     color: PD.Color(ColorNames.lightgrey),