Ver Fonte

make motif preset work on AlphaFold files

Sebastian Bittrich há 3 anos atrás
pai
commit
f2274dc335
2 ficheiros alterados com 25 adições e 2 exclusões
  1. 3 2
      src/viewer/helpers/preset.ts
  2. 22 0
      src/viewer/index.html

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

@@ -105,7 +105,8 @@ export type MotifProps = {
     kind: 'motif',
     label?: string,
     targets: Target[],
-    color?: number
+    color?: number,
+    unsafe?: boolean
 } & BaseProps
 
 export type PresetProps = ValidationProps | StandardProps | SymmetryProps | FeatureProps | DensityProps | PropsetProps |
@@ -211,7 +212,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 = normalizeTargets(p.targets, structure!.obj.data);
+            const targets = !p.unsafe ? normalizeTargets(p.targets, structure!.obj.data) : p.targets;
             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 }; }));

+ 22 - 0
src/viewer/index.html

@@ -94,6 +94,9 @@
             <button style="padding: 3px;" onclick="motifs2()">Motifs 2</button>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
+            <button style="padding: 3px;" onclick="motifsAlphaFold()">Motifs AF</button>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+
             <button style="padding: 3px" onclick="propset()">Propset</button>
         </div>
         <script>
@@ -499,6 +502,25 @@
                     });
             }
 
+            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, { assemblyId: '1', kind: 'motif', label, targets, unsafe: true }, mat);
+                    })
+                    .then(function() {
+                        viewer.resetCamera(0)
+                    });
+            }
+
             function propset() {
                 viewer.clear()
                     .then(function () {