Browse Source

mol-model: renamed StructureSelection.toLoci*

David Sehnal 5 năm trước cách đây
mục cha
commit
6ac790e083

+ 1 - 1
src/apps/basic-wrapper/index.ts

@@ -158,7 +158,7 @@ class BasicWrapper {
                 }));
             const data = (this.plugin.state.dataState.select('asm')[0].obj as PluginStateObject.Molecule.Structure).data;
             const sel = query(new QueryContext(data));
-            const loci = StructureSelection.toLoci2(sel);
+            const loci = StructureSelection.toLociWithSourceUnits(sel);
             this.plugin.interactivity.lociHighlights.highlightOnly({ loci });
         },
         clearHighlight: () => {

+ 1 - 1
src/apps/basic-wrapper/superposition.ts

@@ -86,7 +86,7 @@ export async function dynamicSuperpositionTest(ctx: PluginContext, src: string[]
 
     const query = compile<StructureSelection>(pivot);
     const xs = state.select(StateSelection.Generators.rootsOfType(PSO.Molecule.Structure));
-    const selections = xs.map(s => StructureSelection.toLoci(query(new QueryContext(s.obj!.data))));
+    const selections = xs.map(s => StructureSelection.toLociWithCurrentUnits(query(new QueryContext(s.obj!.data))));
 
     const transforms = superposeStructures(selections);
     const visuals = state.build();

+ 3 - 2
src/mol-model/structure/query/selection.ts

@@ -35,7 +35,8 @@ namespace StructureSelection {
         return structureUnion(sel.source, sel.structures);
     }
 
-    export function toLoci(sel: StructureSelection): StructureElement.Loci {
+    /** Convert selection to loci and use "current structure units" in Loci elements */
+    export function toLociWithCurrentUnits(sel: StructureSelection): StructureElement.Loci {
         const elements: { unit: Unit, indices: OrderedSet<StructureElement.UnitIndex> }[] = [];
         const { unitMap } = sel.source;
 
@@ -57,7 +58,7 @@ namespace StructureSelection {
     }
 
     /** use source unit in loci.elements */
-    export function toLoci2(sel: StructureSelection): StructureElement.Loci {
+    export function toLociWithSourceUnits(sel: StructureSelection): StructureElement.Loci {
         const elements: { unit: Unit, indices: OrderedSet<StructureElement.UnitIndex> }[] = [];
         const { unitMap } = sel.source;
 

+ 1 - 1
src/mol-plugin/ui/sequence/polymer.ts

@@ -58,7 +58,7 @@ export class PolymerSequenceWrapper extends SequenceWrapper<StructureUnit> {
 
     getLoci(seqIdx: number) {
         const query = createResidueQuery(this.data.unit.id, this.seqId(seqIdx));
-        return StructureSelection.toLoci2(StructureQuery.run(query, this.data.structure));
+        return StructureSelection.toLociWithSourceUnits(StructureQuery.run(query, this.data.structure));
     }
 
     constructor(data: StructureUnit) {

+ 1 - 1
src/mol-plugin/util/structure-representation-helper.ts

@@ -100,7 +100,7 @@ export class StructureRepresentationHelper {
         return this.set(modifier, type, (structure) => {
             const compiled = compile<StructureSelection>(expression)
             const result = compiled(new QueryContext(structure))
-            return StructureSelection.toLoci2(result)
+            return StructureSelection.toLociWithSourceUnits(result)
         }, props)
     }
 

+ 1 - 1
src/mol-plugin/util/structure-selection-helper.ts

@@ -242,7 +242,7 @@ export class StructureSelectionHelper {
         for (const so of this.structures) {
             const s = so.obj!.data
             const result = compiled(new QueryContext(s))
-            const loci = StructureSelection.toLoci2(result)
+            const loci = StructureSelection.toLociWithSourceUnits(result)
             this._set(modifier, loci)
         }
     }

+ 1 - 1
src/mol-script/script.ts

@@ -43,6 +43,6 @@ namespace Script {
     export function toLoci(script: Script, structure: Structure): StructureElement.Loci {
         const query = toQuery(script)
         const result = query(new QueryContext(structure))
-        return StructureSelection.toLoci2(result)
+        return StructureSelection.toLociWithSourceUnits(result)
     }
 }