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

add support for operatorName

JonStargaryen 3 роки тому
батько
коміт
de3262e9a8

+ 4 - 1
src/viewer/helpers/preset.ts

@@ -193,7 +193,10 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
             };
             representation = await plugin.builders.structure.representation.applyPreset<any>(structureProperties!, RcsbSuperpositionRepresentationPreset, params);
         } else if (p.kind === 'motif') {
-            let selectionExpressions = createSelectionExpression(p.label || model.data!.entryId, p.targets);
+            // let's force ASM_1 for motifs (as we use this contract in the rest of the stack)
+            // TODO should ASM_1 be the default, seems like we'd run into problems when selecting ligands that are e.g. ambiguous with asym_id & seq_id alone?
+            const targets = p.targets.map(t => { return t.operatorName ? t : { ...t, operatorName: 'ASM_1' }; });
+            let selectionExpressions = createSelectionExpression(p.label || model.data!.entryId, targets);
             const globalExpressions = createSelectionExpression(p.label || model.data!.entryId); // global reps, to be hidden
             selectionExpressions = selectionExpressions.concat(globalExpressions.map(e => { return { ...e, isHidden: true }; }));
 

+ 7 - 2
src/viewer/helpers/selection.ts

@@ -10,7 +10,10 @@ export type Target = {
     readonly label_seq_id?: number
     readonly label_comp_id?: string
     readonly label_asym_id?: string
-    // TODO add support for 'operators'
+    /**
+     * Mol*-internal representation, like 'ASM_2'. Enumerated in the order of appearance in the source file.
+     */
+    readonly operatorName?: string
 }
 
 export type Range = {
@@ -157,7 +160,9 @@ function targetToExpression(target: Target): Expression {
     if (target.label_asym_id) {
         chainTests.push(MS.core.rel.eq([target.label_asym_id, MS.ammp('label_asym_id')]));
     }
-    // TODO add support for 'operators'
+    if (target.operatorName) {
+        chainTests.push(MS.core.rel.eq([target.operatorName, MS.acp('operatorName')]));
+    }
 
     if (chainTests.length === 1) {
         tests['chain-test'] = chainTests[0];

+ 13 - 0
src/viewer/index.html

@@ -335,6 +335,19 @@
                             label_comp_id: 'UR7'
                         }
                     }
+                },
+                {
+                    id: '5VL5',
+                    info: 'motif selection with operator: 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, operatorName: 'ASM_4' }
+                        ],
+                    }
                 }
             ];