hierarchy.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  6. */
  7. import { Column } from 'mol-data/db'
  8. import { Segmentation } from 'mol-data/int';
  9. import { ElementIndex, ChainIndex, EntityIndex } from '../../indexing';
  10. import SortedRanges from 'mol-data/int/sorted-ranges';
  11. export interface CoarsedElementKeys {
  12. // assign a key to each element
  13. chainKey: ArrayLike<ChainIndex>,
  14. // assign a key to each element, index to the Model.entities.data table
  15. entityKey: ArrayLike<EntityIndex>,
  16. /** find index of the residue/feature element where seq_id is included */
  17. findSequenceKey(entityId: string, asym_id: string, seq_id: number): ElementIndex
  18. findChainKey(entityId: string, asym_id: string): ChainIndex
  19. }
  20. export interface CoarseElementData {
  21. count: number,
  22. entity_id: Column<string>,
  23. asym_id: Column<string>,
  24. seq_id_begin: Column<number>,
  25. seq_id_end: Column<number>,
  26. chainElementSegments: Segmentation<ElementIndex, ChainIndex>,
  27. }
  28. export interface CoarseRanges {
  29. polymerRanges: SortedRanges<ElementIndex>
  30. gapRanges: SortedRanges<ElementIndex>
  31. }
  32. export type CoarseElements = CoarsedElementKeys & CoarseElementData & CoarseRanges
  33. export interface CoarseHierarchy {
  34. isDefined: boolean,
  35. spheres: CoarseElements,
  36. gaussians: CoarseElements
  37. }
  38. export namespace CoarseHierarchy {
  39. export const Empty: CoarseHierarchy = { isDefined: false } as any;
  40. }