Skip to content
Snippets Groups Projects
Commit 573c2a7a authored by David Sehnal's avatar David Sehnal
Browse files

proteopedia-wrapper: support bcif

parent 41977ea7
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,7 @@ export type SupportedFormats = 'cif' | 'pdb' ...@@ -84,6 +84,7 @@ export type SupportedFormats = 'cif' | 'pdb'
export interface LoadParams { export interface LoadParams {
url: string, url: string,
format?: SupportedFormats, format?: SupportedFormats,
isBinary?: boolean,
assemblyId?: string, assemblyId?: string,
representationStyle?: RepresentationStyle representationStyle?: RepresentationStyle
} }
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
<option value='cif' selected>CIF</option> <option value='cif' selected>CIF</option>
<option value='pdb'>PDB</option> <option value='pdb'>PDB</option>
</select> </select>
<input type='checkbox' id='isBinary' style="display: inline-block; width: auto" /> <label for="isBinary"> Binary</label><br />
</div> </div>
<div id="app"></div> <div id="app"></div>
<div id="volume-streaming-wrapper"></div> <div id="volume-streaming-wrapper"></div>
...@@ -74,8 +75,8 @@ ...@@ -74,8 +75,8 @@
function $(id) { return document.getElementById(id); } function $(id) { return document.getElementById(id); }
var pdbId = '1cbs', assemblyId= 'preferred'; var pdbId = '1cbs', assemblyId= 'preferred', isBinary = true;
var url = 'https://www.ebi.ac.uk/pdbe/static/entry/' + pdbId + '_updated.cif'; var url = 'https://www.ebi.ac.uk/pdbe/entry-files/download/' + pdbId + '.bcif'
var format = 'cif'; var format = 'cif';
$('url').value = url; $('url').value = url;
...@@ -84,13 +85,15 @@ ...@@ -84,13 +85,15 @@
$('assemblyId').onchange = function (e) { assemblyId = e.target.value; } $('assemblyId').onchange = function (e) { assemblyId = e.target.value; }
$('format').value = format; $('format').value = format;
$('format').onchange = function (e) { format = e.target.value; } $('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 url = 'https://www.ebi.ac.uk/pdbe/entry-files/pdb' + pdbId + '.ent';
// var format = 'pdb'; // var format = 'pdb';
// var assemblyId = 'deposited'; // var assemblyId = 'deposited';
var representationStyle = { var representationStyle = {
sequence: { coloring: 'proteopedia-custom' }, // or just { } // sequence: { coloring: 'proteopedia-custom' }, // or just { }
hetGroups: { kind: 'ball-and-stick' }, // or 'spacefill hetGroups: { kind: 'ball-and-stick' }, // or 'spacefill
water: { hide: true }, water: { hide: true },
snfg3d: { hide: false } snfg3d: { hide: false }
...@@ -100,7 +103,7 @@ ...@@ -100,7 +103,7 @@
customColorList: CustomColors customColorList: CustomColors
}); });
PluginWrapper.setBackground(0xffffff); 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.toggleSpin();
PluginWrapper.events.modelInfo.subscribe(function (info) { PluginWrapper.events.modelInfo.subscribe(function (info) {
...@@ -108,8 +111,8 @@ ...@@ -108,8 +111,8 @@
listHetGroups(info); listHetGroups(info);
}); });
addControl('Load Asym Unit', () => PluginWrapper.load({ url: url, format: format })); addControl('Load Asym Unit', () => PluginWrapper.load({ url: url, format: format, isBinary }));
addControl('Load Assembly', () => PluginWrapper.load({ url: url, format: format, assemblyId: assemblyId })); addControl('Load Assembly', () => PluginWrapper.load({ url: url, format: format, isBinary, assemblyId: assemblyId }));
addSeparator(); addSeparator();
......
...@@ -33,7 +33,7 @@ require('../../mol-plugin-ui/skin/light.scss'); ...@@ -33,7 +33,7 @@ require('../../mol-plugin-ui/skin/light.scss');
class MolStarProteopediaWrapper { class MolStarProteopediaWrapper {
static VERSION_MAJOR = 5; static VERSION_MAJOR = 5;
static VERSION_MINOR = 0; static VERSION_MINOR = 1;
private _ev = RxEventHelper.create(); private _ev = RxEventHelper.create();
...@@ -74,8 +74,8 @@ class MolStarProteopediaWrapper { ...@@ -74,8 +74,8 @@ class MolStarProteopediaWrapper {
return this.plugin.state.data; return this.plugin.state.data;
} }
private download(b: StateBuilder.To<PSO.Root>, url: string) { private download(b: StateBuilder.To<PSO.Root>, url: string, isBinary: boolean) {
return b.apply(StateTransforms.Data.Download, { url: Asset.Url(url), isBinary: false }); return b.apply(StateTransforms.Data.Download, { url: Asset.Url(url), isBinary });
} }
private model(b: StateBuilder.To<PSO.Data.Binary | PSO.Data.String>, format: SupportedFormats) { private model(b: StateBuilder.To<PSO.Data.Binary | PSO.Data.String>, format: SupportedFormats) {
...@@ -195,8 +195,8 @@ class MolStarProteopediaWrapper { ...@@ -195,8 +195,8 @@ class MolStarProteopediaWrapper {
return PluginCommands.State.Update(this.plugin, { state: this.plugin.state.data, tree }); return PluginCommands.State.Update(this.plugin, { state: this.plugin.state.data, tree });
} }
private loadedParams: LoadParams = { url: '', format: 'cif', assemblyId: '' }; private loadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' };
async load({ url, format = 'cif', assemblyId = 'deposited', representationStyle }: LoadParams) { async load({ url, format = 'cif', assemblyId = 'deposited', isBinary = false, representationStyle }: LoadParams) {
let loadType: 'full' | 'update' = 'full'; let loadType: 'full' | 'update' = 'full';
const state = this.plugin.state.data; const state = this.plugin.state.data;
...@@ -209,7 +209,7 @@ class MolStarProteopediaWrapper { ...@@ -209,7 +209,7 @@ class MolStarProteopediaWrapper {
if (loadType === 'full') { if (loadType === 'full') {
await PluginCommands.State.RemoveObject(this.plugin, { state, ref: state.tree.root.ref }); 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); await this.applyState(modelTree);
const info = await this.doInfo(true); const info = await this.doInfo(true);
const asmId = (assemblyId === 'preferred' && info && info.preferredAssemblyId) || assemblyId; const asmId = (assemblyId === 'preferred' && info && info.preferredAssemblyId) || assemblyId;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment