Skip to content
Snippets Groups Projects
Commit 898abda3 authored by Alexander Rose's avatar Alexander Rose
Browse files

sequence & interactivity tweaks

parent e42c664a
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@
top: 0;
left: 0;
bottom: 0;
font-size: 90%;
background: $sequence-background;
}
......
......@@ -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)
}
......
......@@ -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 }
}
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment