diff --git a/src/mol-model-props/computed/membrane.ts b/src/mol-model-props/computed/membrane-orientation.ts similarity index 59% rename from src/mol-model-props/computed/membrane.ts rename to src/mol-model-props/computed/membrane-orientation.ts index e87baefa11736cf2737693246caa48001bde4136..bcbb939d03b3b4a44f684acc7d57b328da10bbe6 100644 --- a/src/mol-model-props/computed/membrane.ts +++ b/src/mol-model-props/computed/membrane-orientation.ts @@ -10,10 +10,10 @@ 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, Membrane, ANVILProps } from './membrane/ANVIL'; +import { ANVILParams, MembraneOrientation, ANVILProps } from './membrane-orientation/ANVIL'; import { AccessibleSurfaceAreaProvider } from './accessible-surface-area'; -function getMembraneParams(data?: Structure) { +function getMembraneOrientationParams(data?: Structure) { let defaultType = 'anvil' as 'anvil' | 'opm'; // TODO flip - OPM should be default if PDB identifier is known return { type: PD.MappedStatic(defaultType, { @@ -23,22 +23,22 @@ function getMembraneParams(data?: Structure) { }; } -export const MembraneParams = getMembraneParams(); -export type MembraneParams = typeof MembraneParams -export type MembraneProps = PD.Values<MembraneParams> +export const MembraneOrientationParams = getMembraneOrientationParams(); +export type MembraneOrientationParams = typeof MembraneOrientationParams +export type MembraneOrientationProps = PD.Values<MembraneOrientationParams> -export const MembraneProvider: CustomStructureProperty.Provider<MembraneParams, Membrane> = CustomStructureProperty.createProvider({ - label: 'Predicted Membrane', +export const MembraneOrientationProvider: CustomStructureProperty.Provider<MembraneOrientationParams, MembraneOrientation> = CustomStructureProperty.createProvider({ + label: 'Membrane Orientation', descriptor: CustomPropertyDescriptor({ - name: 'molstar_membrane', + name: 'molstar_computed_membrane_orientation', // TODO `cifExport` }), type: 'root', - defaultParams: MembraneParams, - getParams: (data: Structure) => MembraneParams, + defaultParams: MembraneOrientationParams, + getParams: (data: Structure) => MembraneOrientationParams, isApplicable: (data: Structure) => true, - obtain: async (ctx: CustomProperty.Context, data: Structure, props: Partial<MembraneProps>) => { - const p = { ...PD.getDefaultValues(MembraneParams), ...props }; + obtain: async (ctx: CustomProperty.Context, data: Structure, props: Partial<MembraneOrientationProps>) => { + const p = { ...PD.getDefaultValues(MembraneOrientationParams), ...props }; switch (p.type.name) { case 'anvil': return { value: await computeAnvil(ctx, data, p.type.params) }; case 'opm': return { value: await computeOpm(data) }; @@ -46,12 +46,12 @@ export const MembraneProvider: CustomStructureProperty.Provider<MembraneParams, } }); -async function computeAnvil(ctx: CustomProperty.Context, data: Structure, props: ANVILProps): Promise<Membrane> { +async function computeAnvil(ctx: CustomProperty.Context, data: Structure, props: ANVILProps): Promise<MembraneOrientation> { await AccessibleSurfaceAreaProvider.attach(ctx, data); - const p = { ...PD.getDefaultValues(MembraneParams), ...props }; - return await Membrane.compute(data, p).runInContext(ctx.runtime); + const p = { ...PD.getDefaultValues(MembraneOrientationParams), ...props }; + return await MembraneOrientation.compute(data, p).runInContext(ctx.runtime); } -async function computeOpm(structure: Structure): Promise<Membrane> { +async function computeOpm(structure: Structure): Promise<MembraneOrientation> { throw Error('TODO impl'); } \ No newline at end of file diff --git a/src/mol-model-props/computed/membrane/ANVIL.ts b/src/mol-model-props/computed/membrane-orientation/ANVIL.ts similarity index 98% rename from src/mol-model-props/computed/membrane/ANVIL.ts rename to src/mol-model-props/computed/membrane-orientation/ANVIL.ts index 80fb001ab71698da649eaf8fd0b26e16f451b717..5e0ccc1336940c8627dc91892e2de14ef1f72964 100644 --- a/src/mol-model-props/computed/membrane/ANVIL.ts +++ b/src/mol-model-props/computed/membrane-orientation/ANVIL.ts @@ -27,10 +27,10 @@ export const ANVILParams = { export type ANVILParams = typeof ANVILParams export type ANVILProps = PD.Values<ANVILParams> -export { Membrane }; -interface Membrane extends Array<Vec3> {} +export { MembraneOrientation }; +interface MembraneOrientation extends Array<Vec3> {} -namespace Membrane { +namespace MembraneOrientation { /** * Implements: * Membrane positioning for high- and low-resolution protein structures through a binary classification approach @@ -123,7 +123,7 @@ namespace Membrane { }; } - export async function calculate(runtime: RuntimeContext, structure: Structure, params: ANVILProps): Promise<Membrane> { + export async function calculate(runtime: RuntimeContext, structure: Structure, params: ANVILProps): Promise<MembraneOrientation> { const { label_comp_id } = StructureProperties.residue; const ctx = initialize(structure, params); diff --git a/src/mol-model-props/computed/membrane/anvil/common.ts b/src/mol-model-props/computed/membrane-orientation/anvil/common.ts similarity index 100% rename from src/mol-model-props/computed/membrane/anvil/common.ts rename to src/mol-model-props/computed/membrane-orientation/anvil/common.ts diff --git a/src/tests/browser/render-structure.ts b/src/tests/browser/render-structure.ts index 0de13541dff6ea48899fca2165607d2823d262f8..45857da4208ae2ee79e9d14d90bfee9930de94d3 100644 --- a/src/tests/browser/render-structure.ts +++ b/src/tests/browser/render-structure.ts @@ -26,12 +26,12 @@ 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 { MembraneProvider } from '../../mol-model-props/computed/membrane'; +import { MembraneOrientationProvider } from '../../mol-model-props/computed/membrane-orientation'; import { SpheresBuilder } from '../../mol-geo/geometry/spheres/spheres-builder'; import { Spheres } from '../../mol-geo/geometry/spheres/spheres'; import { Color } from '../../mol-util/color'; import { createRenderObject } from '../../mol-gl/render-object'; -import { Membrane } from '../../mol-model-props/computed/membrane/ANVIL'; +import { MembraneOrientation } from '../../mol-model-props/computed/membrane-orientation/ANVIL'; const parent = document.getElementById('app')!; parent.style.width = '100%'; @@ -122,7 +122,7 @@ function getGaussianSurfaceRepr() { return GaussianSurfaceRepresentationProvider.factory(reprCtx, GaussianSurfaceRepresentationProvider.getParams); } -function getMembraneRepr(membrane: Membrane) { +function getMembraneRepr(membrane: MembraneOrientation) { // 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++) { @@ -150,7 +150,7 @@ async function init() { console.timeEnd('compute SecondaryStructure'); console.time('compute Membrane'); - await MembraneProvider.attach(ctx, structure); + await MembraneOrientationProvider.attach(ctx, structure); console.timeEnd('compute Membrane'); console.time('compute Interactions'); @@ -172,7 +172,7 @@ async function init() { const ballAndStickRepr = getBallAndStickRepr(); const molecularSurfaceRepr = getMolecularSurfaceRepr(); const gaussianSurfaceRepr = getGaussianSurfaceRepr(); - const membraneRepr = getMembraneRepr(MembraneProvider.get(structure).value!); + const membraneRepr = getMembraneRepr(MembraneOrientationProvider.get(structure).value!); if (show.cartoon) { cartoonRepr.setTheme({