diff --git a/src/apps/basic-wrapper/index.ts b/src/apps/basic-wrapper/index.ts index 8c95790d8b1b47551e4373729615ba3e989b0a9a..df699f99d4cb57bf3d7285c5d5867a5c0480a67c 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 b18e62435a2c6ad26e957897973cba4c0932d8ee..6197fbc42f18bb093b2c80c886ca266c114c28e5 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 f19064aab761a4da1656ca346dfb3c534a617c98..8ddc41813c192588674b3096a05d06b3d7908a1d 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 52376995ebad4939458a040ed66f00a809150b43..0dfa77a1d061c31dd80a2e6043b81be9abe4342d 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 5cd38db1908b4e1e980231ca00a32501ce883383..a3d1be70901bc4d0919ab5efc9c746044f15f9d9 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 d8016b318a66ec8a23abbda51e7716ac3376b8a2..5ff06f836d6d9470c7a2488178ab80bfa07bd04d 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 c34672bd16bd32c55dd4abec1648d740d5edc140..653a68f89556c47f88083c031c1ddfad421af1b4 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