Browse Source

improve Model.hasSecondaryStructure

- check ModelSecondaryStructure.Provider.isApplicable
Alexander Rose 3 years ago
parent
commit
84a1b19850
1 changed files with 10 additions and 6 deletions
  1. 10 6
      src/mol-model/structure/model/model.ts

+ 10 - 6
src/mol-model/structure/model/model.ts

@@ -30,6 +30,7 @@ import { Trajectory, ArrayTrajectory } from '../trajectory';
 import { Unit } from '../structure';
 import { SortedArray } from '../../../mol-data/int/sorted-array';
 import { PolymerType } from './types';
+import { ModelSecondaryStructure } from '../../../mol-model-formats/structure/property/secondary-structure';
 
 /**
  * Interface to the "source data" of the molecule.
@@ -318,12 +319,15 @@ export namespace Model {
     }
 
     export function hasSecondaryStructure(model: Model): boolean {
-        if (!MmcifFormat.is(model.sourceData)) return false;
-        const { db } = model.sourceData.data;
-        return (
-            db.struct_conf.id.isDefined ||
-            db.struct_sheet_range.id.isDefined
-        );
+        if (MmcifFormat.is(model.sourceData)) {
+            const { db } = model.sourceData.data;
+            return (
+                db.struct_conf.id.isDefined ||
+                db.struct_sheet_range.id.isDefined
+            );
+        } else {
+            return ModelSecondaryStructure.Provider.isApplicable(model);
+        }
     }
 
     const tmpAngles90 = Vec3.create(1.5707963, 1.5707963, 1.5707963); // in radians