Browse Source

added Model.probablyHasDensityMap

Alexander Rose 5 years ago
parent
commit
d9b140f9f2

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

@@ -25,6 +25,7 @@ import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
 import { ChainIndex } from './indexing';
 import { SymmetryOperator } from '../../../mol-math/geometry';
 import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry';
+import { Column } from '../../../mol-data/db';
 
 /**
  * Interface to the "source data" of the molecule.
@@ -233,18 +234,24 @@ export namespace Model {
     }
 
     export function hasDensityMap(model: Model): boolean {
+        if (!MmcifFormat.is(model.sourceData)) return false;
+        return hasXrayMap(model) || hasEmMap(model);
+    }
+
+    export function probablyHasDensityMap(model: Model): boolean {
         if (!MmcifFormat.is(model.sourceData)) return false;
         const { db } = model.sourceData.data;
-        return (
-            hasXrayMap(model) || hasEmMap(model) || (
-                // check if from pdb archive but missing relevant meta data
-                isFromPdbArchive(model) &&
-                !db.pdbx_database_related.db_name.isDefined &&
-                !db.pdbx_database_status.status_code_sf.isDefined && (
-                    !db.exptl.method.isDefined ||
-                    isFromXray(model) ||
-                    isFromEm(model)
-                )
+        return hasDensityMap(model) || (
+            // check if from pdb archive but missing relevant meta data
+            isFromPdbArchive(model) && (
+                !db.exptl.method.isDefined ||
+                (isFromXray(model) && (
+                    !db.pdbx_database_status.status_code_sf.isDefined ||
+                    db.pdbx_database_status.status_code_sf.valueKind(0) === Column.ValueKind.Unknown
+                )) ||
+                (isFromEm(model) && (
+                    !db.pdbx_database_related.db_name.isDefined
+                ))
             )
         );
     }

+ 1 - 1
src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts

@@ -54,7 +54,7 @@ export const InitVolumeStreaming = StateAction.build({
     isApplicable: (a, _, plugin: PluginContext) => {
         const canStreamTest = plugin.config.get(PluginConfig.VolumeStreaming.CanStream);
         if (canStreamTest) return canStreamTest(a.data, plugin);
-        return a.data.models.length === 1 && Model.hasDensityMap(a.data.models[0]);
+        return a.data.models.length === 1 && Model.probablyHasDensityMap(a.data.models[0]);
     }
 })(({ ref, state, params }, plugin: PluginContext) => Task.create('Volume Streaming', async taskCtx => {
     const entries: InfoEntryProps[] = [];

+ 1 - 3
src/mol-plugin/config.ts

@@ -28,9 +28,7 @@ export const PluginConfig = {
     VolumeStreaming: {
         DefaultServer: item('volume-streaming.server', 'https://ds.litemol.org'),
         CanStream: item('volume-streaming.can-stream', (s: Structure, plugin: PluginContext) => {
-            return s.models.length === 1 && (Model.hasDensityMap(s.models[0])
-                // the following test is to include e.g. 'updated' files from PDBe
-                || (!Model.isFromPdbArchive(s.models[0]) && s.models[0].entryId.length === 4));
+            return s.models.length === 1 && Model.probablyHasDensityMap(s.models[0]);
         }),
         EmdbHeaderServer: item('volume-streaming.emdb-header-server', 'https://ftp.wwpdb.org/pub/emdb/structures'),
     },