From 6ac790e083a324131231a542b74202b750c33214 Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Tue, 15 Oct 2019 08:49:06 +0200 Subject: [PATCH] mol-model: renamed StructureSelection.toLoci* --- src/apps/basic-wrapper/index.ts | 2 +- src/apps/basic-wrapper/superposition.ts | 2 +- src/mol-model/structure/query/selection.ts | 5 +++-- src/mol-plugin/ui/sequence/polymer.ts | 2 +- src/mol-plugin/util/structure-representation-helper.ts | 2 +- src/mol-plugin/util/structure-selection-helper.ts | 2 +- src/mol-script/script.ts | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apps/basic-wrapper/index.ts b/src/apps/basic-wrapper/index.ts index 8c95790d8..df699f99d 100644 --- a/src/apps/basic-wrapper/index.ts +++ b/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: () => { diff --git a/src/apps/basic-wrapper/superposition.ts b/src/apps/basic-wrapper/superposition.ts index b18e62435..6197fbc42 100644 --- a/src/apps/basic-wrapper/superposition.ts +++ b/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(); diff --git a/src/mol-model/structure/query/selection.ts b/src/mol-model/structure/query/selection.ts index f19064aab..8ddc41813 100644 --- a/src/mol-model/structure/query/selection.ts +++ b/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; diff --git a/src/mol-plugin/ui/sequence/polymer.ts b/src/mol-plugin/ui/sequence/polymer.ts index 52376995e..0dfa77a1d 100644 --- a/src/mol-plugin/ui/sequence/polymer.ts +++ b/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) { diff --git a/src/mol-plugin/util/structure-representation-helper.ts b/src/mol-plugin/util/structure-representation-helper.ts index 5cd38db19..a3d1be709 100644 --- a/src/mol-plugin/util/structure-representation-helper.ts +++ b/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) } diff --git a/src/mol-plugin/util/structure-selection-helper.ts b/src/mol-plugin/util/structure-selection-helper.ts index d8016b318..5ff06f836 100644 --- a/src/mol-plugin/util/structure-selection-helper.ts +++ b/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) } } diff --git a/src/mol-script/script.ts b/src/mol-script/script.ts index c34672bd1..653a68f89 100644 --- a/src/mol-script/script.ts +++ b/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) } } \ No newline at end of file -- GitLab