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

allows for ASA visualization by really dirty means

parent e5b6ac39
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,8 @@ export interface Model extends Readonly<{
readonly chemicalComponentMap: ChemicalComponentMap
/** maps residue name to `SaccharideComponent` data */
readonly saccharideComponentMap: SaccharideComponentMap
/** brute-force way to add ASA data, prob should be a custom property */
readonly asa: number[]
},
customProperties: CustomProperties,
......
import { Vec3 } from 'mol-math/linear-algebra';
import { AtomicHierarchy, AtomicConformation } from '../atomic';
import { ElementSymbol, VdwRadii, MaxAsa, DefaultMaxAsa } from '../../types';
import { max } from 'mol-data/int/impl/ordered-set';
const defaultNumberOfPoints = 960;
const defaultProbeSize = 1.4;
......@@ -25,7 +24,7 @@ export function computeModelASA(hierarchy: AtomicHierarchy, conformation: Atomic
conformation
}
calculateASA(ctx);
return calculateASA(ctx);
}
const valueForIgnoredAtom = -1.0;
......@@ -133,7 +132,7 @@ function calculateASA(ctx: ASAContext) {
residueAsa[residueAtomSegments.index[i]] += value;
}
console.log(residueAsa);
// console.log(residueAsa);
// normalize by maximum value expected for a particular amino acid - needs lookup of max values
for (let i = 0; i < residues.label_comp_id.rowCount; ++i) {
......@@ -145,7 +144,8 @@ function calculateASA(ctx: ASAContext) {
residueAsa[i] /= (maxAsa === undefined ? DefaultMaxAsa : maxAsa);
}
console.log(residueAsa);
// console.log(residueAsa);
return residueAsa;
}
/**
......
......@@ -10,8 +10,9 @@ import { ColorTheme } from '../color';
import { ParamDefinition as PD } from 'mol-util/param-definition'
import { ThemeDataContext } from '../theme';
import { ColorListOptions, ColorListName, ColorScale } from 'mol-util/color/scale';
import { StructureElement, Link, ElementIndex, Unit } from 'mol-model/structure';
// const DefaultAccessibleSurfaceAreaColor = Color(0xCCCCCC)
const DefaultAccessibleSurfaceAreaColor = Color(0xCCCCCC)
const Description = 'Assigns a color based on the relative accessible surface area of a residue.'
export const AccessibleSurfaceAreaColorThemeParams = {
......@@ -28,9 +29,22 @@ export function AccessibleSurfaceAreaColorTheme(ctx: ThemeDataContext, props: PD
minLabel: 'Start',
maxLabel: 'End',
})
const scaleColor = scale.color
function asaColor(unit: Unit, element: ElementIndex): Color {
if (Unit.isAtomic(unit)) {
return scaleColor(unit.model.properties.asa[unit.residueIndex[element]]);
}
return DefaultAccessibleSurfaceAreaColor;
}
const color = (location: Location): Color => {
return scale.color(Math.random())
// TODO impl
if (StructureElement.isLocation(location)) {
return asaColor(location.unit, location.element);
} else if (Link.isLocation(location)) {
return asaColor(location.aUnit, location.aUnit.elements[location.aIndex]);
}
return DefaultAccessibleSurfaceAreaColor;
}
return {
......
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