diff --git a/src/mol-model/structure/model/properties/atomic/hierarchy.ts b/src/mol-model/structure/model/properties/atomic/hierarchy.ts index 0854b3b13fa485b18a100648b271f93ebf317da1..1c12b0be4b5b549f0106350851a60ded5ad2aee6 100644 --- a/src/mol-model/structure/model/properties/atomic/hierarchy.ts +++ b/src/mol-model/structure/model/properties/atomic/hierarchy.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> * @author Alexander Rose <alexander.rose@weirdbyte.de> @@ -113,7 +113,8 @@ export interface AtomicData { export interface AtomicDerivedData { readonly residue: { readonly traceElementIndex: ArrayLike<ElementIndex | -1> - readonly directionElementIndex: ArrayLike<ElementIndex | -1> + readonly directionFromElementIndex: ArrayLike<ElementIndex | -1> + readonly directionToElementIndex: ArrayLike<ElementIndex | -1> readonly moleculeType: ArrayLike<MoleculeType> } } diff --git a/src/mol-model/structure/model/properties/utils/atomic-derived.ts b/src/mol-model/structure/model/properties/utils/atomic-derived.ts index 67f3a8a10bc30b3dacc1601e4457925d07056582..11706d5ada50c1cab3eb8459e681e444d347908d 100644 --- a/src/mol-model/structure/model/properties/utils/atomic-derived.ts +++ b/src/mol-model/structure/model/properties/utils/atomic-derived.ts @@ -15,7 +15,8 @@ export function getAtomicDerivedData(data: AtomicData, index: AtomicIndex, chemi const { label_comp_id, _rowCount: n } = data.residues const traceElementIndex = new Int32Array(n) - const directionElementIndex = new Int32Array(n) + const directionFromElementIndex = new Int32Array(n) + const directionToElementIndex = new Int32Array(n) const moleculeType = new Uint8Array(n) const moleculeTypeMap = new Map<string, MoleculeType>() @@ -44,14 +45,18 @@ export function getAtomicDerivedData(data: AtomicData, index: AtomicIndex, chemi } traceElementIndex[i] = traceIndex - const directionAtomId = getAtomIdForAtomRole(molType, 'direction') - directionElementIndex[i] = index.findAtomsOnResidue(i as ResidueIndex, directionAtomId) + const directionFromAtomId = getAtomIdForAtomRole(molType, 'directionFrom') + directionFromElementIndex[i] = index.findAtomsOnResidue(i as ResidueIndex, directionFromAtomId) + + const directionToAtomId = getAtomIdForAtomRole(molType, 'directionTo') + directionToElementIndex[i] = index.findAtomsOnResidue(i as ResidueIndex, directionToAtomId) } return { residue: { traceElementIndex: traceElementIndex as unknown as ArrayLike<ElementIndex | -1>, - directionElementIndex: directionElementIndex as unknown as ArrayLike<ElementIndex | -1>, + directionFromElementIndex: directionFromElementIndex as unknown as ArrayLike<ElementIndex | -1>, + directionToElementIndex: directionToElementIndex as unknown as ArrayLike<ElementIndex | -1>, moleculeType: moleculeType as unknown as ArrayLike<MoleculeType>, } } diff --git a/src/mol-model/structure/model/types.ts b/src/mol-model/structure/model/types.ts index 89eaf3b4a058e2957e804f517599dcd4c6e4bb70..a41c0d419dd1bd495b362444be3c97104dd3b3d7 100644 --- a/src/mol-model/structure/model/types.ts +++ b/src/mol-model/structure/model/types.ts @@ -59,33 +59,37 @@ export const enum MoleculeType { saccharide } -export type AtomRole = 'trace' | 'direction' | 'backboneStart' | 'backboneEnd' | 'coarseBackbone' +export type AtomRole = 'trace' | 'directionFrom' | 'directionTo' | 'backboneStart' | 'backboneEnd' | 'coarseBackbone' export const MoleculeTypeAtomRoleId: { [k: number]: { [k in AtomRole]: Set<string> } } = { [MoleculeType.protein]: { trace: new Set(['CA']), - direction: new Set(['O', 'OC1', 'O1', 'OX1', 'OXT']), + directionFrom: new Set(['C']), + directionTo: new Set(['O', 'OC1', 'O1', 'OX1', 'OXT']), backboneStart: new Set(['N']), backboneEnd: new Set(['C']), coarseBackbone: new Set(['CA', 'BB']) }, [MoleculeType.RNA]: { trace: new Set(['C4\'', 'C4*']), - direction: new Set(['C3\'', 'C3*']), + directionFrom: new Set(['C4\'', 'C4*']), + directionTo: new Set(['C3\'', 'C3*']), backboneStart: new Set(['P']), backboneEnd: new Set(['O3\'', 'O3*']), coarseBackbone: new Set(['P']) }, [MoleculeType.DNA]: { trace: new Set(['C3\'', 'C3*']), - direction: new Set(['C1\'', 'C1*']), + directionFrom: new Set(['C3\'', 'C3*']), + directionTo: new Set(['C1\'', 'C1*']), backboneStart: new Set(['P']), backboneEnd: new Set(['O3\'', 'O3*']), coarseBackbone: new Set(['P']) }, [MoleculeType.PNA]: { trace: new Set(['N4\'', 'N4*']), - direction: new Set(['C7\'', 'C7*']), + directionFrom: new Set(['N4\'', 'N4*']), + directionTo: new Set(['C7\'', 'C7*']), backboneStart: new Set(['N1\'', 'N1*']), backboneEnd: new Set(['C\'', 'C*']), coarseBackbone: new Set(['P'])