From b47d04650500ff54060d94f41f33e75c553b9c9a Mon Sep 17 00:00:00 2001
From: JonStargaryen <sebastian.bittrich@rcsb.org>
Date: Fri, 21 May 2021 15:31:49 -0700
Subject: [PATCH] mapping still needed for #132

---
 .../computed/accessible-surface-area/shrake-rupley.ts    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mol-model-props/computed/accessible-surface-area/shrake-rupley.ts b/src/mol-model-props/computed/accessible-surface-area/shrake-rupley.ts
index 8ed538ea8..8dd046a34 100644
--- a/src/mol-model-props/computed/accessible-surface-area/shrake-rupley.ts
+++ b/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);
-- 
GitLab