Browse Source

mapping still needed for #132

JonStargaryen 3 years ago
parent
commit
b47d046505

+ 8 - 1
src/mol-model-props/computed/accessible-surface-area/shrake-rupley.ts

@@ -102,11 +102,18 @@ namespace AccessibleSurfaceArea {
 
     export function getValue(location: StructureElement.Location, accessibleSurfaceArea: AccessibleSurfaceArea) {
         const { area, serialResidueIndex } = accessibleSurfaceArea;
-        const rSI = serialResidueIndex[location.element];
+        const rSI = serialResidueIndex[indexOf(location.structure.root.serialMapping.elementIndices, location.element)];
         if (rSI === -1) return -1;
         return area[rSI];
     }
 
+    function indexOf<T>(a: ArrayLike<T>, e: T): number {
+        for (let i = 0, il = a.length; i < il; i++) {
+            if (a[i] === e) return i;
+        }
+        return -1;
+    }
+
     export function getNormalizedValue(location: StructureElement.Location, accessibleSurfaceArea: AccessibleSurfaceArea) {
         const value = getValue(location, accessibleSurfaceArea);
         return value === -1 ? -1 : normalize(StructureProperties.atom.label_comp_id(location), value);