Ver Fonte

handle operatorName/struct_oper_id for AlphaFold

Sebastian Bittrich há 3 anos atrás
pai
commit
b324cab114
3 ficheiros alterados com 18 adições e 17 exclusões
  1. 2 3
      src/viewer/helpers/preset.ts
  2. 2 2
      src/viewer/helpers/selection.ts
  3. 14 12
      src/viewer/index.html

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

@@ -105,8 +105,7 @@ export type MotifProps = {
     kind: 'motif',
     label?: string,
     targets: Target[],
-    color?: number,
-    unsafe?: boolean
+    color?: number
 } & BaseProps
 
 export type PresetProps = ValidationProps | StandardProps | SymmetryProps | FeatureProps | DensityProps | PropsetProps |
@@ -212,7 +211,7 @@ export const RcsbPreset = TrajectoryHierarchyPresetProvider({
         } else if (p.kind === 'motif' && structure?.obj) {
             // 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.unsafe ? normalizeTargets(p.targets, structure!.obj.data) : p.targets;
+            const targets = normalizeTargets(p.targets, structure!.obj.data);
             let selectionExpressions = createSelectionExpressions(p.label || model.data!.entryId, targets);
             const globalExpressions = createSelectionExpressions(p.label || model.data!.entryId); // global reps, to be hidden
             selectionExpressions = selectionExpressions.concat(globalExpressions.map(e => { return { ...e, isHidden: true }; }));

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

@@ -50,9 +50,9 @@ export type SelectionExpression = {
  * override pre-existing 'operatorName' values.
  * @param targets collection to process
  * @param structure parent structure
- * @param operatorName optional value to which missing operators are set, will default to 'ASM_1' if not specified
+ * @param operatorName optional value to which missing operators are set
  */
-export function normalizeTargets(targets: Target[], structure: Structure, operatorName: string = 'ASM_1'): Target[] {
+export function normalizeTargets(targets: Target[], structure: Structure, operatorName = undefined): Target[] {
     return targets.map(t => {
         if (t.struct_oper_id) {
             const { struct_oper_id, ...others } = t;

+ 14 - 12
src/viewer/index.html

@@ -504,18 +504,6 @@
 
             function motifsAlphaFold() {
                 viewer.clear()
-                    .then(function() {
-                        const url = 'https://alphafold.ebi.ac.uk/files/AF-F1Q6S1-F1-model_v1.cif';
-                        const label = 'AF-F1Q6S1-F1';
-                        const targets = [
-                            { label_asym_id: "A", struct_oper_id: '1', label_seq_id: 260 },
-                            { label_asym_id: "A", struct_oper_id: '1', label_seq_id: 265 },
-                            { label_asym_id: "A", struct_oper_id: '1', label_seq_id: 283 },
-                            { label_asym_id: "A", struct_oper_id: '1', label_seq_id: 342 },
-                            { label_asym_id: "A", struct_oper_id: '1', label_seq_id: 344 }];
-                        const mat = [-0.471, 0.856, 0.215, 0, 0.405, -0.007, 0.914, 0, 0.784, 0.518, -0.343, 0, 54.981, 65.575, 12.287, 1];
-                        return viewer.loadStructureFromUrl(url, 'mmcif', false, { kind: 'motif', label, targets, unsafe: true }, mat);
-                    })
                     .then(function() {
                         return viewer.loadPdbId('1LAP', {
                             label: '1LAP',
@@ -529,6 +517,20 @@
                             ],
                         });
                     })
+                    .then(function() {
+                        const url = 'https://alphafold.ebi.ac.uk/files/AF-F1Q6S1-F1-model_v1.cif';
+                        const label = 'AF-F1Q6S1-F1';
+                        const targets = [
+                            // AF target must be devoid of struct_oper_id
+                            { label_asym_id: 'A', label_seq_id: 260 },
+                            { label_asym_id: 'A', label_seq_id: 265 },
+                            { label_asym_id: 'A', label_seq_id: 283 },
+                            { label_asym_id: 'A', label_seq_id: 342 },
+                            { label_asym_id: 'A', label_seq_id: 344 }
+                        ];
+                        const mat = [-0.471, 0.856, 0.215, 0, 0.405, -0.007, 0.914, 0, 0.784, 0.518, -0.343, 0, 54.981, 65.575, 12.287, 1];
+                        return viewer.loadStructureFromUrl(url, 'mmcif', false, { kind: 'motif', label, targets, skipTargetNormalization: true }, mat);
+                    })
                     .then(function() {
                         viewer.resetCamera(0)
                     });