From 898abda373165a87cda0ac7b30d91537953f2e8c Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Fri, 21 Jun 2019 10:56:17 -0700 Subject: [PATCH] sequence & interactivity tweaks --- src/mol-plugin/skin/base/components/sequence.scss | 1 - src/mol-plugin/ui/sequence/polymer.ts | 10 +--------- src/mol-plugin/util/interactivity.ts | 4 ++++ src/mol-plugin/util/structure-element-selection.ts | 1 + 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mol-plugin/skin/base/components/sequence.scss b/src/mol-plugin/skin/base/components/sequence.scss index 31ae7767d..3176df959 100644 --- a/src/mol-plugin/skin/base/components/sequence.scss +++ b/src/mol-plugin/skin/base/components/sequence.scss @@ -4,7 +4,6 @@ top: 0; left: 0; bottom: 0; - font-size: 90%; background: $sequence-background; } diff --git a/src/mol-plugin/ui/sequence/polymer.ts b/src/mol-plugin/ui/sequence/polymer.ts index 077b21596..dc02ba205 100644 --- a/src/mol-plugin/ui/sequence/polymer.ts +++ b/src/mol-plugin/ui/sequence/polymer.ts @@ -14,16 +14,13 @@ export type StructureUnit = { structure: Structure, unit: Unit } export class PolymerSequenceWrapper extends SequenceWrapper<StructureUnit> { private readonly location = StructureElement.create() - private entityId: string - private label_asym_id: string - eachResidue(loci: Loci, apply: (interval: Interval) => boolean) { let changed = false const { structure, unit } = this.data if (!StructureElement.isLoci(loci)) return false if (!Structure.areParentsEquivalent(loci.structure, structure)) return false - const { location, label_asym_id } = this + const { location } = this for (const e of loci.elements) { let rIprev = -1 location.unit = e.unit @@ -36,7 +33,6 @@ export class PolymerSequenceWrapper extends SequenceWrapper<StructureUnit> { // avoid checking for the same residue multiple times if (rI !== rIprev) { if (SP.unit.id(location) !== unit.id) return - if (SP.chain.label_asym_id(location) !== label_asym_id) return if (apply(getSeqIdInterval(location))) changed = true rIprev = rI @@ -58,10 +54,6 @@ export class PolymerSequenceWrapper extends SequenceWrapper<StructureUnit> { l.unit = data.unit l.element = data.unit.elements[0] - this.entityId = SP.entity.id(l) - this.label_asym_id = SP.chain.label_asym_id(l) - - this.label = `${this.label_asym_id}|${this.entityId}` this.sequence = data.unit.model.sequence.byEntityKey[SP.entity.key(l)].sequence this.markerArray = new Uint8Array(this.sequence.sequence.length) } diff --git a/src/mol-plugin/util/interactivity.ts b/src/mol-plugin/util/interactivity.ts index f44f6e6b4..61fff02d1 100644 --- a/src/mol-plugin/util/interactivity.ts +++ b/src/mol-plugin/util/interactivity.ts @@ -93,9 +93,13 @@ namespace Interactivity { normalizedLoci(interactivityLoci: Loci) { let { loci, repr } = interactivityLoci if (this.props.granularity !== 'element' && Link.isLoci(loci)) { + // convert Link.Loci to a StructureElement.Loci so granularity can be applied loci = Link.toStructureElementLoci(loci) } loci = Granularity[this.props.granularity](loci) + if (StructureElement.isLoci(loci) && loci.structure.parent) { + loci = StructureElement.Loci.remap(loci, loci.structure.parent) + } return { loci, repr } } diff --git a/src/mol-plugin/util/structure-element-selection.ts b/src/mol-plugin/util/structure-element-selection.ts index 6e72ccf6b..80e981e8a 100644 --- a/src/mol-plugin/util/structure-element-selection.ts +++ b/src/mol-plugin/util/structure-element-selection.ts @@ -167,6 +167,7 @@ function SelectionEntry(s: Structure): SelectionEntry { }; } +/** remap `selection-entry` to be related to `structure` if possible */ function remapSelectionEntry(e: SelectionEntry, s: Structure): SelectionEntry { return { selection: StructureElement.Loci.remap(e.selection, s) -- GitLab