app.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. /**
  2. * Copyright (c) 2018-2022 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 { ANVILMembraneOrientation } from '../../extensions/anvil/behavior';
  8. import { CellPack } from '../../extensions/cellpack';
  9. import { DnatcoConfalPyramids } from '../../extensions/dnatco';
  10. import { G3DFormat, G3dProvider } from '../../extensions/g3d/format';
  11. import { GeometryExport } from '../../extensions/geo-export';
  12. import { MAQualityAssessment } from '../../extensions/model-archive/quality-assessment/behavior';
  13. import { QualityAssessmentPLDDTPreset, QualityAssessmentQmeanPreset } from '../../extensions/model-archive/quality-assessment/behavior';
  14. import { QualityAssessment } from '../../extensions/model-archive/quality-assessment/prop';
  15. import { ModelExport } from '../../extensions/model-export';
  16. import { Mp4Export } from '../../extensions/mp4-export';
  17. import { PDBeStructureQualityReport } from '../../extensions/pdbe';
  18. import { RCSBAssemblySymmetry, RCSBValidationReport } from '../../extensions/rcsb';
  19. import { DownloadStructure, PdbDownloadProvider } from '../../mol-plugin-state/actions/structure';
  20. import { DownloadDensity } from '../../mol-plugin-state/actions/volume';
  21. import { PresetTrajectoryHierarchy } from '../../mol-plugin-state/builder/structure/hierarchy-preset';
  22. import { PresetStructureRepresentations, StructureRepresentationPresetProvider } from '../../mol-plugin-state/builder/structure/representation-preset';
  23. import { DataFormatProvider } from '../../mol-plugin-state/formats/provider';
  24. import { BuildInStructureFormat } from '../../mol-plugin-state/formats/structure';
  25. import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
  26. import { BuildInVolumeFormat } from '../../mol-plugin-state/formats/volume';
  27. import { createVolumeRepresentationParams } from '../../mol-plugin-state/helpers/volume-representation-params';
  28. import { PluginStateObject } from '../../mol-plugin-state/objects';
  29. import { StateTransforms } from '../../mol-plugin-state/transforms';
  30. import { TrajectoryFromModelAndCoordinates } from '../../mol-plugin-state/transforms/model';
  31. import { createPluginUI } from '../../mol-plugin-ui';
  32. import { PluginUIContext } from '../../mol-plugin-ui/context';
  33. import { DefaultPluginUISpec, PluginUISpec } from '../../mol-plugin-ui/spec';
  34. import { PluginCommands } from '../../mol-plugin/commands';
  35. import { PluginConfig } from '../../mol-plugin/config';
  36. import { PluginLayoutControlsDisplay } from '../../mol-plugin/layout';
  37. import { PluginSpec } from '../../mol-plugin/spec';
  38. import { PluginState } from '../../mol-plugin/state';
  39. import { StateObjectRef, StateObjectSelector } from '../../mol-state';
  40. import { Asset } from '../../mol-util/assets';
  41. import { Color } from '../../mol-util/color';
  42. import '../../mol-util/polyfill';
  43. import { ObjectKeys } from '../../mol-util/type-helpers';
  44. export { PLUGIN_VERSION as version } from '../../mol-plugin/version';
  45. export { setDebugMode, setProductionMode } from '../../mol-util/debug';
  46. const CustomFormats = [
  47. ['g3d', G3dProvider] as const
  48. ];
  49. const Extensions = {
  50. 'cellpack': PluginSpec.Behavior(CellPack),
  51. 'dnatco-confal-pyramids': PluginSpec.Behavior(DnatcoConfalPyramids),
  52. 'pdbe-structure-quality-report': PluginSpec.Behavior(PDBeStructureQualityReport),
  53. 'rcsb-assembly-symmetry': PluginSpec.Behavior(RCSBAssemblySymmetry),
  54. 'rcsb-validation-report': PluginSpec.Behavior(RCSBValidationReport),
  55. 'anvil-membrane-orientation': PluginSpec.Behavior(ANVILMembraneOrientation),
  56. 'g3d': PluginSpec.Behavior(G3DFormat),
  57. 'model-export': PluginSpec.Behavior(ModelExport),
  58. 'mp4-export': PluginSpec.Behavior(Mp4Export),
  59. 'geo-export': PluginSpec.Behavior(GeometryExport),
  60. 'ma-quality-assessment': PluginSpec.Behavior(MAQualityAssessment),
  61. };
  62. const DefaultViewerOptions = {
  63. customFormats: CustomFormats as [string, DataFormatProvider][],
  64. extensions: ObjectKeys(Extensions),
  65. layoutIsExpanded: true,
  66. layoutShowControls: true,
  67. layoutShowRemoteState: true,
  68. layoutControlsDisplay: 'reactive' as PluginLayoutControlsDisplay,
  69. layoutShowSequence: true,
  70. layoutShowLog: true,
  71. layoutShowLeftPanel: true,
  72. collapseLeftPanel: false,
  73. collapseRightPanel: false,
  74. disableAntialiasing: PluginConfig.General.DisableAntialiasing.defaultValue,
  75. pixelScale: PluginConfig.General.PixelScale.defaultValue,
  76. pickScale: PluginConfig.General.PickScale.defaultValue,
  77. pickPadding: PluginConfig.General.PickPadding.defaultValue,
  78. enableWboit: PluginConfig.General.EnableWboit.defaultValue,
  79. preferWebgl1: PluginConfig.General.PreferWebGl1.defaultValue,
  80. viewportShowExpand: PluginConfig.Viewport.ShowExpand.defaultValue,
  81. viewportShowControls: PluginConfig.Viewport.ShowControls.defaultValue,
  82. viewportShowSettings: PluginConfig.Viewport.ShowSettings.defaultValue,
  83. viewportShowSelectionMode: PluginConfig.Viewport.ShowSelectionMode.defaultValue,
  84. viewportShowAnimation: PluginConfig.Viewport.ShowAnimation.defaultValue,
  85. pluginStateServer: PluginConfig.State.DefaultServer.defaultValue,
  86. volumeStreamingServer: PluginConfig.VolumeStreaming.DefaultServer.defaultValue,
  87. volumeStreamingDisabled: !PluginConfig.VolumeStreaming.Enabled.defaultValue,
  88. pdbProvider: PluginConfig.Download.DefaultPdbProvider.defaultValue,
  89. emdbProvider: PluginConfig.Download.DefaultEmdbProvider.defaultValue,
  90. };
  91. type ViewerOptions = typeof DefaultViewerOptions;
  92. export class Viewer {
  93. constructor(public plugin: PluginUIContext) {
  94. }
  95. static async create(elementOrId: string | HTMLElement, options: Partial<ViewerOptions> = {}) {
  96. const definedOptions = {} as any;
  97. // filter for defined properies only so the default values
  98. // are property applied
  99. for (const p of Object.keys(options) as (keyof ViewerOptions)[]) {
  100. if (options[p] !== void 0) definedOptions[p] = options[p];
  101. }
  102. const o: ViewerOptions = { ...DefaultViewerOptions, ...definedOptions };
  103. const defaultSpec = DefaultPluginUISpec();
  104. const spec: PluginUISpec = {
  105. actions: defaultSpec.actions,
  106. behaviors: [
  107. ...defaultSpec.behaviors,
  108. ...o.extensions.map(e => Extensions[e]),
  109. ],
  110. animations: [...defaultSpec.animations || []],
  111. customParamEditors: defaultSpec.customParamEditors,
  112. customFormats: o?.customFormats,
  113. layout: {
  114. initial: {
  115. isExpanded: o.layoutIsExpanded,
  116. showControls: o.layoutShowControls,
  117. controlsDisplay: o.layoutControlsDisplay,
  118. regionState: {
  119. bottom: 'full',
  120. left: o.collapseLeftPanel ? 'collapsed' : 'full',
  121. right: o.collapseRightPanel ? 'hidden' : 'full',
  122. top: 'full',
  123. }
  124. },
  125. },
  126. components: {
  127. ...defaultSpec.components,
  128. controls: {
  129. ...defaultSpec.components?.controls,
  130. top: o.layoutShowSequence ? undefined : 'none',
  131. bottom: o.layoutShowLog ? undefined : 'none',
  132. left: o.layoutShowLeftPanel ? undefined : 'none',
  133. },
  134. remoteState: o.layoutShowRemoteState ? 'default' : 'none',
  135. },
  136. config: [
  137. [PluginConfig.General.DisableAntialiasing, o.disableAntialiasing],
  138. [PluginConfig.General.PixelScale, o.pixelScale],
  139. [PluginConfig.General.PickScale, o.pickScale],
  140. [PluginConfig.General.PickPadding, o.pickPadding],
  141. [PluginConfig.General.EnableWboit, o.enableWboit],
  142. [PluginConfig.General.PreferWebGl1, o.preferWebgl1],
  143. [PluginConfig.Viewport.ShowExpand, o.viewportShowExpand],
  144. [PluginConfig.Viewport.ShowControls, o.viewportShowControls],
  145. [PluginConfig.Viewport.ShowSettings, o.viewportShowSettings],
  146. [PluginConfig.Viewport.ShowSelectionMode, o.viewportShowSelectionMode],
  147. [PluginConfig.Viewport.ShowAnimation, o.viewportShowAnimation],
  148. [PluginConfig.State.DefaultServer, o.pluginStateServer],
  149. [PluginConfig.State.CurrentServer, o.pluginStateServer],
  150. [PluginConfig.VolumeStreaming.DefaultServer, o.volumeStreamingServer],
  151. [PluginConfig.VolumeStreaming.Enabled, !o.volumeStreamingDisabled],
  152. [PluginConfig.Download.DefaultPdbProvider, o.pdbProvider],
  153. [PluginConfig.Download.DefaultEmdbProvider, o.emdbProvider],
  154. [PluginConfig.Structure.DefaultRepresentationPreset, ViewerAutoPreset.id],
  155. ]
  156. };
  157. const element = typeof elementOrId === 'string'
  158. ? document.getElementById(elementOrId)
  159. : elementOrId;
  160. if (!element) throw new Error(`Could not get element with id '${elementOrId}'`);
  161. const plugin = await createPluginUI(element, spec, {
  162. onBeforeUIRender: plugin => {
  163. // the preset needs to be added before the UI renders otherwise
  164. // "Download Structure" wont be able to pick it up
  165. plugin.builders.structure.representation.registerPreset(ViewerAutoPreset);
  166. }
  167. });
  168. return new Viewer(plugin);
  169. }
  170. setRemoteSnapshot(id: string) {
  171. const url = `${this.plugin.config.get(PluginConfig.State.CurrentServer)}/get/${id}`;
  172. return PluginCommands.State.Snapshots.Fetch(this.plugin, { url });
  173. }
  174. loadSnapshotFromUrl(url: string, type: PluginState.SnapshotType) {
  175. return PluginCommands.State.Snapshots.OpenUrl(this.plugin, { url, type });
  176. }
  177. loadStructureFromUrl(url: string, format: BuiltInTrajectoryFormat = 'mmcif', isBinary = false, options?: LoadStructureOptions) {
  178. const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
  179. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
  180. source: {
  181. name: 'url',
  182. params: {
  183. url: Asset.Url(url),
  184. format: format as any,
  185. isBinary,
  186. options: { ...params.source.params.options, representationParams: options?.representationParams as any },
  187. }
  188. }
  189. }));
  190. }
  191. async loadAllModelsOrAssemblyFromUrl(url: string, format: BuiltInTrajectoryFormat = 'mmcif', isBinary = false, options?: LoadStructureOptions) {
  192. const plugin = this.plugin;
  193. const data = await plugin.builders.data.download({ url, isBinary }, { state: { isGhost: true } });
  194. const trajectory = await plugin.builders.structure.parseTrajectory(data, format);
  195. await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'all-models', { useDefaultIfSingleModel: true, representationPresetParams: options?.representationParams });
  196. }
  197. async loadStructureFromData(data: string | number[], format: BuiltInTrajectoryFormat, options?: { dataLabel?: string }) {
  198. const _data = await this.plugin.builders.data.rawData({ data, label: options?.dataLabel });
  199. const trajectory = await this.plugin.builders.structure.parseTrajectory(_data, format);
  200. await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default');
  201. }
  202. loadPdb(pdb: string, options?: LoadStructureOptions) {
  203. const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
  204. const provider = this.plugin.config.get(PluginConfig.Download.DefaultPdbProvider)!;
  205. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
  206. source: {
  207. name: 'pdb' as const,
  208. params: {
  209. provider: {
  210. id: pdb,
  211. server: {
  212. name: provider,
  213. params: PdbDownloadProvider[provider].defaultValue as any
  214. }
  215. },
  216. options: { ...params.source.params.options, representationParams: options?.representationParams as any },
  217. }
  218. }
  219. }));
  220. }
  221. loadPdbDev(pdbDev: string) {
  222. const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
  223. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
  224. source: {
  225. name: 'pdb-dev' as const,
  226. params: {
  227. provider: {
  228. id: pdbDev,
  229. encoding: 'bcif',
  230. },
  231. options: params.source.params.options,
  232. }
  233. }
  234. }));
  235. }
  236. loadEmdb(emdb: string, options?: { detail?: number }) {
  237. const provider = this.plugin.config.get(PluginConfig.Download.DefaultEmdbProvider)!;
  238. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadDensity, {
  239. source: {
  240. name: 'pdb-emd-ds' as const,
  241. params: {
  242. provider: {
  243. id: emdb,
  244. server: provider,
  245. },
  246. detail: options?.detail ?? 3,
  247. }
  248. }
  249. }));
  250. }
  251. loadAlphaFoldDb(afdb: string) {
  252. const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
  253. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
  254. source: {
  255. name: 'alphafolddb' as const,
  256. params: {
  257. id: afdb,
  258. options: {
  259. ...params.source.params.options,
  260. representation: 'preset-structure-representation-ma-quality-assessment-plddt'
  261. },
  262. }
  263. }
  264. }));
  265. }
  266. loadModelArchive(id: string) {
  267. const params = DownloadStructure.createDefaultParams(this.plugin.state.data.root.obj!, this.plugin);
  268. return this.plugin.runTask(this.plugin.state.data.applyAction(DownloadStructure, {
  269. source: {
  270. name: 'modelarchive' as const,
  271. params: {
  272. id,
  273. options: params.source.params.options,
  274. }
  275. }
  276. }));
  277. }
  278. /**
  279. * @example Load X-ray density from volume server
  280. viewer.loadVolumeFromUrl({
  281. url: 'https://www.ebi.ac.uk/pdbe/densities/x-ray/1tqn/cell?detail=3',
  282. format: 'dscif',
  283. isBinary: true
  284. }, [{
  285. type: 'relative',
  286. value: 1.5,
  287. color: 0x3362B2
  288. }, {
  289. type: 'relative',
  290. value: 3,
  291. color: 0x33BB33,
  292. volumeIndex: 1
  293. }, {
  294. type: 'relative',
  295. value: -3,
  296. color: 0xBB3333,
  297. volumeIndex: 1
  298. }], {
  299. entryId: ['2FO-FC', 'FO-FC'],
  300. isLazy: true
  301. });
  302. * *********************
  303. * @example Load EM density from volume server
  304. viewer.loadVolumeFromUrl({
  305. url: 'https://maps.rcsb.org/em/emd-30210/cell?detail=6',
  306. format: 'dscif',
  307. isBinary: true
  308. }, [{
  309. type: 'relative',
  310. value: 1,
  311. color: 0x3377aa
  312. }], {
  313. entryId: 'EMD-30210',
  314. isLazy: true
  315. });
  316. */
  317. async loadVolumeFromUrl({ url, format, isBinary }: { url: string, format: BuildInVolumeFormat, isBinary: boolean }, isovalues: VolumeIsovalueInfo[], options?: { entryId?: string | string[], isLazy?: boolean }) {
  318. const plugin = this.plugin;
  319. if (!plugin.dataFormats.get(format)) {
  320. throw new Error(`Unknown density format: ${format}`);
  321. }
  322. if (options?.isLazy) {
  323. const update = this.plugin.build();
  324. update.toRoot().apply(StateTransforms.Data.LazyVolume, {
  325. url,
  326. format,
  327. entryId: options?.entryId,
  328. isBinary,
  329. isovalues: isovalues.map(v => ({ alpha: 1, volumeIndex: 0, ...v }))
  330. });
  331. return update.commit();
  332. }
  333. return plugin.dataTransaction(async () => {
  334. const data = await plugin.builders.data.download({ url, isBinary }, { state: { isGhost: true } });
  335. const parsed = await plugin.dataFormats.get(format)!.parse(plugin, data, { entryId: options?.entryId });
  336. const firstVolume = (parsed.volume || parsed.volumes[0]) as StateObjectSelector<PluginStateObject.Volume.Data>;
  337. if (!firstVolume?.isOk) throw new Error('Failed to parse any volume.');
  338. const repr = plugin.build();
  339. for (const iso of isovalues) {
  340. repr
  341. .to(parsed.volumes?.[iso.volumeIndex ?? 0] ?? parsed.volume)
  342. .apply(StateTransforms.Representation.VolumeRepresentation3D, createVolumeRepresentationParams(this.plugin, firstVolume.data!, {
  343. type: 'isosurface',
  344. typeParams: { alpha: iso.alpha ?? 1, isoValue: iso.type === 'absolute' ? { kind: 'absolute', absoluteValue: iso.value } : { kind: 'relative', relativeValue: iso.value } },
  345. color: 'uniform',
  346. colorParams: { value: iso.color }
  347. }));
  348. }
  349. await repr.commit();
  350. });
  351. }
  352. /**
  353. * @example
  354. * viewer.loadTrajectory({
  355. * model: { kind: 'model-url', url: 'villin.gro', format: 'gro' },
  356. * coordinates: { kind: 'coordinates-url', url: 'villin.xtc', format: 'xtc', isBinary: true },
  357. * preset: 'all-models' // or 'default'
  358. * });
  359. */
  360. async loadTrajectory(params: LoadTrajectoryParams) {
  361. const plugin = this.plugin;
  362. let model: StateObjectSelector, coords: StateObjectSelector;
  363. if (params.model.kind === 'model-data' || params.model.kind === 'model-url') {
  364. const data = params.model.kind === 'model-data'
  365. ? await plugin.builders.data.rawData({ data: params.model.data, label: params.modelLabel })
  366. : await plugin.builders.data.download({ url: params.model.url, isBinary: params.model.isBinary, label: params.modelLabel });
  367. const trajectory = await plugin.builders.structure.parseTrajectory(data, params.model.format ?? 'mmcif');
  368. model = await plugin.builders.structure.createModel(trajectory);
  369. } else {
  370. const data = params.model.kind === 'topology-data'
  371. ? await plugin.builders.data.rawData({ data: params.model.data, label: params.modelLabel })
  372. : await plugin.builders.data.download({ url: params.model.url, isBinary: params.model.isBinary, label: params.modelLabel });
  373. const provider = plugin.dataFormats.get(params.model.format);
  374. model = await provider!.parse(plugin, data);
  375. }
  376. {
  377. const data = params.coordinates.kind === 'coordinates-data'
  378. ? await plugin.builders.data.rawData({ data: params.coordinates.data, label: params.coordinatesLabel })
  379. : await plugin.builders.data.download({ url: params.coordinates.url, isBinary: params.coordinates.isBinary, label: params.coordinatesLabel });
  380. const provider = plugin.dataFormats.get(params.coordinates.format);
  381. coords = await provider!.parse(plugin, data);
  382. }
  383. const trajectory = await plugin.build().toRoot()
  384. .apply(TrajectoryFromModelAndCoordinates, {
  385. modelRef: model.ref,
  386. coordinatesRef: coords.ref
  387. }, { dependsOn: [model.ref, coords.ref] })
  388. .commit();
  389. const preset = await plugin.builders.structure.hierarchy.applyPreset(trajectory, params.preset ?? 'default');
  390. return { model, coords, preset };
  391. }
  392. handleResize() {
  393. this.plugin.layout.events.updated.next(void 0);
  394. }
  395. }
  396. export interface LoadStructureOptions {
  397. representationParams?: StructureRepresentationPresetProvider.CommonParams
  398. }
  399. export interface VolumeIsovalueInfo {
  400. type: 'absolute' | 'relative',
  401. value: number,
  402. color: Color,
  403. alpha?: number,
  404. volumeIndex?: number
  405. }
  406. export interface LoadTrajectoryParams {
  407. model: { kind: 'model-url', url: string, format?: BuiltInTrajectoryFormat /* mmcif */, isBinary?: boolean }
  408. | { kind: 'model-data', data: string | number[] | ArrayBuffer | Uint8Array, format?: BuiltInTrajectoryFormat /* mmcif */ }
  409. | { kind: 'topology-url', url: string, format: BuildInStructureFormat, isBinary?: boolean }
  410. | { kind: 'topology-data', data: string | number[] | ArrayBuffer | Uint8Array, format: BuildInStructureFormat },
  411. modelLabel?: string,
  412. coordinates: { kind: 'coordinates-url', url: string, format: BuildInStructureFormat, isBinary?: boolean }
  413. | { kind: 'coordinates-data', data: string | number[] | ArrayBuffer | Uint8Array, format: BuildInStructureFormat },
  414. coordinatesLabel?: string,
  415. preset?: keyof PresetTrajectoryHierarchy
  416. }
  417. export const ViewerAutoPreset = StructureRepresentationPresetProvider({
  418. id: 'preset-structure-representation-viewer-auto',
  419. display: {
  420. name: 'Automatic (w/ Annotation)', group: 'Annotation',
  421. description: 'Show standard automatic representation but colored by quality assessment (if available in the model).'
  422. },
  423. isApplicable(a) {
  424. return (
  425. !!a.data.models.some(m => QualityAssessment.isApplicable(m, 'pLDDT')) ||
  426. !!a.data.models.some(m => QualityAssessment.isApplicable(m, 'qmean'))
  427. );
  428. },
  429. params: () => StructureRepresentationPresetProvider.CommonParams,
  430. async apply(ref, params, plugin) {
  431. const structureCell = StateObjectRef.resolveAndCheck(plugin.state.data, ref);
  432. const structure = structureCell?.obj?.data;
  433. if (!structureCell || !structure) return {};
  434. if (!!structure.models.some(m => QualityAssessment.isApplicable(m, 'pLDDT'))) {
  435. return await QualityAssessmentPLDDTPreset.apply(ref, params, plugin);
  436. } else if (!!structure.models.some(m => QualityAssessment.isApplicable(m, 'qmean'))) {
  437. return await QualityAssessmentQmeanPreset.apply(ref, params, plugin);
  438. } else {
  439. return await PresetStructureRepresentations.auto.apply(ref, params, plugin);
  440. }
  441. }
  442. });