structure-complex-helper.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import { PluginContext } from '../context';
  7. import { StateBuilder } from '../../mol-state';
  8. import { PluginStateObject } from '../state/objects';
  9. import { StateTransforms } from '../state/transforms';
  10. import { StructureRepresentation3DHelpers } from '../state/transforms/representation';
  11. import { StructureComplexElementTypes } from '../state/transforms/model';
  12. export function createDefaultStructureComplex(
  13. ctx: PluginContext, root: StateBuilder.To<PluginStateObject.Molecule.Structure>
  14. ) {
  15. root.apply(StateTransforms.Model.StructureComplexElement, { type: 'protein-or-nucleic' }, { tags: StructureComplexElementTypes['protein-or-nucleic'] })
  16. .apply(StateTransforms.Representation.StructureRepresentation3D,
  17. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'cartoon'));
  18. root.apply(StateTransforms.Model.StructureComplexElement, { type: 'ligand' }, { tags: StructureComplexElementTypes.ligand })
  19. .apply(StateTransforms.Representation.StructureRepresentation3D,
  20. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'ball-and-stick'));
  21. root.apply(StateTransforms.Model.StructureComplexElement, { type: 'modified' }, { tags: StructureComplexElementTypes.modified })
  22. .apply(StateTransforms.Representation.StructureRepresentation3D,
  23. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'ball-and-stick', void 0, 'polymer-id'));
  24. const branched = root.apply(StateTransforms.Model.StructureComplexElement, { type: 'branched' }, { tags: StructureComplexElementTypes.branched })
  25. branched.apply(StateTransforms.Representation.StructureRepresentation3D,
  26. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'ball-and-stick', { alpha: 0.15 }));
  27. branched.apply(StateTransforms.Representation.StructureRepresentation3D,
  28. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'carbohydrate'));
  29. root.apply(StateTransforms.Model.StructureComplexElement, { type: 'water' }, { tags: StructureComplexElementTypes.water })
  30. .apply(StateTransforms.Representation.StructureRepresentation3D,
  31. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'ball-and-stick', { alpha: 0.51 }));
  32. root.apply(StateTransforms.Model.StructureComplexElement, { type: 'coarse' }, { tags: StructureComplexElementTypes.coarse })
  33. .apply(StateTransforms.Representation.StructureRepresentation3D,
  34. StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'spacefill', {}, 'polymer-id'));
  35. }