Skip to content
Snippets Groups Projects
Commit 5cc1d650 authored by Sebastian Bittrich's avatar Sebastian Bittrich
Browse files

adds stub for buried state flag

parent 380fd092
No related branches found
No related tags found
No related merge requests found
......@@ -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()
}
}
......
......@@ -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
\ 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