keywords.ts 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /**
  2. * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com>
  6. */
  7. import { MolScriptBuilder } from '../../../mol-script/language/builder';
  8. const B = MolScriptBuilder;
  9. import * as h from '../helper';
  10. import { KeywordDict } from '../types';
  11. const ResDict = {
  12. nucleic: ['A', 'C', 'T', 'G', 'U', 'DA', 'DC', 'DT', 'DG', 'DU'],
  13. protein: ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'CYX', 'GLN', 'GLU', 'GLY', 'HIS', 'HID', 'HIE', 'HIP', 'ILE', 'LEU', 'LYS', 'MET', 'MSE', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'],
  14. solvent: ['HOH', 'WAT', 'H20', 'TIP', 'SOL']
  15. };
  16. const Backbone = {
  17. nucleic: ['P', "O3'", "O5'", "C5'", "C4'", "C3'", 'OP1', 'OP2', 'O3*', 'O5*', 'C5*', 'C4*', 'C3*'],
  18. protein: ['C', 'N', 'CA', 'O']
  19. };
  20. export const keywords: KeywordDict = {
  21. all: {
  22. '@desc': 'All atoms currently loaded into PyMOL',
  23. abbr: ['*'],
  24. map: () => B.struct.generator.all()
  25. },
  26. none: {
  27. '@desc': 'No atoms (empty selection)',
  28. map: () => B.struct.generator.empty()
  29. },
  30. hydrogens: {
  31. '@desc': 'All hydrogen atoms currently loaded into PyMOL',
  32. abbr: ['hydro', 'h.'],
  33. map: () => B.struct.generator.atomGroups({
  34. 'atom-test': B.core.rel.eq([
  35. B.acp('elementSymbol'),
  36. B.es('H')
  37. ])
  38. })
  39. },
  40. hetatm: {
  41. '@desc': 'All atoms loaded from Protein Data Bank HETATM records',
  42. abbr: ['het'],
  43. map: () => B.struct.generator.atomGroups({
  44. 'atom-test': B.core.rel.eq([B.ammp('isHet'), true])
  45. })
  46. },
  47. visible: {
  48. '@desc': 'All atoms in enabled objects with at least one visible representation',
  49. abbr: ['v.']
  50. },
  51. polymer: {
  52. '@desc': 'All atoms on the polymer (not het). Finds atoms with residue identifiers matching a known polymer, such a peptide and DNA.',
  53. abbr: ['pol.'],
  54. map: () => B.struct.generator.atomGroups({
  55. 'residue-test': B.core.set.has([
  56. B.core.type.set(ResDict.nucleic.concat(ResDict.protein)),
  57. B.ammp('label_comp_id')
  58. ])
  59. })
  60. },
  61. sidechain: {
  62. '@desc': 'Polymer non-backbone atoms (new in PyMOL 1.6.1)',
  63. },
  64. present: {
  65. '@desc': 'All atoms with defined coordinates in the current state (used in creating movies)',
  66. abbr: ['pr.']
  67. },
  68. center: {
  69. '@desc': 'Pseudo-atom at the center of the scene'
  70. },
  71. origin: {
  72. '@desc': 'Pseudo-atom at the origin of rotation',
  73. },
  74. enabled: {
  75. '@desc': 'All enabled objects or selections from the object list.',
  76. },
  77. masked: {
  78. '@desc': 'All masked atoms.',
  79. abbr: ['msk.']
  80. },
  81. protected: {
  82. '@desc': 'All protected atoms.',
  83. abbr: ['pr.']
  84. },
  85. bonded: {
  86. '@desc': 'All bonded atoms',
  87. map: () => B.struct.generator.atomGroups({
  88. 'atom-test': B.core.rel.gr([B.struct.atomProperty.core.bondCount({
  89. flags: B.struct.type.bondFlags(['covalent', 'metallic', 'sulfide'])
  90. }), 0])
  91. })
  92. },
  93. donors: {
  94. '@desc': 'All hydrogen bond donor atoms.',
  95. abbr: ['don.']
  96. },
  97. acceptors: {
  98. '@desc': 'All hydrogen bond acceptor atoms.',
  99. abbr: ['acc.']
  100. },
  101. fixed: {
  102. '@desc': 'All fixed atoms.',
  103. abbr: ['fxd.']
  104. },
  105. restrained: {
  106. '@desc': 'All restrained atoms.',
  107. abbr: ['rst.']
  108. },
  109. organic: {
  110. '@desc': 'All atoms in non-polymer organic compounds (e.g. ligands, buffers). Finds carbon-containing molecules that do not match known polymers.',
  111. abbr: ['org.'],
  112. map: () => h.asAtoms(B.struct.modifier.expandProperty({
  113. '0': B.struct.modifier.union([
  114. B.struct.generator.queryInSelection({
  115. '0': B.struct.generator.atomGroups({
  116. 'residue-test': B.core.logic.not([
  117. B.core.set.has([
  118. B.core.type.set(ResDict.nucleic.concat(ResDict.protein)),
  119. B.ammp('label_comp_id')
  120. ])
  121. ])
  122. }),
  123. query: B.struct.generator.atomGroups({
  124. 'atom-test': B.core.rel.eq([
  125. B.es('C'),
  126. B.acp('elementSymbol')
  127. ])
  128. })
  129. })
  130. ]),
  131. property: B.ammp('residueKey')
  132. }))
  133. },
  134. inorganic: {
  135. '@desc': 'All non-polymer inorganic atoms/ions. Finds atoms in molecules that do not contain carbon and do not match any known solvent residues.',
  136. abbr: ['ino.'],
  137. map: () => h.asAtoms(B.struct.modifier.expandProperty({
  138. '0': B.struct.modifier.union([
  139. B.struct.filter.pick({
  140. '0': B.struct.generator.atomGroups({
  141. 'residue-test': B.core.logic.not([
  142. B.core.set.has([
  143. B.core.type.set(ResDict.nucleic.concat(ResDict.protein).concat(ResDict.solvent)),
  144. B.ammp('label_comp_id')
  145. ])
  146. ]),
  147. 'group-by': B.ammp('residueKey')
  148. }),
  149. test: B.core.logic.not([
  150. B.core.set.has([
  151. B.struct.atomSet.propertySet([B.acp('elementSymbol')]),
  152. B.es('C')
  153. ])
  154. ])
  155. })
  156. ]),
  157. property: B.ammp('residueKey')
  158. }))
  159. },
  160. solvent: {
  161. '@desc': 'All water molecules. The hardcoded solvent residue identifiers are currently: HOH, WAT, H20, TIP, SOL.',
  162. abbr: ['sol.'],
  163. map: () => B.struct.generator.atomGroups({
  164. 'residue-test': B.core.set.has([
  165. B.core.type.set(ResDict.solvent),
  166. B.ammp('label_comp_id')
  167. ])
  168. })
  169. },
  170. guide: {
  171. '@desc': 'All protein CA and nucleic acid C4*/C4',
  172. map: () => B.struct.combinator.merge([
  173. B.struct.generator.atomGroups({
  174. 'atom-test': B.core.rel.eq([
  175. B.atomName('CA'),
  176. B.ammp('label_atom_id')
  177. ]),
  178. 'residue-test': B.core.set.has([
  179. B.core.type.set(ResDict.protein),
  180. B.ammp('label_comp_id')
  181. ])
  182. }),
  183. B.struct.generator.atomGroups({
  184. 'atom-test': B.core.set.has([
  185. h.atomNameSet(['C4*', 'C4']),
  186. B.ammp('label_atom_id')
  187. ]),
  188. 'residue-test': B.core.set.has([
  189. B.core.type.set(ResDict.nucleic),
  190. B.ammp('label_comp_id')
  191. ])
  192. })
  193. ]),
  194. },
  195. metals: {
  196. '@desc': 'All metal atoms (new in PyMOL 1.6.1)'
  197. },
  198. backbone: {
  199. '@desc': 'the C, N, CA, and O atoms of a protein and the equivalent atoms in a nucleic acid.',
  200. map: () => B.struct.generator.atomGroups({
  201. 'atom-test': B.core.set.has([
  202. B.core.type.set(Backbone.protein.concat(ResDict.protein)),
  203. B.ammp('label_atom_id')
  204. ])
  205. }),
  206. },
  207. proteinxxxxxx: {
  208. '@desc': 'protein................',
  209. abbr: ['polymer.protein'],
  210. map: () => B.struct.generator.atomGroups({
  211. 'residue-test': B.core.set.has([
  212. B.core.type.set(ResDict.protein),
  213. B.ammp('label_comp_id')
  214. ])
  215. })
  216. },
  217. nucleicxxxxx: {
  218. '@desc': 'protein................',
  219. abbr: ['polymer.nucleic'],
  220. map: () => B.struct.generator.atomGroups({
  221. 'residue-test': B.core.set.has([
  222. B.core.type.set(ResDict.nucleic),
  223. B.ammp('label_comp_id')
  224. ])
  225. })
  226. }
  227. };