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

cleanup

parent d13ee0a2
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ export type ANVILProps = PD.Values<ANVILParams>
* doi: 10.1093/protein/gzv063
*/
export function computeANVIL(structure: Structure, props: ANVILProps) {
return Task.create('Compute Membrane Topology', async runtime => {
return Task.create('Compute Membrane Orientation', async runtime => {
return await calculate(runtime, structure, props);
});
}
......@@ -124,9 +124,9 @@ export async function calculate(runtime: RuntimeContext, structure: Structure, p
const membrane = initialMembrane.qmax! > alternativeMembrane.qmax! ? initialMembrane : alternativeMembrane;
return {
p1: membrane.planePoint1,
p2: membrane.planePoint2,
normal: membrane.normalVector!,
planePoint1: membrane.planePoint1,
planePoint2: membrane.planePoint2,
normalVector: membrane.normalVector!,
radius: ctx.extent,
centroid: ctx.centroid
};
......
......@@ -27,7 +27,6 @@ export const MembraneOrientationData = PluginBehavior.create<{ autoAttach: boole
private provider = MembraneOrientationProvider
register(): void {
console.log('beh @ register');
this.ctx.state.data.actions.add(InitMembraneOrientation3D);
this.ctx.customStructureProperties.register(this.provider, this.params.autoAttach);
......@@ -127,7 +126,6 @@ export const MembraneOrientationPreset = StructureRepresentationPresetProvider({
description: 'Shows orientation of membrane layers. Data calculated with ANVIL algorithm.' // TODO add ' or obtained via RCSB PDB'
},
isApplicable(a) {
console.log(`present applicable: ${MembraneOrientationProvider.isApplicable(a.data)}`);
return MembraneOrientationProvider.isApplicable(a.data);
},
params: () => StructureRepresentationPresetProvider.CommonParams,
......@@ -138,7 +136,6 @@ export const MembraneOrientationPreset = StructureRepresentationPresetProvider({
if (!MembraneOrientationProvider.get(structure).value) {
await plugin.runTask(Task.create('Membrane Orientation', async runtime => {
console.log('present: attaching');
await MembraneOrientationProvider.attach({ runtime, assetManager: plugin.managers.asset }, structure);
}));
}
......
......@@ -27,11 +27,11 @@ export type MembraneOrientationProps = PD.Values<MembraneOrientationParams>
interface MembraneOrientation {
// point in membrane boundary
readonly p1: Vec3,
readonly planePoint1: Vec3,
// point in opposite side of membrane boundary
readonly p2: Vec3,
readonly planePoint2: Vec3,
// normal vector of membrane layer
readonly normal: Vec3,
readonly normalVector: Vec3,
// the radius of the membrane layer
readonly radius: number,
readonly centroid: Vec3
......@@ -48,7 +48,7 @@ namespace MembraneOrientation {
const membraneOrientation = MembraneOrientationProvider.get(structure).value;
if (!membraneOrientation) return false;
Vec3.set(pos, x(ctx.element), y(ctx.element), z(ctx.element));
const { normal, p1, p2 } = membraneOrientation!;
const { normalVector: normal, planePoint1: p1, planePoint2: p2 } = membraneOrientation!;
return isInMembranePlane(pos, normal, p1, p2);
})
};
......
......@@ -74,13 +74,11 @@ export type MembraneOrientationParams = typeof MembraneOrientationParams
export type MembraneOrientationProps = PD.Values<MembraneOrientationParams>
export function getMembraneOrientationParams(ctx: ThemeRegistryContext, structure: Structure) {
console.log('rep @ getParams');
return PD.clone(MembraneOrientationParams);
}
export type MembraneOrientationRepresentation = StructureRepresentation<MembraneOrientationParams>
export function MembraneOrientationRepresentation(ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, MembraneOrientationParams>): MembraneOrientationRepresentation {
console.log('rep @ create');
return Representation.createMulti('Membrane Orientation', ctx, getParams, StructureRepresentationStateBuilder, MembraneOrientationVisuals as unknown as Representation.Def<Structure, MembraneOrientationParams>);
}
......@@ -97,8 +95,7 @@ export const MembraneOrientationRepresentationProvider = StructureRepresentation
});
function getBilayerRims(ctx: RuntimeContext, data: Structure, props: BilayerRimsProps): Shape<Lines> {
console.log('rims');
const { p1, p2, centroid, normal, radius } = MembraneOrientationProvider.get(data).value!;
const { planePoint1: p1, planePoint2: p2, centroid, normalVector: normal, radius } = MembraneOrientationProvider.get(data).value!;
const scaledRadius = props.radiusFactor * radius;
const builder = LinesBuilder.create(128, 64);
getLayerCircle(builder, p1, centroid, normal, scaledRadius, props);
......@@ -134,8 +131,7 @@ function getCircle(p: Vec3, centroid: Vec3, normal: Vec3, radius: number) {
}
function getBilayerPlanes(ctx: RuntimeContext, data: Structure, props: BilayerPlanesProps, shape?: Shape<Mesh>): Shape<Mesh> {
console.log('planes');
const { p1, p2, centroid, normal, radius } = MembraneOrientationProvider.get(data).value!;
const { planePoint1: p1, planePoint2: p2, centroid, normalVector: normal, radius } = MembraneOrientationProvider.get(data).value!;
const state = MeshBuilder.createState(128, 64, shape && shape.geometry);
const scaledRadius = props.radiusFactor * radius;
getLayerPlane(state, p1, centroid, normal, scaledRadius);
......@@ -152,12 +148,12 @@ function getLayerPlane(state: MeshBuilder.State, p: Vec3, centroid: Vec3, normal
function getBilayerSpheres(ctx: RuntimeContext, data: Structure, props: BilayerSpheresProps): Shape<Spheres> {
const { density } = props;
const { radius, p1, p2, normal } = MembraneOrientationProvider.get(data).value!;
const { radius, planePoint1, planePoint2, normalVector } = MembraneOrientationProvider.get(data).value!;
const scaledRadius = (props.radiusFactor * radius) * (props.radiusFactor * radius);
const spheresBuilder = SpheresBuilder.create();
getLayerSpheres(spheresBuilder, p1, normal, density, scaledRadius);
getLayerSpheres(spheresBuilder, p2, normal, density, scaledRadius);
getLayerSpheres(spheresBuilder, planePoint1, normalVector, density, scaledRadius);
getLayerSpheres(spheresBuilder, planePoint2, normalVector, density, scaledRadius);
return Shape.create(name, data, spheresBuilder.getSpheres(), () => props.color, () => props.sphereSize, () => '');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment