Browse Source

adds stub for buried state flag

Sebastian Bittrich 6 years ago
parent
commit
5cc1d65032

+ 28 - 10
src/mol-model/structure/structure/unit/accessible-surface-area/compute.ts

@@ -11,6 +11,7 @@ import { isHydrogen, getElementIdx } from '../links/common'; // TODO these funct
 import { MoleculeType, ElementSymbol, MaxAsa, DefaultMaxAsa } from 'mol-model/structure/model/types';
 import { VdwRadius } from 'mol-model/structure/model/properties/atomic/measures';
 import { ParamDefinition as PD } from 'mol-util/param-definition'
+import { BitFlags } from 'mol-util';
 
 const trigonalCarbonVdw = 1.76;
 const tetrahedralCarbonVdw = 1.87;
@@ -26,15 +27,18 @@ interface AccessibleSurfaceAreaContext {
     params: PD.Values<AccessibleSurfaceAreaComputationParams>,
     spherePoints: Vec3[],
     cons: number,
-    atomRadius: number[],
-    accessibleSurfaceArea: number[],
-    relativeAccessibleSurfaceArea: number[],
-    maxLookupRadius: number
+    atomRadius: Float32Array,
+    accessibleSurfaceArea: Float32Array,
+    relativeAccessibleSurfaceArea: Float32Array,
+    maxLookupRadius: number,
+    buried: Uint8Array
 }
 
 function computeAccessibleSurfaceArea(unit: Unit.Atomic, params: PD.Values<AccessibleSurfaceAreaComputationParams>): AccessibleSurfaceArea {
     console.log(`computing accessible surface area for unit #${ unit.id + 1 }`);
 
+    console.log(params);
+
     const ctx = initialize(unit, params);
     assignRadiusForHeavyAtoms(ctx);
     computePerResidue(ctx);
@@ -44,10 +48,20 @@ function computeAccessibleSurfaceArea(unit: Unit.Atomic, params: PD.Values<Acces
         atomRadius: ctx.atomRadius,
         accessibleSurfaceArea: ctx.accessibleSurfaceArea,
         relativeAccessibleSurfaceArea: ctx.relativeAccessibleSurfaceArea,
-        buried: void 0 // TODO impl - rasa < 0.16 - find Rost reference
+        buried: ctx.buried // TODO impl - rasa < 0.16
     };
 }
 
+namespace SolventAccessibility {
+    export const is: (t: number, f: Flag) => boolean = BitFlags.has
+    export const create: (f: Flag) => number = BitFlags.create
+    export const enum Flag {
+        _ = 0x0,
+        BURIED = 0x1,
+        ACCESSIBLE = 0x2
+    }
+}
+
 function normalizeAccessibleSurfaceArea(ctx: AccessibleSurfaceAreaContext) {
     const { residues, derived } = ctx.unit.model.atomicHierarchy;
     const { accessibleSurfaceArea, relativeAccessibleSurfaceArea } = ctx;
@@ -57,7 +71,9 @@ function normalizeAccessibleSurfaceArea(ctx: AccessibleSurfaceAreaContext) {
         if (derived.residue.moleculeType[i] !== MoleculeType.protein) continue;
 
         const maxAsa = (MaxAsa as any)[residues.label_comp_id.value(i)];
-        relativeAccessibleSurfaceArea[i] = accessibleSurfaceArea[i] / (maxAsa === undefined ? DefaultMaxAsa : maxAsa);
+        const rasa = accessibleSurfaceArea[i] / (maxAsa === undefined ? DefaultMaxAsa : maxAsa);
+        relativeAccessibleSurfaceArea[i] = rasa;
+        ctx.buried[i] |= (rasa < ctx.params.buriedRasaThreshold ? SolventAccessibility.Flag.BURIED : SolventAccessibility.Flag.ACCESSIBLE)
     }
 }
 
@@ -203,15 +219,17 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string)
 }
 
 function initialize(unit: Unit.Atomic, params: PD.Values<AccessibleSurfaceAreaComputationParams>): AccessibleSurfaceAreaContext {
+    console.log(params);
     return {
         unit: unit,
         params: params,
         spherePoints: generateSpherePoints(params.numberOfSpherePoints),
         cons: 4.0 * Math.PI / params.numberOfSpherePoints,
-        atomRadius: [],
-        accessibleSurfaceArea: [],
-        relativeAccessibleSurfaceArea: [],
-        maxLookupRadius: 1.4 + 1.4 + 1.87 + 1.87
+        atomRadius: new Float32Array(),
+        accessibleSurfaceArea: new Float32Array(),
+        relativeAccessibleSurfaceArea: new Float32Array(),
+        maxLookupRadius: 1.4 + 1.4 + 1.87 + 1.87,
+        buried: new Uint8Array()
     }
 }
 

+ 4 - 3
src/mol-model/structure/structure/unit/accessible-surface-area/data.ts

@@ -10,11 +10,12 @@ export interface AccessibleSurfaceArea {
     readonly atomRadius: ArrayLike<number>,
     readonly accessibleSurfaceArea: ArrayLike<number>,
     readonly relativeAccessibleSurfaceArea: ArrayLike<number>,
-    readonly buried: any
+    readonly buried: Uint8Array
 }
 
 export const AccessibleSurfaceAreaComputationParams = {
-    numberOfSpherePoints: PD.Numeric(92, {}, { description: 'number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC)' }),
-    probeSize: PD.Numeric(1.4, {}, { description: 'corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)' })
+    numberOfSpherePoints: PD.Numeric(92, {}, { description: 'number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973.' }),
+    probeSize: PD.Numeric(1.4, {}, { description: 'corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)' }),
+    buriedRasaThreshold: PD.Numeric(0.16, { min: 0.0, max: 1.0 }, { description: 'below this cutoff of relative accessible surface area a residue will be considered buried - see: Rost B, Sander C: Conservation and prediction of solvent accessibility in protein families. Proteins 1994.' })
 }
 export type AccessibleSurfaceAreaComputationParams = typeof AccessibleSurfaceAreaComputationParams