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

direction from/to derived residue prop

parent e5293c4d
No related branches found
No related tags found
No related merge requests found
/**
* 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>
}
}
......
......@@ -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>,
}
}
......
......@@ -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'])
......
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