From 9dba6d5371a23af9fd1376a35a70c7130b70d0fd Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Tue, 18 Jun 2019 13:53:04 +0200
Subject: [PATCH] proteopedia-wrapper: tweak

---
 src/examples/proteopedia-wrapper/index.html |  2 +-
 src/examples/proteopedia-wrapper/index.ts   | 11 +++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/examples/proteopedia-wrapper/index.html b/src/examples/proteopedia-wrapper/index.html
index 2a72e4b51..5fd7d7bbc 100644
--- a/src/examples/proteopedia-wrapper/index.html
+++ b/src/examples/proteopedia-wrapper/index.html
@@ -212,7 +212,7 @@
                     var l = document.createElement('button');
                     l.innerText = r.name;
                     l.onclick = function () {
-                        PluginWrapper.hetGroups.focusFirst(r.name, r.indices[0]);
+                        PluginWrapper.hetGroups.focusFirst(r.name);
                     };
                     div.appendChild(l);
                 });
diff --git a/src/examples/proteopedia-wrapper/index.ts b/src/examples/proteopedia-wrapper/index.ts
index 248b96029..2ee847795 100644
--- a/src/examples/proteopedia-wrapper/index.ts
+++ b/src/examples/proteopedia-wrapper/index.ts
@@ -29,7 +29,6 @@ import { BuiltInSizeThemes } from '../../mol-theme/size';
 import { ColorNames } from '../../mol-util/color/tables';
 import { InitVolumeStreaming, CreateVolumeStreamingInfo } from '../../mol-plugin/behavior/dynamic/volume-streaming/transformers';
 import { ParamDefinition } from '../../mol-util/param-definition';
-import { ResidueIndex } from '../../mol-model/structure';
 // import { Vec3 } from 'mol-math/linear-algebra';
 // import { ParamDefinition } from 'mol-util/param-definition';
 // import { Text } from 'mol-geo/geometry/text/text';
@@ -299,7 +298,7 @@ class MolStarProteopediaWrapper {
             PluginCommands.State.Update.dispatch(this.plugin, { state: this.state, tree: update });
             PluginCommands.Camera.Reset.dispatch(this.plugin, { });
         },
-        focusFirst: async (resn: string, resIdx: ResidueIndex) => {
+        focusFirst: async (compId: string) => {
             if (!this.state.transforms.has(StateElements.Assembly)) return;
             await PluginCommands.Camera.Reset.dispatch(this.plugin, { });
 
@@ -311,17 +310,13 @@ class MolStarProteopediaWrapper {
 
             const core = MS.struct.filter.first([
                 MS.struct.generator.atomGroups({
-                    'residue-test': MS.core.logic.and([
-                        MS.core.rel.eq([MS.struct.atomProperty.macromolecular.label_comp_id(), resn]),
-                        // the resIdx isn't very clear solution and is based on current implementation of residueKey()
-                        MS.core.rel.eq([MS.struct.atomProperty.macromolecular.residueKey(), resIdx])
-                    ]),
+                    'residue-test': MS.core.rel.eq([MS.struct.atomProperty.macromolecular.label_comp_id(), compId]),
                     'group-by': MS.core.str.concat([MS.struct.atomProperty.core.operatorName(), MS.struct.atomProperty.macromolecular.residueKey()])
                 })
             ]);
             const surroundings = MS.struct.modifier.includeSurroundings({ 0: core, radius: 5, 'as-whole-residues': true });
 
-            const group = update.to(StateElements.Assembly).group(StateTransforms.Misc.CreateGroup, { label: resn }, { ref: StateElements.HetGroupFocusGroup });
+            const group = update.to(StateElements.Assembly).group(StateTransforms.Misc.CreateGroup, { label: compId }, { ref: StateElements.HetGroupFocusGroup });
 
             group.apply(StateTransforms.Model.StructureSelection, { label: 'Core', query: core }, { ref: StateElements.HetGroupFocus })
                 .apply(StateTransforms.Representation.StructureRepresentation3D, this.createCoreVisualParams());
-- 
GitLab