Browse Source

Make outgoing strucmotif query URL context-aware

Sebastian Bittrich 2 years ago
parent
commit
5e11a82cff
5 changed files with 36 additions and 28 deletions
  1. 4 0
      CHANGELOG.md
  2. 23 23
      package-lock.json
  3. 1 1
      package.json
  4. 1 1
      src/viewer/index.ts
  5. 7 3
      src/viewer/ui/strucmotif.tsx

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [2.5.6] - 2022-09-15
+### Bug fixes
+- Make outgoing strucmotif query URL context-aware
+
 ## [2.5.5] - 2022-07-28
 ### Bug fixes
 - Strucmotif UI: improve handling of modified & non-standard components

+ 23 - 23
package-lock.json

@@ -11,7 +11,7 @@
             "dependencies": {
                 "@types/react": "^18.0.15",
                 "@types/react-dom": "^18.0.6",
-                "molstar": "^3.13.0",
+                "molstar": "^3.16.0",
                 "react": "^18.2.0",
                 "react-dom": "^18.2.0",
                 "rxjs": "^7.5.6",
@@ -277,9 +277,9 @@
             "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
         },
         "node_modules/@types/node": {
-            "version": "16.11.45",
-            "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz",
-            "integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ=="
+            "version": "16.11.59",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.59.tgz",
+            "integrity": "sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw=="
         },
         "node_modules/@types/node-fetch": {
             "version": "2.6.2",
@@ -3551,15 +3551,15 @@
             "dev": true
         },
         "node_modules/molstar": {
-            "version": "3.13.0",
-            "resolved": "https://registry.npmjs.org/molstar/-/molstar-3.13.0.tgz",
-            "integrity": "sha512-udoFMujgQwQaUoFacHvTT4ZBbX8K6qvFXwQerCJ/f1SIV0/NRhoKMvvPQ5kqXPoUFBqKBWtmm8hAQ5V0XFqh7A==",
+            "version": "3.16.0",
+            "resolved": "https://registry.npmjs.org/molstar/-/molstar-3.16.0.tgz",
+            "integrity": "sha512-0lAWpKrLDlR9/S913RiR4Xfux1rBd//gQn8Dpe5f+5v9KCw5AdD7EpsSINWLTrJRj5N6Omf18PO50bESHibJ9A==",
             "dependencies": {
                 "@types/argparse": "^2.0.10",
                 "@types/benchmark": "^2.1.1",
                 "@types/compression": "1.7.2",
                 "@types/express": "^4.17.13",
-                "@types/node": "^16.11.45",
+                "@types/node": "^16.11.51",
                 "@types/node-fetch": "^2.6.2",
                 "@types/swagger-ui-dist": "3.30.1",
                 "argparse": "^2.0.1",
@@ -3572,7 +3572,7 @@
                 "immutable": "^4.1.0",
                 "node-fetch": "^2.6.7",
                 "rxjs": "^7.5.6",
-                "swagger-ui-dist": "^4.13.0",
+                "swagger-ui-dist": "^4.14.0",
                 "tslib": "^2.4.0",
                 "util.promisify": "^1.1.1",
                 "xhr2": "^0.2.1"
@@ -4852,9 +4852,9 @@
             }
         },
         "node_modules/swagger-ui-dist": {
-            "version": "4.13.0",
-            "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.13.0.tgz",
-            "integrity": "sha512-5yqhkUU9uV5oT/MTMBeSgDGI0Vx6eCOU43AszQBs88poI8OB1v+FoXEFHv+NaBbEfTkXCMWlAJrH6iWyDzLETQ=="
+            "version": "4.14.0",
+            "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.0.tgz",
+            "integrity": "sha512-TBzhheU15s+o54Cgk9qxuYcZMiqSm/SkvKnapoGHOF66kz0Y5aGjpzj5BT/vpBbn6rTPJ9tUYXQxuDWfsjiGMw=="
         },
         "node_modules/tapable": {
             "version": "2.2.1",
@@ -5641,9 +5641,9 @@
             "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
         },
         "@types/node": {
-            "version": "16.11.45",
-            "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz",
-            "integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ=="
+            "version": "16.11.59",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.59.tgz",
+            "integrity": "sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw=="
         },
         "@types/node-fetch": {
             "version": "2.6.2",
@@ -8154,15 +8154,15 @@
             "dev": true
         },
         "molstar": {
-            "version": "3.13.0",
-            "resolved": "https://registry.npmjs.org/molstar/-/molstar-3.13.0.tgz",
-            "integrity": "sha512-udoFMujgQwQaUoFacHvTT4ZBbX8K6qvFXwQerCJ/f1SIV0/NRhoKMvvPQ5kqXPoUFBqKBWtmm8hAQ5V0XFqh7A==",
+            "version": "3.16.0",
+            "resolved": "https://registry.npmjs.org/molstar/-/molstar-3.16.0.tgz",
+            "integrity": "sha512-0lAWpKrLDlR9/S913RiR4Xfux1rBd//gQn8Dpe5f+5v9KCw5AdD7EpsSINWLTrJRj5N6Omf18PO50bESHibJ9A==",
             "requires": {
                 "@types/argparse": "^2.0.10",
                 "@types/benchmark": "^2.1.1",
                 "@types/compression": "1.7.2",
                 "@types/express": "^4.17.13",
-                "@types/node": "^16.11.45",
+                "@types/node": "^16.11.51",
                 "@types/node-fetch": "^2.6.2",
                 "@types/swagger-ui-dist": "3.30.1",
                 "argparse": "^2.0.1",
@@ -8175,7 +8175,7 @@
                 "immutable": "^4.1.0",
                 "node-fetch": "^2.6.7",
                 "rxjs": "^7.5.6",
-                "swagger-ui-dist": "^4.13.0",
+                "swagger-ui-dist": "^4.14.0",
                 "tslib": "^2.4.0",
                 "util.promisify": "^1.1.1",
                 "xhr2": "^0.2.1"
@@ -9064,9 +9064,9 @@
             "dev": true
         },
         "swagger-ui-dist": {
-            "version": "4.13.0",
-            "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.13.0.tgz",
-            "integrity": "sha512-5yqhkUU9uV5oT/MTMBeSgDGI0Vx6eCOU43AszQBs88poI8OB1v+FoXEFHv+NaBbEfTkXCMWlAJrH6iWyDzLETQ=="
+            "version": "4.14.0",
+            "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.0.tgz",
+            "integrity": "sha512-TBzhheU15s+o54Cgk9qxuYcZMiqSm/SkvKnapoGHOF66kz0Y5aGjpzj5BT/vpBbn6rTPJ9tUYXQxuDWfsjiGMw=="
         },
         "tapable": {
             "version": "2.2.1",

+ 1 - 1
package.json

@@ -62,7 +62,7 @@
     "dependencies": {
         "@types/react": "^18.0.15",
         "@types/react-dom": "^18.0.6",
-        "molstar": "^3.13.0",
+        "molstar": "^3.16.0",
         "react": "^18.2.0",
         "react-dom": "^18.2.0",
         "rxjs": "^7.5.6",

+ 1 - 1
src/viewer/index.ts

@@ -174,7 +174,7 @@ export class Viewer {
                 [PluginConfig.Download.DefaultEmdbProvider, 'rcsb'],
                 [PluginConfig.Structure.DefaultRepresentationPreset, PresetStructureRepresentations.auto.id],
                 // wboit & webgl1 checks are needed to work properly on recent Safari versions
-                [PluginConfig.General.EnableWboit, PluginFeatureDetection.wboit],
+                [PluginConfig.General.EnableWboit, PluginFeatureDetection.preferWebGl1],
                 [PluginConfig.General.PreferWebGl1, PluginFeatureDetection.preferWebGl1]
             ]
         };

+ 7 - 3
src/viewer/ui/strucmotif.tsx

@@ -28,7 +28,9 @@ import { ViewerState } from '../types';
 
 const ABSOLUTE_ADVANCED_SEARCH_URL = 'https://rcsb.org/search?query=';
 const RELATIVE_ADVANCED_SEARCH_URL = '/search?query=';
-const RETURN_TYPE = '&return_type=assembly&include_csm=true';
+const RETURN_TYPE = '&return_type=assembly';
+const CSM_REGEX = /^[A-Z0-9]+_[A-Z0-9]{6,}$/i;
+const CSM_TAG = '&include_csm=true';
 const MIN_MOTIF_SIZE = 2;
 const MAX_MOTIF_SIZE = 10;
 export const MAX_EXCHANGES = 4;
@@ -222,12 +224,13 @@ class SubmitControls extends PurePluginUIComponent<{}, { isBusy: boolean, residu
             }
         }
 
+        const entry_id = pdbId.values().next().value as string;
         const query = {
             type: 'terminal',
             service: 'strucmotif',
             parameters: {
                 value: {
-                    entry_id: pdbId.values().next().value as string,
+                    entry_id,
                     residue_ids: residueIds.sort((a, b) => this.sortResidueIds(a, b))
                 },
                 rmsd_cutoff: 2,
@@ -237,7 +240,8 @@ class SubmitControls extends PurePluginUIComponent<{}, { isBusy: boolean, residu
         if (exchanges.length) Object.assign(query.parameters, { exchanges });
         // console.log(query);
         const sierraUrl = (this.plugin.customState as ViewerState).detachedFromSierra ? ABSOLUTE_ADVANCED_SEARCH_URL : RELATIVE_ADVANCED_SEARCH_URL;
-        const url = sierraUrl + encodeURIComponent(JSON.stringify(query)) + RETURN_TYPE;
+        const csmTag = CSM_REGEX.test(entry_id) ? CSM_TAG : '';
+        const url = sierraUrl + encodeURIComponent(JSON.stringify(query)) + RETURN_TYPE + csmTag;
         // console.log(url);
         window.open(url, '_blank');
     };