diff --git a/src/examples/proteopedia-wrapper/helpers.ts b/src/examples/proteopedia-wrapper/helpers.ts index 8f736506035984a4a4ecc437b65f19b3ed4cfede..3dfff1c6ae8da15b96f89f41ae54e392f7a77caf 100644 --- a/src/examples/proteopedia-wrapper/helpers.ts +++ b/src/examples/proteopedia-wrapper/helpers.ts @@ -84,6 +84,7 @@ export type SupportedFormats = 'cif' | 'pdb' export interface LoadParams { url: string, format?: SupportedFormats, + isBinary?: boolean, assemblyId?: string, representationStyle?: RepresentationStyle } diff --git a/src/examples/proteopedia-wrapper/index.html b/src/examples/proteopedia-wrapper/index.html index 728dbc74073c498428d8c9d2fc86e6126725cc02..6bff22e26c594c1704b442623297e1a6d7e26da5 100644 --- a/src/examples/proteopedia-wrapper/index.html +++ b/src/examples/proteopedia-wrapper/index.html @@ -60,6 +60,7 @@ <option value='cif' selected>CIF</option> <option value='pdb'>PDB</option> </select> + <input type='checkbox' id='isBinary' style="display: inline-block; width: auto" /> <label for="isBinary"> Binary</label><br /> </div> <div id="app"></div> <div id="volume-streaming-wrapper"></div> @@ -74,8 +75,8 @@ function $(id) { return document.getElementById(id); } - var pdbId = '1cbs', assemblyId= 'preferred'; - var url = 'https://www.ebi.ac.uk/pdbe/static/entry/' + pdbId + '_updated.cif'; + var pdbId = '1cbs', assemblyId= 'preferred', isBinary = true; + var url = 'https://www.ebi.ac.uk/pdbe/entry-files/download/' + pdbId + '.bcif' var format = 'cif'; $('url').value = url; @@ -84,13 +85,15 @@ $('assemblyId').onchange = function (e) { assemblyId = e.target.value; } $('format').value = format; $('format').onchange = function (e) { format = e.target.value; } + $('isBinary').checked = isBinary; + $('isBinary').onchange = function (e) { isBinary = !!e.target.checked; }; // var url = 'https://www.ebi.ac.uk/pdbe/entry-files/pdb' + pdbId + '.ent'; // var format = 'pdb'; // var assemblyId = 'deposited'; var representationStyle = { - sequence: { coloring: 'proteopedia-custom' }, // or just { } + // sequence: { coloring: 'proteopedia-custom' }, // or just { } hetGroups: { kind: 'ball-and-stick' }, // or 'spacefill water: { hide: true }, snfg3d: { hide: false } @@ -100,7 +103,7 @@ customColorList: CustomColors }); PluginWrapper.setBackground(0xffffff); - PluginWrapper.load({ url: url, format: format, assemblyId: assemblyId, representationStyle: representationStyle }); + PluginWrapper.load({ url: url, format: format, isBinary: isBinary, assemblyId: assemblyId, representationStyle: representationStyle }); PluginWrapper.toggleSpin(); PluginWrapper.events.modelInfo.subscribe(function (info) { @@ -108,8 +111,8 @@ listHetGroups(info); }); - addControl('Load Asym Unit', () => PluginWrapper.load({ url: url, format: format })); - addControl('Load Assembly', () => PluginWrapper.load({ url: url, format: format, assemblyId: assemblyId })); + addControl('Load Asym Unit', () => PluginWrapper.load({ url: url, format: format, isBinary })); + addControl('Load Assembly', () => PluginWrapper.load({ url: url, format: format, isBinary, assemblyId: assemblyId })); addSeparator(); diff --git a/src/examples/proteopedia-wrapper/index.ts b/src/examples/proteopedia-wrapper/index.ts index 839ad32a08650f0f0bf68b63cdaeeb44e501c413..ec0b74d7dc758fb6084933fd7f247689be301950 100644 --- a/src/examples/proteopedia-wrapper/index.ts +++ b/src/examples/proteopedia-wrapper/index.ts @@ -33,7 +33,7 @@ require('../../mol-plugin-ui/skin/light.scss'); class MolStarProteopediaWrapper { static VERSION_MAJOR = 5; - static VERSION_MINOR = 0; + static VERSION_MINOR = 1; private _ev = RxEventHelper.create(); @@ -74,8 +74,8 @@ class MolStarProteopediaWrapper { return this.plugin.state.data; } - private download(b: StateBuilder.To<PSO.Root>, url: string) { - return b.apply(StateTransforms.Data.Download, { url: Asset.Url(url), isBinary: false }); + private download(b: StateBuilder.To<PSO.Root>, url: string, isBinary: boolean) { + return b.apply(StateTransforms.Data.Download, { url: Asset.Url(url), isBinary }); } private model(b: StateBuilder.To<PSO.Data.Binary | PSO.Data.String>, format: SupportedFormats) { @@ -195,8 +195,8 @@ class MolStarProteopediaWrapper { return PluginCommands.State.Update(this.plugin, { state: this.plugin.state.data, tree }); } - private loadedParams: LoadParams = { url: '', format: 'cif', assemblyId: '' }; - async load({ url, format = 'cif', assemblyId = 'deposited', representationStyle }: LoadParams) { + private loadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' }; + async load({ url, format = 'cif', assemblyId = 'deposited', isBinary = false, representationStyle }: LoadParams) { let loadType: 'full' | 'update' = 'full'; const state = this.plugin.state.data; @@ -209,7 +209,7 @@ class MolStarProteopediaWrapper { if (loadType === 'full') { await PluginCommands.State.RemoveObject(this.plugin, { state, ref: state.tree.root.ref }); - const modelTree = this.model(this.download(state.build().toRoot(), url), format); + const modelTree = this.model(this.download(state.build().toRoot(), url, isBinary), format); await this.applyState(modelTree); const info = await this.doInfo(true); const asmId = (assemblyId === 'preferred' && info && info.preferredAssemblyId) || assemblyId;