Browse Source

fix SequenceWrapper type determination

- failed in case of Partitioned chains
Alexander Rose 5 years ago
parent
commit
6e26b4d5f9
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/mol-plugin-ui/sequence.tsx

+ 4 - 2
src/mol-plugin-ui/sequence.tsx

@@ -67,14 +67,16 @@ function getSequenceWrapper(state: SequenceViewState, structureSelection: Struct
             if (entitySeq && entitySeq.sequence.length <= MaxDisplaySequenceLength) {
                 sw = new PolymerSequenceWrapper(data)
             } else {
-                if (Unit.isAtomic(unit) || unit.polymerElements.length > MaxDisplaySequenceLength) {
+                const polymerElementCount = units.reduce((a, v) => a + v.polymerElements.length, 0)
+                if (Unit.isAtomic(unit) || polymerElementCount > MaxDisplaySequenceLength) {
                     sw = new ChainSequenceWrapper(data)
                 } else {
                     sw = new ElementSequenceWrapper(data)
                 }
             }
         } else if (Unit.isAtomic(unit)) {
-            if (unit.residueCount > MaxDisplaySequenceLength) {
+            const residueCount = units.reduce((a, v) => a + (v as Unit.Atomic).residueCount, 0)
+            if (residueCount > MaxDisplaySequenceLength) {
                 sw = new ChainSequenceWrapper(data)
             } else {
                 sw = new HeteroSequenceWrapper(data)