Переглянути джерело

support for structOperExpressions

JonStargaryen 3 роки тому
батько
коміт
b4909b0681
2 змінених файлів з 41 додано та 3 видалено
  1. 14 3
      src/viewer/helpers/selection.ts
  2. 27 0
      src/viewer/index.html

+ 14 - 3
src/viewer/helpers/selection.ts

@@ -11,12 +11,13 @@ export type Target = {
     readonly label_comp_id?: string
     readonly label_asym_id?: string
     /**
-     * Mol*-internal representation, like 'ASM_2'. Enumerated in the order of appearance in the source file.
+     * Mol*-internal representation, like 'ASM_2'. Enumerated in the order of appearance in the source file. Specify the
+     * assemblyId when using this selector.
      */
     readonly operatorName?: string
     /**
      * Strucmotif-/BioJava-specific representation, like 'Px42'. This is a single 'pdbx_struct_oper_list.id' value or a
-     * combination thereof.
+     * combination thereof. Specify the assemblyId when using this selector.
      */
     readonly structOperExpression?: string
 }
@@ -54,13 +55,23 @@ export function normalizeTargets(targets: Target[], structure: Structure, operat
     return targets.map(t => {
         if (t.structOperExpression) {
             const { structOperExpression, ...others } = t;
-            const oper = ''; // TODO impl
+            const oper = toOperatorName(structure, structOperExpression);
             return { ...others, operatorName: oper };
         }
         return t.operatorName ? t : { ...t, operatorName };
     });
 }
 
+function toOperatorName(structure: Structure, expression: string): string {
+    for (const unit of structure.units) {
+        const assembly = unit.conformation.operator.assembly;
+        if (!assembly) continue;
+
+        if (expression === assembly.operList.join('x')) return `ASM_${assembly.operId}`;
+    }
+    throw Error(`Unable to find expression '${expression}'`);
+}
+
 /**
  * Convert a selection to an array of selection expressions.
  * @param labelBase the base label that will appear in the UI (e.g., the entry ID)

+ 27 - 0
src/viewer/index.html

@@ -350,6 +350,33 @@
                             { label_asym_id: 'A', label_seq_id: 87, operatorName: 'ASM_4' }
                         ],
                     }
+                },
+                {
+                    id: '5VL5',
+                    info: 'motif selection with strucmotif-expression: Coordination Chemistry within a Protein Host: Regulation of the Secondary Coordination Sphere',
+                    props: {
+                        kind: 'motif',
+                        assemblyId: '1',
+                        targets: [
+                            { label_asym_id: 'A', label_seq_id: 61 },
+                            { label_asym_id: 'A', label_seq_id: 69 },
+                            { label_asym_id: 'A', label_seq_id: 87, structOperExpression: '4' }
+                        ],
+                    }
+                },
+                {
+                    id: '2BFU',
+                    info: 'motif selection with strucmotif-expression: X-ray structure of CPMV top component',
+                    props: {
+                        kind: 'motif',
+                        assemblyId: '6',
+                        targets: [
+                            // 2BFU (A_5xX0-97 [ARG] AND B_5xX0-61 [ARG] AND B_5xX0-64 [ALA])
+                            { label_asym_id: 'A', label_seq_id: 46, structOperExpression: 'X0x5' },
+                            { label_asym_id: 'A', label_seq_id: 49, structOperExpression: 'X0x5' },
+                            { label_asym_id: 'A', label_seq_id: 145, structOperExpression: 'X0x5' }
+                        ],
+                    }
                 }
             ];