/** * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal * @author Alexander Rose */ import { CustomElementProperty } from '../../mol-model-props/common/custom-element-property'; import { Model, ElementIndex } from '../../mol-model/structure'; import { Color } from '../../mol-util/color'; const ColorMap = [ Color(0xff0000), Color(0x0000ff), Color(0xffff00) ]; export const StripedResidues = CustomElementProperty.create({ label: 'TMDet Topology Colors', name: 'tmdet-topology-colors', getData(model: Model) { console.log('getData', model.atomicHierarchy.residueAtomSegments); console.log('getData: auth_comp_id', model.atomicHierarchy.atoms.auth_comp_id.toArray()); const map = new Map(); const residueIndex = model.atomicHierarchy.residueAtomSegments.index; for (let i = 0, _i = model.atomicHierarchy.atoms._rowCount; i < _i; i++) { const residueId = residueIndex[i]; const value = (residueId === 310) ? 2 : residueId % 2; map.set(i as ElementIndex, value); } console.log('map', map); return { value: map }; }, coloring: { getColor(e) { return ColorMap[e]; }, defaultColor: Color(0x777777) }, getLabel(e) { return e === 0 ? 'Odd stripe' : 'Even stripe'; } });