Browse Source

Merge branch 'master' of github.com:rcsb/rcsb-molstar

Yana Rose 4 years ago
parent
commit
f2a73c503c
6 changed files with 52 additions and 7 deletions
  1. 4 0
      CHANGELOG.md
  2. 2 2
      package-lock.json
  3. 1 1
      package.json
  4. 27 2
      src/viewer/helpers/preset.ts
  5. 14 0
      src/viewer/index.html
  6. 4 2
      src/viewer/index.ts

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [1.4.0] - 2021-04-02
+### Added
+- membrane orientation preset by ANVIL
+
 ## [1.3.5] - 2021-03-25
 ### Bug fixes
 - make sure only structure objects are filtered in for export

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
     "name": "@rcsb/rcsb-molstar",
-    "version": "1.3.5",
+    "version": "1.4.0",
     "lockfileVersion": 2,
     "requires": true,
     "packages": {
         "": {
             "name": "@rcsb/rcsb-molstar",
-            "version": "1.3.3",
+            "version": "1.4.0",
             "license": "MIT",
             "devDependencies": {
                 "@types/react": "^17.0.0",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@rcsb/rcsb-molstar",
-    "version": "1.3.5",
+    "version": "1.4.0",
     "description": "RCSB PDB apps and props based on Mol*.",
     "homepage": "https://github.com/rcsb/rcsb-molstar#readme",
     "repository": {

+ 27 - 2
src/viewer/helpers/preset.ts

@@ -18,7 +18,14 @@ import { Structure, StructureSelection, QueryContext, StructureElement } from 'm
 import { compile } from 'molstar/lib/mol-script/runtime/query/compiler';
 import { InitVolumeStreaming } from 'molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers';
 import { ViewerState } from '../types';
-import { StateSelection, StateObjectSelector, StateObject, StateTransformer, StateObjectRef } from 'molstar/lib/mol-state';
+import {
+    StateSelection,
+    StateObjectSelector,
+    StateObject,
+    StateTransformer,
+    StateObjectRef,
+    StateAction
+} from 'molstar/lib/mol-state';
 import { VolumeStreaming } from 'molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/behavior';
 import { Mat4 } from 'molstar/lib/mol-math/linear-algebra';
 import { CustomStructureProperties } from 'molstar/lib/mol-plugin-state/transforms/model';
@@ -27,6 +34,9 @@ import { StructureRepresentationRegistry } from 'molstar/lib/mol-repr/structure/
 import { StructureSelectionQueries as Q } from 'molstar/lib/mol-plugin-state/helpers/structure-selection-query';
 import { PluginCommands } from 'molstar/lib/mol-plugin/commands';
 import { InteractivityManager } from 'molstar/lib/mol-plugin-state/manager/interactivity';
+import { MembraneOrientationProvider } from 'molstar/lib/extensions/anvil/prop';
+import { Task } from 'molstar/lib/mol-task';
+import { MembraneOrientationPreset } from 'molstar/lib/extensions/anvil/behavior';
 
 type Target = {
     readonly auth_seq_id?: number
@@ -121,7 +131,11 @@ type DensityProps = {
     kind: 'density'
 } & BaseProps
 
-export type PresetProps = ValidationProps | StandardProps | SymmetryProps | FeatureProps | DensityProps | PropsetProps
+type MembraneProps = {
+    kind: 'membrane',
+} & BaseProps
+
+export type PresetProps = ValidationProps | StandardProps | SymmetryProps | FeatureProps | DensityProps | PropsetProps | MembraneProps
 
 const RcsbParams = (a: PluginStateObject.Molecule.Trajectory | undefined, plugin: PluginContext) => ({
     preset: PD.Value<PresetProps>({ kind: 'standard', assemblyId: '' }, { isHidden: true })
@@ -333,6 +347,11 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
             });
         }
 
+        if (p.kind === 'membrane' && structure?.obj) {
+            const params = MembraneOrientationProvider.defaultParams;
+            await plugin.runTask(plugin.state.data.applyAction(EnableMembraneOrientation, params, structure.ref));
+        }
+
         return {
             model,
             modelProperties,
@@ -344,6 +363,12 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
     }
 });
 
+const EnableMembraneOrientation = StateAction.build({
+    from: PluginStateObject.Molecule.Structure,
+})(({ a, ref, state }, plugin: PluginContext) => Task.create('Enable Membrane Orientation', async ctx => {
+    await MembraneOrientationPreset.apply(ref, Object.create(null), plugin);
+}));
+
 export function createSelectionExpression(entryId: string, range?: Range): SelectionExpression[] {
     if (range) {
         const residues: number[] = (range.label_seq_id) ? toRange(range.label_seq_id.beg, range.label_seq_id.end) : [];

+ 14 - 0
src/viewer/index.html

@@ -285,6 +285,20 @@
                             label_asym_id: 'E'
                         }
                     }
+                },
+                {
+                    id: '1BRR',
+                    info: 'membrane: X-RAY STRUCTURE OF THE BACTERIORHODOPSIN TRIMER/LIPID COMPLEX with ANVIL membrane prediction',
+                    props: {
+                        kind: 'membrane'
+                    }
+                },
+                {
+                    id: '3SN6',
+                    info: 'membrane: Crystal structure of the beta2 adrenergic receptor-Gs protein complex with ANVIL membrane prediction',
+                    props: {
+                        kind: 'membrane'
+                    }
                 }
             ];
 

+ 4 - 2
src/viewer/index.ts

@@ -40,6 +40,7 @@ import { StructureRepresentationRegistry } from 'molstar/lib/mol-repr/structure/
 import { Mp4Export } from 'molstar/lib/extensions/mp4-export';
 import { DefaultPluginUISpec, PluginUISpec } from 'molstar/lib/mol-plugin-ui/spec';
 import { PluginUIContext } from 'molstar/lib/mol-plugin-ui/context';
+import { ANVILMembraneOrientation } from 'molstar/lib/extensions/anvil/behavior';
 
 /** package version, filled in at bundle build time */
 declare const __RCSB_MOLSTAR_VERSION__: string;
@@ -53,7 +54,8 @@ export const BUILD_DATE = new Date(BUILD_TIMESTAMP);
 const Extensions = {
     'rcsb-assembly-symmetry': PluginSpec.Behavior(RCSBAssemblySymmetry),
     'rcsb-validation-report': PluginSpec.Behavior(RCSBValidationReport),
-    'mp4-export': PluginSpec.Behavior(Mp4Export)
+    'mp4-export': PluginSpec.Behavior(Mp4Export),
+    'anvil-membrane-orientation': PluginSpec.Behavior(ANVILMembraneOrientation)
 };
 
 const DefaultViewerProps = {
@@ -160,7 +162,7 @@ export class Viewer {
                 superposition: true,
                 component: false,
                 volume: true,
-                custom: true,
+                custom: true
             })
         };