Browse Source

add model-archive viewer helpers

Alexander Rose 3 years ago
parent
commit
ce2544b9f3
3 changed files with 21 additions and 2 deletions
  1. 5 2
      CHANGELOG.md
  2. 3 0
      src/apps/viewer/index.html
  3. 13 0
      src/apps/viewer/index.ts

+ 5 - 2
CHANGELOG.md

@@ -10,8 +10,11 @@ Note that since we don't clearly distinguish between a public and private interf
     - Fix flickering during marking with camera at rest
 - Enable ``aromaticBonds`` in structure representations by default
 - Add ``PluginConfig.Structure.DefaultRepresentationPreset``
-- Add ModelArchive schema extensions (e.g., AlphaFold uses it for the pLDDT score)
-- Add ModelArchive option in DownloadStructure action
+- Add ModelArchive support
+    - schema extensions (e.g., AlphaFold uses it for the pLDDT score)
+    - ModelArchive option in DownloadStructure action
+    - ``model-archive`` GET parameter for Viewer app
+    - ``Viewer.loadModelArchive`` method
 - Improve support for loading AlphaFold structures
     - Automatic coloring by pLDDT
     - AlphaFold DB option in DownloadStructure action

+ 3 - 0
src/apps/viewer/index.html

@@ -93,6 +93,9 @@
 
             var afdb = getParam('afdb', '[^&]+').trim();
             if (afdb) viewer.loadAfdb(afdb);
+
+            var modelArchive = getParam('model-archive', '[^&]+').trim();
+            if (modelArchive) viewer.loadModelArchive(modelArchive);
         </script>
         <!-- __MOLSTAR_ANALYTICS__ -->
     </body>

+ 13 - 0
src/apps/viewer/index.ts

@@ -274,6 +274,19 @@ export class Viewer {
         }));
     }
 
+    loadModelArchive(id: string) {
+        const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
+        return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
+            source: {
+                name: 'modelarchive' as const,
+                params: {
+                    id,
+                    options: params.source.params.options,
+                }
+            }
+        }));
+    }
+
     /**
      * @example Load X-ray density from volume server
         viewer.loadVolumeFromUrl({