Browse Source

Fix structure validation custom prop

David Sehnal 6 years ago
parent
commit
72b95a7d16

+ 4 - 4
src/mol-model-props/pdbe/structure-quality-report.ts

@@ -21,7 +21,7 @@ import Type from 'mol-script/language/type';
 type IssueMap = ResidueCustomProperty<string[]>
 
 const _Descriptor = ModelPropertyDescriptor({
-    isStatic: true,
+    isStatic: false,
     name: 'structure_quality_report',
     cifExport: {
         prefix: 'pdbe',
@@ -114,7 +114,7 @@ export namespace StructureQualityReport {
         // provide JSON from api
         PDBe_apiSourceJson?: (model: Model) => Promise<any>
     }) {
-        if (model.customProperties.has(Descriptor)) return true;
+        if (get(model)) return true;
 
         let issueMap;
 
@@ -132,12 +132,12 @@ export namespace StructureQualityReport {
         }
 
         model.customProperties.add(Descriptor);
-        model._staticPropertyData.__StructureQualityReport__ = issueMap;
+        model._dynamicPropertyData.__StructureQualityReport__ = issueMap;
         return true;
     }
 
     export function get(model: Model): IssueMap | undefined {
-        return model._staticPropertyData.__StructureQualityReport__;
+        return model._dynamicPropertyData.__StructureQualityReport__;
     }
 
     const _emptyArray: string[] = [];

+ 2 - 1
src/mol-model/structure/model/formats/mmcif.ts

@@ -146,7 +146,8 @@ function createStandardModel(format: mmCIF_Format, atom_site: AtomSite, entities
             ...previous,
             id: UUID.create(),
             modelNum: atom_site.pdbx_PDB_model_num.value(0),
-            atomicConformation: atomic.conformation
+            atomicConformation: atomic.conformation,
+            _dynamicPropertyData: Object.create(null)
         };
     }
 

+ 1 - 4
src/servers/model/properties/providers/pdbe.ts

@@ -13,10 +13,7 @@ const cacheKey = UUID.create();
 export function PDBe_structureQualityReport(model: Model, cache: any) {
     return StructureQualityReport.attachFromCifOrApi(model, {
         PDBe_apiSourceJson: async model => {
-            if (cache[cacheKey]) {
-                console.log('cache hit');
-                return cache[cacheKey];
-            }
+            if (cache[cacheKey]) return cache[cacheKey];
             const rawData = await fetchRetry(`https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/${model.label.toLowerCase()}`, 1500, 5);
             const json = await rawData.json();
             cache[cacheKey] = json;