JonStargaryen 4 anni fa
parent
commit
6c112f83e8

+ 0 - 75
src/mol-model-props/computed/themes/topology.ts

@@ -1,75 +0,0 @@
-/**
- * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-import { ParamDefinition as PD } from '../../../mol-util/param-definition';
-import { Color, ColorScale } from '../../../mol-util/color';
-import { ThemeDataContext } from '../../../mol-theme/theme';
-import { ColorTheme, LocationColor } from '../../../mol-theme/color';
-import { CustomProperty } from '../../common/custom-property';
-import { Location } from '../../../mol-model/location';
-
-const DefaultColor = Color(0xFAFAFA);
-const Description = 'Assigns a color based on the membrane topology of a residue.';
-
-export const TopologyColorThemeParams = {
-    list: PD.ColorList('rainbow', { presetKind: 'scale' }) // change to binary
-};
-export type TopologyColorThemeParams = typeof TopologyColorThemeParams
-export function getTopologyColorThemeParams(ctx: ThemeDataContext) {
-    return TopologyColorThemeParams; // TODO return copy
-}
-export function TopologyColorTheme(ctx: ThemeDataContext, props: PD.Values<TopologyColorThemeParams>): ColorTheme<TopologyColorThemeParams> {
-    let color: LocationColor;
-
-    const scale = ColorScale.create({
-        listOrName: props.list.colors,
-        minLabel: 'membrane',
-        maxLabel: 'non-membrane',
-        domain: [0.0, 1.0]
-    }); // prolly not needed
-
-    // const accessibleSurfaceArea = ctx.structure && AccessibleSurfaceAreaProvider.get(ctx.structure);
-    // const contextHash = accessibleSurfaceArea?.version;
-
-    if (/*accessibleSurfaceArea?.value &&*/ ctx.structure) {
-        // const asa = accessibleSurfaceArea.value;
-
-        color = (location: Location): Color => {
-            // if (StructureElement.Location.is(location) && Unit.isAtomic(location.unit)) {
-                // const value = AccessibleSurfaceArea.getNormalizedValue(location, asa);
-                // return value === -1 ? DefaultColor : scale.color(value);
-            // }
-            return DefaultColor;
-        };
-    } else {
-        color = () => DefaultColor;
-    }
-
-    return {
-        factory: TopologyColorTheme,
-        granularity: 'group',
-        color,
-        props,
-        /*contextHash*/'',
-        description: Description,
-        legend: scale ? scale.legend : undefined
-    };
-}
-
-export const TopologyColorThemeProvider: ColorTheme.Provider<TopologyColorThemeParams, 'topology'> = {
-    name: 'topology',
-    label: 'Membrane Topology',
-    category: ColorTheme.Category.Residue,
-    factory: TopologyColorTheme,
-    getParams: getTopologyColorThemeParams,
-    defaultValues: PD.getDefaultValues(TopologyColorThemeParams),
-    isApplicable: (ctx: ThemeDataContext) => !!ctx.structure,
-    ensureCustomProperties: {
-        attach: (ctx: CustomProperty.Context, data: ThemeDataContext) => data.structure ? TopologyProvider.attach(ctx, data.structure, void 0, true) : Promise.resolve(),
-        detach: (data) => data.structure && data.structure.customPropertyDescriptors.reference(TopologyProvider.descriptor, false)
-    }
-};

+ 0 - 0
src/mol-plugin/behavior/dynamic/custom-props/computed/topology.ts


+ 4 - 8
src/tests/browser/render-structure.ts

@@ -26,7 +26,6 @@ import { InteractionsProvider } from '../../mol-model-props/computed/interaction
 import { SecondaryStructureProvider } from '../../mol-model-props/computed/secondary-structure';
 import { SyncRuntimeContext } from '../../mol-task/execution/synchronous';
 import { AssetManager } from '../../mol-util/assets';
-import { AccessibleSurfaceAreaProvider } from '../../mol-model-props/computed/accessible-surface-area';
 import { MembraneProvider } from '../../mol-model-props/computed/membrane';
 import { SpheresBuilder } from '../../mol-geo/geometry/spheres/spheres-builder';
 import { Spheres } from '../../mol-geo/geometry/spheres/spheres';
@@ -124,6 +123,7 @@ function getGaussianSurfaceRepr() {
 }
 
 function getMembraneRepr(membrane: Membrane) {
+    // TODO is a representation provider the right place for this?
     const spheresBuilder = SpheresBuilder.create(membrane.length, 1);
     for (let i = 0, il = membrane.length; i < il; i++) {
         spheresBuilder.add(membrane[i][0], membrane[i][1], membrane[i][2], 0);
@@ -149,10 +149,6 @@ async function init() {
     await SecondaryStructureProvider.attach(ctx, structure);
     console.timeEnd('compute SecondaryStructure');
 
-    console.time('compute AccessibleSurfaceArea');
-    await AccessibleSurfaceAreaProvider.attach(ctx, structure);
-    console.timeEnd('compute AccessibleSurfaceArea');
-
     console.time('compute Membrane');
     await MembraneProvider.attach(ctx, structure);
     console.timeEnd('compute Membrane');
@@ -164,8 +160,8 @@ async function init() {
 
     const show = {
         cartoon: true,
-        interaction: false,
-        ballAndStick: false,
+        interaction: true,
+        ballAndStick: true,
         molecularSurface: false,
         gaussianSurface: false,
         membrane: true
@@ -221,7 +217,7 @@ async function init() {
         await gaussianSurfaceRepr.createOrUpdate({ ...GaussianSurfaceRepresentationProvider.defaultValues, quality: 'custom', alpha: 1.0, flatShaded: true, doubleSided: true, resolution: 0.3 }, structure).run();
         console.timeEnd('gaussian surface');
     }
-    
+
     if (show.cartoon) canvas3d.add(cartoonRepr);
     if (show.interaction) canvas3d.add(interactionRepr);
     if (show.ballAndStick) canvas3d.add(ballAndStickRepr);