Prechádzať zdrojové kódy

Issue #390: indication feature for surface residues

cycle20 2 rokov pred
rodič
commit
3db2b27d66
2 zmenil súbory, kde vykonal 33 pridanie a 6 odobranie
  1. 1 1
      src/apps/viewer/index.html
  2. 32 5
      src/apps/viewer/index.ts

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
src/apps/viewer/index.html


+ 32 - 5
src/apps/viewer/index.ts

@@ -77,7 +77,11 @@ export class Viewer {
 
     ////////////////////////////// UNITMP VIEWER PROTOTYPING SECTION
 
+    private surfaceResidues: number[];
+
     async loadWithUNITMPMembraneRepresentation(url: string, regionDescriptors: any) {
+        this.surfaceResidues = regionDescriptors['surface_residues'] as number[];
+
         const membraneNormal: Vec3 = Vec3.fromObj(
             regionDescriptors['membrane-normal']
         );
@@ -89,11 +93,6 @@ export class Viewer {
                 Vec3.zero(), [ membraneNormal[0], membraneNormal[1], 0 ], 0
             ),
             normalVector: membraneNormal,
-
-            // TODO: radius is still just a dummy value now.
-            //       Can we send a precalculated value by our backend?
-            //
-            // (NOTE: the TMDET extension calculates and sets it during applying preset)
             radius: regionDescriptors[ 'radius' ]
         };
         membrane.planePoint2[2] *= -1;
@@ -156,6 +155,7 @@ export class Viewer {
                 color: 'uniform',
                 colorParams: { value: color }
             }));
+        this.indicateSurfaceResidues(this.surfaceResidues, update);
     }
 
     private getQuery(chainId: string, auth_array: number[]): Expression {
@@ -167,6 +167,33 @@ export class Viewer {
         return query;
     }
 
+    public indicateSurfaceResidues(residues: number[], update: StateBuilder.To<any, any>) {
+        if (residues.length == 0) {
+            // nothing to do
+            return;
+        }
+
+        const query: Expression =
+            MS.struct.generator.atomGroups({
+                'residue-test': MS.core.set.has([MS.set(...residues), MS.ammp('auth_seq_id')])
+            });
+        update
+            .apply(StateTransforms.Model.StructureSelectionFromExpression,
+                {
+                    label: 'Selected Side Chains', expression: query
+                })
+            .apply(StateTransforms.Representation.StructureRepresentation3D, createStructureRepresentationParams(
+                this.plugin,
+                update.selector.data,
+                {
+                    type: "ball-and-stick",
+                    color: "uniform",
+                     // purple: iris
+                    colorParams: { value: Color.fromRgb(215, 115, 255) }
+                }
+            ));
+    }
+
     private rotateCamera(): void {
         function rot90q(v: Vec3, axis: Vec3 = Vec3.create(1, 0, 0)): Vec3 {
             const q = Quat.setAxisAngle(Quat(), axis, -Math.PI/2);

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov