Browse Source

rename options and tweak behavior upon fail to fetch

JonStargaryen 2 years ago
parent
commit
c5c5e2ea95

+ 9 - 2
src/viewer/helpers/rscc/behavior.ts

@@ -8,7 +8,7 @@ import {
     PresetStructureRepresentations,
     StructureRepresentationPresetProvider
 } from 'molstar/lib/mol-plugin-state/builder/structure/representation-preset';
-import { ValidationReport } from 'molstar/lib/extensions/rcsb/validation-report/prop';
+import { ValidationReport, ValidationReportProvider } from 'molstar/lib/extensions/rcsb/validation-report/prop';
 import { Model } from 'molstar/lib/mol-model/structure/model';
 import { StateObjectRef } from 'molstar/lib/mol-state';
 import { RSCCColorThemeProvider } from './color';
@@ -18,11 +18,12 @@ import { Loci } from 'molstar/lib/mol-model/loci';
 import { StructureElement } from 'molstar/lib/mol-model/structure/structure';
 import { OrderedSet } from 'molstar/lib/mol-data/int';
 import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
+import { Task } from 'molstar/lib/mol-task';
 
 export const RSCCPreset = StructureRepresentationPresetProvider({
     id: 'preset-structure-representation-rcsb-validation-report-rscc',
     display: {
-        name: 'Validation Report (RSCC)', group: 'Annotation',
+        name: 'Validation Report (Experimental Support)', group: 'Annotation',
         description: 'Color structure based on real-space correlation coefficients. Data from wwPDB Validation Report, obtained via RCSB PDB.'
     },
     isApplicable(a) {
@@ -34,6 +35,12 @@ export const RSCCPreset = StructureRepresentationPresetProvider({
         const structure = structureCell?.obj?.data;
         if (!structureCell || !structure) return {};
 
+        const data = structure.models[0];
+        await plugin.runTask(Task.create('Validation Report', async runtime => {
+            await ValidationReportProvider.attach({ runtime, assetManager: plugin.managers.asset }, data);
+        }));
+        if (!ValidationReportProvider.get(data).value?.rscc || ValidationReportProvider.get(data).value?.rscc.size === 0) throw Error('No RSCC available');
+
         const colorTheme = RSCCColorThemeProvider.name as any;
         return PresetStructureRepresentations.auto.apply(ref, { ...params, theme: { globalName: colorTheme, focus: { name: colorTheme } } }, plugin);
     }

+ 1 - 1
src/viewer/helpers/rscc/color.ts

@@ -90,7 +90,7 @@ export function RSCCColorTheme(ctx: ThemeDataContext, props: PD.Values<RSCCColor
 
 export const RSCCColorThemeProvider: ColorTheme.Provider<RSCCColorThemeParams, 'rscc'> = {
     name: 'rscc',
-    label: 'Real-space correlation coefficient',
+    label: 'Experimental Support Confidence',
     category: ColorTheme.Category.Validation,
     factory: RSCCColorTheme,
     getParams: getRSCCColorThemeParams,

+ 0 - 1
src/viewer/ui/validation.tsx

@@ -122,7 +122,6 @@ export class ValidationReportControls extends CollapsableControls<{}, Validation
         try {
             await RSCCPreset.apply(this.pivot.cell, Object.create(null), this.plugin);
         } catch (err) {
-            console.log(err);
             // happens e.g. for 4HHB
             this.setState(({ errorStates }) => {
                 const errors = new Set(errorStates);