Skip to content
Snippets Groups Projects
Commit bf904a5b authored by JonStargaryen's avatar JonStargaryen
Browse files

OPM stub

parent 1ff83d96
No related branches found
No related tags found
No related merge requests found
...@@ -10,12 +10,20 @@ import { Structure } from '../../mol-model/structure'; ...@@ -10,12 +10,20 @@ import { Structure } from '../../mol-model/structure';
import { CustomStructureProperty } from '../common/custom-structure-property'; import { CustomStructureProperty } from '../common/custom-structure-property';
import { CustomProperty } from '../common/custom-property'; import { CustomProperty } from '../common/custom-property';
import { CustomPropertyDescriptor } from '../../mol-model/custom-property'; import { CustomPropertyDescriptor } from '../../mol-model/custom-property';
import { ANVILParams, Membrane } from './membrane/ANVIL'; import { ANVILParams, Membrane, ANVILProps } from './membrane/ANVIL';
import { AccessibleSurfaceAreaProvider } from './accessible-surface-area'; import { AccessibleSurfaceAreaProvider } from './accessible-surface-area';
export const MembraneParams = { function getMembraneParams(data?: Structure) {
...ANVILParams let defaultType = 'anvil' as 'anvil' | 'opm'; // TODO flip - OPM should be default if PDB identifier is known
return {
type: PD.MappedStatic(defaultType, {
'opm': PD.EmptyGroup({ label: 'OPM' }),
'anvil': PD.Group(ANVILParams, { label: 'ANVIL' })
}, { options: [['opm', 'OPM'], ['anvil', 'ANVIL']] })
}; };
}
export const MembraneParams = getMembraneParams();
export type MembraneParams = typeof MembraneParams export type MembraneParams = typeof MembraneParams
export type MembraneProps = PD.Values<MembraneParams> export type MembraneProps = PD.Values<MembraneParams>
...@@ -29,11 +37,21 @@ export const MembraneProvider: CustomStructureProperty.Provider<MembraneParams, ...@@ -29,11 +37,21 @@ export const MembraneProvider: CustomStructureProperty.Provider<MembraneParams,
defaultParams: MembraneParams, defaultParams: MembraneParams,
getParams: (data: Structure) => MembraneParams, getParams: (data: Structure) => MembraneParams,
isApplicable: (data: Structure) => true, isApplicable: (data: Structure) => true,
// TODO needs ASA to be computed (or 'resolved' before trying computing topology) - how to achieve?
// TODO potentially, this could behave like secondary structure info where data can be either parsed or computed
obtain: async (ctx: CustomProperty.Context, data: Structure, props: Partial<MembraneProps>) => { obtain: async (ctx: CustomProperty.Context, data: Structure, props: Partial<MembraneProps>) => {
await AccessibleSurfaceAreaProvider.attach(ctx, data);
const p = { ...PD.getDefaultValues(MembraneParams), ...props }; const p = { ...PD.getDefaultValues(MembraneParams), ...props };
return { value: await Membrane.compute(data, p).runInContext(ctx.runtime) }; switch (p.type.name) {
case 'anvil': return { value: await computeAnvil(ctx, data, p.type.params) };
case 'opm': return { value: await computeOpm(data) };
}
} }
}); });
async function computeAnvil(ctx: CustomProperty.Context, data: Structure, props: ANVILProps): Promise<Membrane> {
await AccessibleSurfaceAreaProvider.attach(ctx, data);
const p = { ...PD.getDefaultValues(MembraneParams), ...props };
return await Membrane.compute(data, p).runInContext(ctx.runtime);
}
async function computeOpm(structure: Structure): Promise<Membrane> {
throw Error('TODO impl');
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment