model.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import UUID from 'mol-util/uuid'
  7. import Format from './format'
  8. import StructureSequence from './properties/sequence'
  9. import { AtomicHierarchy, AtomicConformation } from './properties/atomic'
  10. import { ModelSymmetry } from './properties/symmetry'
  11. import { CoarseHierarchy, CoarseConformation } from './properties/coarse'
  12. import { Entities } from './properties/common';
  13. import { CustomProperties } from './properties/custom';
  14. import { SecondaryStructure } from './properties/seconday-structure';
  15. import from_mmCIF from './formats/mmcif'
  16. import { ChemicalComponentMap } from './properties/chemical-component';
  17. import { SaccharideComponentMap } from '../structure/carbohydrates/constants';
  18. /**
  19. * Interface to the "source data" of the molecule.
  20. *
  21. * "Atoms" are integers in the range [0, atomCount).
  22. */
  23. export interface Model extends Readonly<{
  24. id: UUID,
  25. label: string,
  26. // for IHM, corresponds to ihm_model_list.model_id
  27. modelNum: number,
  28. sourceData: Format,
  29. symmetry: ModelSymmetry,
  30. entities: Entities,
  31. sequence: StructureSequence,
  32. atomicHierarchy: AtomicHierarchy,
  33. atomicConformation: AtomicConformation,
  34. properties: {
  35. /** secondary structure provided by the input file */
  36. readonly secondaryStructure: SecondaryStructure,
  37. /** maps modified residue name to its parent */
  38. readonly modifiedResidues: Readonly<{
  39. parentId: ReadonlyMap<string, string>,
  40. details: ReadonlyMap<string, string>
  41. }>,
  42. /** maps residue name to `ChemicalComponent` data */
  43. readonly chemicalComponentMap: ChemicalComponentMap
  44. /** maps residue name to `SaccharideComponent` data */
  45. readonly saccharideComponentMap: SaccharideComponentMap
  46. },
  47. customProperties: CustomProperties,
  48. /**
  49. * Not to be accessed directly, each custom property descriptor
  50. * defines property accessors that use this field to store the data.
  51. */
  52. _staticPropertyData: { [name: string]: any },
  53. _dynamicPropertyData: { [name: string]: any },
  54. coarseHierarchy: CoarseHierarchy,
  55. coarseConformation: CoarseConformation
  56. }> {
  57. } { }
  58. export namespace Model {
  59. export function create(format: Format) {
  60. switch (format.kind) {
  61. // case 'gro': return from_gro(format);
  62. case 'mmCIF': return from_mmCIF(format);
  63. }
  64. }
  65. }