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

summing up ASA values for residues

parent e8e79ab0
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ function calculateASA(ctx: ASAContext) { ...@@ -36,7 +36,7 @@ function calculateASA(ctx: ASAContext) {
const { x, y, z } = ctx.conformation; const { x, y, z } = ctx.conformation;
const radii: number[] = []; const radii: number[] = [];
const atomAsa: number[] = []; // const atomAsa: number[] = [];
const residueAsa: number[] = []; const residueAsa: number[] = [];
console.log(ctx.hierarchy); console.log(ctx.hierarchy);
...@@ -46,7 +46,7 @@ function calculateASA(ctx: ASAContext) { ...@@ -46,7 +46,7 @@ function calculateASA(ctx: ASAContext) {
const a1Pos = Vec3.zero(); const a1Pos = Vec3.zero();
const a2Pos = Vec3.zero(); const a2Pos = Vec3.zero();
// 1. extract all heavy atoms // extract all heavy atoms
// TODO can be more elegant by obtaining residue info once and then using offset to navigate to next residue // TODO can be more elegant by obtaining residue info once and then using offset to navigate to next residue
for (let i = 0; i < type_symbol.rowCount; ++i) { for (let i = 0; i < type_symbol.rowCount; ++i) {
// skip hydrogen atoms // skip hydrogen atoms
...@@ -67,11 +67,13 @@ function calculateASA(ctx: ASAContext) { ...@@ -67,11 +67,13 @@ function calculateASA(ctx: ASAContext) {
const atomId = atoms.label_atom_id.value(i); const atomId = atoms.label_atom_id.value(i);
const compId = residues.label_comp_id.value(groupIndex); const compId = residues.label_comp_id.value(groupIndex);
const element = type_symbol.value(i); const element = type_symbol.value(i);
// 2. assign radius to all heavy atoms - depends on element and bonding patterns // assign radius to all heavy atoms - depends on element and bonding patterns
radii[radii.length] = determineRadius(atomId, element, compId); radii[radii.length] = determineRadius(atomId, element, compId);
// set ASA of corresponding group to 0
residueAsa[groupIndex] = 0.0;
} }
// 3. calculate the individual ASA of each atom // calculate the individual ASA of each atom
// TODO again might be more elegant to use offsets // TODO again might be more elegant to use offsets
// TODO distance is symmetric, omit redudant calcuations // TODO distance is symmetric, omit redudant calcuations
for (let i = 0; i < radii.length; ++i) { for (let i = 0; i < radii.length; ++i) {
...@@ -79,7 +81,7 @@ function calculateASA(ctx: ASAContext) { ...@@ -79,7 +81,7 @@ function calculateASA(ctx: ASAContext) {
// skip invalid entries // skip invalid entries
if (radius === valueForIgnoredAtom) { if (radius === valueForIgnoredAtom) {
atomAsa[atomAsa.length] = valueForIgnoredAtom; // atomAsa[atomAsa.length] = valueForIgnoredAtom;
continue; continue;
} }
...@@ -124,13 +126,14 @@ function calculateASA(ctx: ASAContext) { ...@@ -124,13 +126,14 @@ function calculateASA(ctx: ASAContext) {
} }
} }
atomAsa[atomAsa.length] = cons * accessiblePoints * r * r; const value = cons * accessiblePoints * r * r;
// atomAsa[atomAsa.length] = value;
// sum up values for each residue
residueAsa[residueAtomSegments.index[i]] += value;
} }
// 3. for each residue // TODO (optionally) normalize by maximum value expected for a particular amino acid - needs lookup of max values
// 3b. sum up console.log(residueAsa);
// 3c. (optionally) normalize by maximum value expected for a particular amino acid - needs lookup of max values
console.log(atomAsa);
} }
/** /**
......
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