|
@@ -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 {
|