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

cleanup

parent a040cde9
No related branches found
No related tags found
No related merge requests found
import { Vec3 } from 'mol-math/linear-algebra'; import { Vec3 } from 'mol-math/linear-algebra';
import { AtomicHierarchy, AtomicConformation } from '../atomic'; import { AtomicHierarchy, AtomicConformation } from '../atomic';
import { ElementSymbol, VdwRadii, MaxAsa, DefaultMaxAsa } from '../../types'; import { ElementSymbol, MaxAsa, DefaultMaxAsa, MoleculeType } from '../../types';
import { VdwRadius } from '../atomic/measures';
const defaultNumberOfPoints = 960; const defaultNumberOfPoints = 960;
const defaultProbeSize = 1.4; const defaultProbeSize = 1.4;
...@@ -24,24 +25,14 @@ export function computeModelASA(hierarchy: AtomicHierarchy, conformation: Atomic ...@@ -24,24 +25,14 @@ export function computeModelASA(hierarchy: AtomicHierarchy, conformation: Atomic
conformation conformation
} }
return calculateASA(ctx);
}
const valueForIgnoredAtom = -1.0;
function calculateASA(ctx: ASAContext) {
const { probeSize, spherePoints, cons } = ctx; const { probeSize, spherePoints, cons } = ctx;
const { atoms, residues, residueAtomSegments, derived } = ctx.hierarchy; const { atoms, residues, residueAtomSegments, derived } = ctx.hierarchy;
const { type_symbol } = atoms; const { type_symbol } = atoms;
const { x, y, z } = ctx.conformation; const { x, y, z } = ctx.conformation;
const radii: number[] = []; const radii: number[] = [];
// const atomAsa: number[] = [];
const residueAsa: number[] = []; const residueAsa: number[] = [];
console.log(ctx.hierarchy);
console.log(ctx.conformation);
const position = (i: number, v: Vec3) => Vec3.set(v, x[i], y[i], z[i]); const position = (i: number, v: Vec3) => Vec3.set(v, x[i], y[i], z[i]);
const a1Pos = Vec3.zero(); const a1Pos = Vec3.zero();
const a2Pos = Vec3.zero(); const a2Pos = Vec3.zero();
...@@ -59,7 +50,7 @@ function calculateASA(ctx: ASAContext) { ...@@ -59,7 +50,7 @@ function calculateASA(ctx: ASAContext) {
const groupIndex = residueAtomSegments.index[i]; const groupIndex = residueAtomSegments.index[i];
// skip entities not part of a peptide chain // skip entities not part of a peptide chain
if (derived.residue.moleculeType[groupIndex] !== 4) { if (derived.residue.moleculeType[groupIndex] !== MoleculeType.protein) {
radii[radii.length] = valueForIgnoredAtom; radii[radii.length] = valueForIgnoredAtom;
continue; continue;
} }
...@@ -144,10 +135,12 @@ function calculateASA(ctx: ASAContext) { ...@@ -144,10 +135,12 @@ function calculateASA(ctx: ASAContext) {
residueAsa[i] /= (maxAsa === undefined ? DefaultMaxAsa : maxAsa); residueAsa[i] /= (maxAsa === undefined ? DefaultMaxAsa : maxAsa);
} }
// console.log(residueAsa); console.log(residueAsa);
return residueAsa; return residueAsa;
} }
const valueForIgnoredAtom = -1.0;
/** /**
* Gets the van der Waals radius of the given atom following the values defined by Chothia (1976) * Gets the van der Waals radius of the given atom following the values defined by Chothia (1976)
* J.Mol.Biol.105,1-14. NOTE: the vdw values defined by the paper assume no Hydrogens and thus "inflates" slightly * J.Mol.Biol.105,1-14. NOTE: the vdw values defined by the paper assume no Hydrogens and thus "inflates" slightly
...@@ -178,8 +171,7 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string) ...@@ -178,8 +171,7 @@ function determineRadius(atomId: string, element: ElementSymbol, compId: string)
} }
} }
} }
// TODO could potentially use logging or error thrown return VdwRadius(element);
return (VdwRadii as any)[atomId];
} }
/** Creates a collection of points on a sphere by the Golden Section Spiral algorithm. */ /** Creates a collection of points on a sphere by the Golden Section Spiral algorithm. */
......
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