소스 검색

Issue #390: indication feature for surface residues

cycle20 2 년 전
부모
커밋
3db2b27d66
2개의 변경된 파일33개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 1
      src/apps/viewer/index.html
  2. 32 5
      src/apps/viewer/index.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.