Переглянути джерело

sequence & interactivity tweaks

Alexander Rose 5 роки тому
батько
коміт
898abda373

+ 0 - 1
src/mol-plugin/skin/base/components/sequence.scss

@@ -4,7 +4,6 @@
     top: 0;
     left: 0;
     bottom: 0;
-    font-size: 90%;
     background: $sequence-background;
 }
 

+ 1 - 9
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)
     }

+ 4 - 0
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 }
         }
 

+ 1 - 0
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)