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

establishes PD handling of parameters

parent 0c3d4b4c
No related branches found
No related tags found
No related merge requests found
/**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
*/
import Unit from '../../unit'
import { Vec3 } from 'mol-math/linear-algebra';
import { AccessibleSurfaceAreaComputationParameters, AccessibleSurfaceArea } from './data';
import { isHydrogen, getElementIdx } from '../links/common'; // TODO move these functions somewhere more common
import { AccessibleSurfaceAreaComputationParams, AccessibleSurfaceArea } from './data';
import { isHydrogen, getElementIdx } from '../links/common'; // TODO these functions are relevant for many tasks: move them somewhere actually common
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'
const trigonalCarbonVdw = 1.76;
const tetrahedralCarbonVdw = 1.87;
const trigonalNitrogenVdw = 1.65;
const tetrahedralNitrogenVdw = 1.50;
/** deviating radii from the definition in types.ts */
/** deviating radii from definition in types.ts */
const oxygenVdw = 1.4;
const sulfurVdw = 1.85;
const missingAccessibleSurfaceAreaValue = -1.0;
function _computeAccessibleSurfaceArea(unit: Unit.Atomic, params: AccessibleSurfaceAreaComputationParameters): AccessibleSurfaceArea {
interface AccessibleSurfaceAreaContext {
unit: Unit.Atomic,
params: PD.Values<AccessibleSurfaceAreaComputationParams>,
spherePoints: Vec3[],
cons: number,
atomRadius: number[],
accessibleSurfaceArea: number[],
relativeAccessibleSurfaceArea: number[],
maxLookupRadius: number
}
function computeAccessibleSurfaceArea(unit: Unit.Atomic, params: PD.Values<AccessibleSurfaceAreaComputationParams>): AccessibleSurfaceArea {
console.log(`computing accessible surface area for unit #${ unit.id + 1 }`);
const ctx = initialize(unit, params);
assignRadiusForHeavyAtoms(ctx);
computePerResidue(ctx);
......@@ -182,18 +202,7 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string)
return VdwRadius(element);
}
interface AccessibleSurfaceAreaContext {
unit: Unit.Atomic,
params: AccessibleSurfaceAreaComputationParameters,
spherePoints: Vec3[],
cons: number,
atomRadius: number[],
accessibleSurfaceArea: number[],
relativeAccessibleSurfaceArea: number[],
maxLookupRadius: number
}
function initialize(unit: Unit.Atomic, params: AccessibleSurfaceAreaComputationParameters): AccessibleSurfaceAreaContext {
function initialize(unit: Unit.Atomic, params: PD.Values<AccessibleSurfaceAreaComputationParams>): AccessibleSurfaceAreaContext {
return {
unit: unit,
params: params,
......@@ -206,36 +215,6 @@ function initialize(unit: Unit.Atomic, params: AccessibleSurfaceAreaComputationP
}
}
// class Count {
// static count = 10;
// get count(): number {
// return Count.count;
// }
// set count(v: number) {
// Count.count = v;
// }
// }
function computeAccessibleSurfaceArea(unit: Unit.Atomic, params?: Partial<AccessibleSurfaceAreaComputationParameters>): AccessibleSurfaceArea {
// const count = new Count();
// count.count = count.count - 1;
// if (count.count > 0) {
console.log(`computing accessible surface area for unit #${ unit.id + 1 }`);
return _computeAccessibleSurfaceArea(unit, {
numberOfSpherePoints: (params && params.numberOfSpherePoints) || 92 /* original value Shrake, A. & Rupley, J. A. (1973) J. Mol. Biol. 79: 92, BioJava: 960, EPPIC: 3000 */ ,
/** 92: 1600ms, 960: 5000ms, 3000: 13000ms */
probeSize: (params && params.probeSize) || 1.4
});
// } else {
// return {
// atomRadius: [],
// accessibleSurfaceArea: [],
// relativeAccessibleSurfaceArea: [],
// buried: void 0
// }
// }
}
/** Creates a collection of points on a sphere by the Golden Section Spiral algorithm. */
function generateSpherePoints(numberOfSpherePoints: number): Vec3[] {
const points: Vec3[] = [];
......
interface AccessibleSurfaceArea {
/**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
*/
import { ParamDefinition as PD } from 'mol-util/param-definition'
export interface AccessibleSurfaceArea {
readonly atomRadius: ArrayLike<number>,
readonly accessibleSurfaceArea: ArrayLike<number>,
readonly relativeAccessibleSurfaceArea: ArrayLike<number>,
readonly buried: any
}
interface AccessibleSurfaceAreaComputationParameters {
numberOfSpherePoints: number
probeSize: number
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)' })
}
export { AccessibleSurfaceArea, AccessibleSurfaceAreaComputationParameters }
\ No newline at end of file
export type AccessibleSurfaceAreaComputationParams = typeof AccessibleSurfaceAreaComputationParams
\ No newline at end of file
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
*/
import { Color } from 'mol-util/color';
......
......@@ -61,7 +61,7 @@ function getCartoonRepr() {
}
async function init() {
const cif = await downloadFromPdb(/*'3j3q'*/'3j3q')
const cif = await downloadFromPdb(/*'3j3q'*/'1acj')
const models = await getModels(cif)
const structure = await getStructure(models[0])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment