From 72190cf91d7b94768c85ccf6d784a3e28ca38c06 Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Thu, 5 Jul 2018 15:34:51 +0200 Subject: [PATCH] Renamed SecondaryStructure 'index' back to 'key' --- src/apps/structure-info/model.ts | 6 +++--- .../export/categories/secondary-structure.ts | 6 +++--- .../model/formats/mmcif/secondary-structure.ts | 14 +++++++------- .../model/properties/seconday-structure.ts | 2 +- src/mol-model/structure/structure/properties.ts | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/apps/structure-info/model.ts b/src/apps/structure-info/model.ts index a4f8ddf66..b6a66fcf6 100644 --- a/src/apps/structure-info/model.ts +++ b/src/apps/structure-info/model.ts @@ -49,16 +49,16 @@ export function residueLabel(model: Model, rI: number) { export function printSecStructure(model: Model) { console.log('\nSecondary Structure\n============='); const { residues } = model.atomicHierarchy; - const { index, elements } = model.properties.secondaryStructure; + const { key, elements } = model.properties.secondaryStructure; const count = residues._rowCount; let rI = 0; while (rI < count) { let start = rI; - while (rI < count && index[start] === index[rI]) rI++; + while (rI < count && key[start] === key[rI]) rI++; rI--; - const e = elements[index[start]]; + const e = elements[key[start]]; if (e.kind !== 'none') console.log(`${e.kind}: ${residueLabel(model, start)} - ${residueLabel(model, rI)}`); rI++; } diff --git a/src/mol-model/structure/export/categories/secondary-structure.ts b/src/mol-model/structure/export/categories/secondary-structure.ts index cc27294ab..35936e165 100644 --- a/src/mol-model/structure/export/categories/secondary-structure.ts +++ b/src/mol-model/structure/export/categories/secondary-structure.ts @@ -75,7 +75,7 @@ interface SSElement<T extends SecondaryStructure.Element> { } function findElements<T extends SecondaryStructure.Element>(ctx: CifExportContext, kind: SecondaryStructure.Element['kind']) { - const { index, elements } = ctx.model.properties.secondaryStructure; + const { key, elements } = ctx.model.properties.secondaryStructure; const ssElements: SSElement<any>[] = []; @@ -91,7 +91,7 @@ function findElements<T extends SecondaryStructure.Element>(ctx: CifExportContex if (move) current = residues.move(); const start = current!.index; - const startIdx = index[start]; + const startIdx = key[start]; const element = elements[startIdx]; if (element.kind !== kind) { move = true; @@ -102,7 +102,7 @@ function findElements<T extends SecondaryStructure.Element>(ctx: CifExportContex while (residues.hasNext) { prev = current!.index; current = residues.move(); - if (startIdx !== index[current.index]) { + if (startIdx !== key[current.index]) { move = false; ssElements[ssElements.length] = { start: Element.Location(unit, segs.segments[start]), diff --git a/src/mol-model/structure/model/formats/mmcif/secondary-structure.ts b/src/mol-model/structure/model/formats/mmcif/secondary-structure.ts index 15ff80bb2..0c045f605 100644 --- a/src/mol-model/structure/model/formats/mmcif/secondary-structure.ts +++ b/src/mol-model/structure/model/formats/mmcif/secondary-structure.ts @@ -20,7 +20,7 @@ export function getSecondaryStructureMmCif(data: mmCIF_Database, hierarchy: Atom const secStruct: SecondaryStructureData = { type: new Int32Array(hierarchy.residues._rowCount) as any, - index: new Int32Array(hierarchy.residues._rowCount) as any, + key: new Int32Array(hierarchy.residues._rowCount) as any, elements }; @@ -34,10 +34,10 @@ type SecondaryStructureEntry = { endSeqNumber: number, endInsCode: string | null, type: SecondaryStructureType, - index: number + key: number } type SecondaryStructureMap = Map<string, Map<number, SecondaryStructureEntry>> -type SecondaryStructureData = { type: SecondaryStructureType[], index: number[], elements: SecondaryStructure.Element[] } +type SecondaryStructureData = { type: SecondaryStructureType[], key: number[], elements: SecondaryStructure.Element[] } function addHelices(cat: mmCIF['struct_conf'], map: SecondaryStructureMap, elements: SecondaryStructure.Element[]) { if (!cat._rowCount) return; @@ -66,7 +66,7 @@ function addHelices(cat: mmCIF['struct_conf'], map: SecondaryStructureMap, eleme endSeqNumber: end_label_seq_id.value(i), endInsCode: pdbx_end_PDB_ins_code.value(i), type, - index: elements.length + key: elements.length }; elements[elements.length] = element; @@ -112,7 +112,7 @@ function addSheets(cat: mmCIF['struct_sheet_range'], map: SecondaryStructureMap, endSeqNumber: end_label_seq_id.value(i), endInsCode: pdbx_end_PDB_ins_code.value(i), type, - index: elements.length + key: elements.length }; elements[elements.length] = element; @@ -131,13 +131,13 @@ function addSheets(cat: mmCIF['struct_sheet_range'], map: SecondaryStructureMap, function assignSecondaryStructureEntry(hierarchy: AtomicHierarchy, entry: SecondaryStructureEntry, resStart: number, resEnd: number, data: SecondaryStructureData) { const { label_seq_id, pdbx_PDB_ins_code } = hierarchy.residues; - const { endSeqNumber, endInsCode, index, type } = entry; + const { endSeqNumber, endInsCode, key, type } = entry; let rI = resStart; while (rI < resEnd) { const seqNumber = label_seq_id.value(rI); data.type[rI] = type; - data.index[rI] = index; + data.key[rI] = key; if ((seqNumber > endSeqNumber) || (seqNumber === endSeqNumber && pdbx_PDB_ins_code.value(rI) === endInsCode)) { diff --git a/src/mol-model/structure/model/properties/seconday-structure.ts b/src/mol-model/structure/model/properties/seconday-structure.ts index 5ecfb439c..49618f007 100644 --- a/src/mol-model/structure/model/properties/seconday-structure.ts +++ b/src/mol-model/structure/model/properties/seconday-structure.ts @@ -11,7 +11,7 @@ interface SecondaryStructure { readonly type: ArrayLike<SecondaryStructureType>, /** index into the elements array */ - readonly index: ArrayLike<number>, + readonly key: ArrayLike<number>, /** indexed by key */ readonly elements: ReadonlyArray<SecondaryStructure.Element> } diff --git a/src/mol-model/structure/structure/properties.ts b/src/mol-model/structure/structure/properties.ts index 7a3e8f789..d13f5ddd8 100644 --- a/src/mol-model/structure/structure/properties.ts +++ b/src/mol-model/structure/structure/properties.ts @@ -59,7 +59,7 @@ const residue = { // Properties secondary_structure_type: Element.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.properties.secondaryStructure.type[l.unit.residueIndex[l.element]]), - secondary_structure_key: Element.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.properties.secondaryStructure.index[l.unit.residueIndex[l.element]]), + secondary_structure_key: Element.property(l => !Unit.isAtomic(l.unit) ? notAtomic() : l.unit.model.properties.secondaryStructure.key[l.unit.residueIndex[l.element]]), } const chain = { -- GitLab