Browse Source

viewer loadAllModelsOrAssemblyFromUrl options

David Sehnal 4 years ago
parent
commit
aa911ad4bc

+ 1 - 0
src/apps/viewer/embedded.html

@@ -37,6 +37,7 @@
             });
             viewer.loadPdb('7bv2');
             viewer.loadEmdb('EMD-30210', { detail: 6 });
+            // viewer.loadAllModelsOrAssemblyFromUrl('https://cs.litemol.org/5ire/full', 'mmcif', false, { representationParams: { theme: { globalName: 'operator-name' } } })
         </script>
     </body>
 </html>

+ 2 - 2
src/apps/viewer/index.ts

@@ -165,13 +165,13 @@ export class Viewer {
         }));
     }
 
-    async loadAllModelsOrAssemblyFromUrl(url: string, format: BuiltInTrajectoryFormat = 'mmcif', isBinary = false) {
+    async loadAllModelsOrAssemblyFromUrl(url: string, format: BuiltInTrajectoryFormat = 'mmcif', isBinary = false, options?: LoadStructureOptions) {
         const plugin = this.plugin;
 
         const data = await plugin.builders.data.download({ url, isBinary }, { state: { isGhost: true } });
         const trajectory = await plugin.builders.structure.parseTrajectory(data, format);
 
-        await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'all-models', { useDefaultIfSingleModel: true });
+        await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'all-models', { useDefaultIfSingleModel: true, representationPresetParams: options?.representationParams });
     }
 
     async loadStructureFromData(data: string | number[], format: BuiltInTrajectoryFormat, options?: { dataLabel?: string }) {

+ 1 - 0
src/mol-plugin-state/builder/structure/hierarchy-preset.ts

@@ -76,6 +76,7 @@ const defaultPreset = TrajectoryHierarchyPresetProvider({
 
 const AllModelsParams = (a: PluginStateObject.Molecule.Trajectory | undefined, plugin: PluginContext) => ({
     useDefaultIfSingleModel: PD.Optional(PD.Boolean(false)),
+    representationPresetParams: PD.Optional(PD.Group(StructureRepresentationPresetProvider.CommonParams)),
     ...CommonParams(a, plugin)
 });