diff --git a/src/apps/structure-info/model.ts b/src/apps/structure-info/model.ts index a4f8ddf662a475d36aaa2bbb169d05f7416d1de3..b6a66fcf6aa54b9d06f42d02bd3bc5369ccfab43 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 cc27294ab59d4d5cb3e3819c8cd6b6106f4499d1..35936e1652cc3da117ebabbe1a95d0b855f06662 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 15ff80bb249708be442c5851cdc354ec299f7f19..0c045f6052e08bcd1b940eb3b4e940e51fdfdae7 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 5ecfb439c00ff7f20d198e3a729707e1f89f6b47..49618f0071fc1974657ffd2f01cd1ffaf5c18d31 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 7a3e8f789c618029d548a1baafda5025f1aa17ea..d13f5ddd88a4de7f85ee503e589925e244e0d621 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 = {