From c857c17bb4d79c8c4190e5242907d3219c03bb01 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Mon, 11 May 2020 11:24:01 -0700 Subject: [PATCH] removed custom name 'deposited' for structures from model - use 'model' instead --- src/examples/basic-wrapper/index.html | 7 ------ src/examples/basic-wrapper/index.ts | 8 ++++++- src/examples/lighting/index.ts | 2 +- src/examples/proteopedia-wrapper/index.html | 4 ---- src/examples/proteopedia-wrapper/index.ts | 16 +++++++++----- src/extensions/rcsb/assembly-symmetry/prop.ts | 4 ++-- src/mol-plugin-state/builder/structure.ts | 2 +- .../builder/structure/hierarchy-preset.ts | 4 ++-- .../helpers/root-structure.ts | 22 +++++++++---------- src/mol-plugin-state/transforms/model.ts | 2 +- 10 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/examples/basic-wrapper/index.html b/src/examples/basic-wrapper/index.html index 9e936e50f..468024c2a 100644 --- a/src/examples/basic-wrapper/index.html +++ b/src/examples/basic-wrapper/index.html @@ -69,15 +69,8 @@ $('format').value = format; $('format').onchange = function (e) { format = e.target.value; } - // var url = 'https://www.ebi.ac.uk/pdbe/entry-files/pdb' + pdbId + '.ent'; - // var format = 'pdb'; - // var assemblyId = 'deposited'; - BasicMolStarWrapper.init('app' /** or document.getElementById('app') */); BasicMolStarWrapper.setBackground(0xffffff); - // BasicMolStarWrapper.load({ url: url, format: format, assemblyId: assemblyId }); - // BasicMolStarWrapper.toggleSpin(); - addControl('Load Asym Unit', () => BasicMolStarWrapper.load({ url: url, format: format })); addControl('Load Assembly', () => BasicMolStarWrapper.load({ url: url, format: format, assemblyId: assemblyId })); diff --git a/src/examples/basic-wrapper/index.ts b/src/examples/basic-wrapper/index.ts index 9b0ab69cb..f2a2a2a4e 100644 --- a/src/examples/basic-wrapper/index.ts +++ b/src/examples/basic-wrapper/index.ts @@ -56,7 +56,13 @@ class BasicWrapper { const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format); await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default', { - structure: assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'deposited', params: { } }, + structure: assemblyId ? { + name: 'assembly', + params: { id: assemblyId } + } : { + name: 'model', + params: { } + }, showUnitcell: false, representationPreset: 'auto' }); diff --git a/src/examples/lighting/index.ts b/src/examples/lighting/index.ts index daf051025..f8abba548 100644 --- a/src/examples/lighting/index.ts +++ b/src/examples/lighting/index.ts @@ -105,7 +105,7 @@ class LightingDemo { const data = await this.plugin.builders.data.download({ url: Asset.Url(url), isBinary }, { state: { isGhost: true } }); const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format); const model = await this.plugin.builders.structure.createModel(trajectory); - const structure = await this.plugin.builders.structure.createStructure(model, assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'deposited', params: { } }); + const structure = await this.plugin.builders.structure.createStructure(model, assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'model', params: { } }); const polymer = await this.plugin.builders.structure.tryCreateComponentStatic(structure, 'polymer'); if (polymer) await this.plugin.builders.structure.representation.addRepresentation(polymer, { type: 'spacefill', color: 'illustrative' }); diff --git a/src/examples/proteopedia-wrapper/index.html b/src/examples/proteopedia-wrapper/index.html index 48cc5f811..79a3a35fb 100644 --- a/src/examples/proteopedia-wrapper/index.html +++ b/src/examples/proteopedia-wrapper/index.html @@ -88,10 +88,6 @@ $('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'; - function loadAndSnapshot(params) { PluginWrapper.load(params).then(() => { setTimeout(() => snapshot = PluginWrapper.plugin.state.getSnapshot({ canvas3d: false /* do not save spinning state */ }), 500); diff --git a/src/examples/proteopedia-wrapper/index.ts b/src/examples/proteopedia-wrapper/index.ts index 0f082912a..c590ea69e 100644 --- a/src/examples/proteopedia-wrapper/index.ts +++ b/src/examples/proteopedia-wrapper/index.ts @@ -89,9 +89,12 @@ class MolStarProteopediaWrapper { private structure(assemblyId: string) { const model = this.state.build().to(StateElements.Model); const props = { - type: { + type: assemblyId ? { name: 'assembly' as const, - params: { id: assemblyId || 'deposited' } + params: { id: assemblyId } + } : { + name: 'model' as const, + params: { } } }; @@ -196,7 +199,7 @@ class MolStarProteopediaWrapper { private emptyLoadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' }; private loadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' }; - async load({ url, format = 'cif', assemblyId = 'deposited', isBinary = false, representationStyle }: LoadParams) { + async load({ url, format = 'cif', assemblyId = '', isBinary = false, representationStyle }: LoadParams) { let loadType: 'full' | 'update' = 'full'; const state = this.plugin.state.data; @@ -220,9 +223,12 @@ class MolStarProteopediaWrapper { const info = await this.doInfo(true); const asmId = (assemblyId === 'preferred' && info && info.preferredAssemblyId) || assemblyId; const props = { - type: { + type: assemblyId ? { name: 'assembly' as const, - params: { id: asmId || 'deposited' } + params: { id: asmId } + } : { + name: 'model' as const, + params: { } } }; tree.to(StateElements.Assembly).update(StateTransforms.Model.StructureFromModel, p => ({ ...p, ...props })); diff --git a/src/extensions/rcsb/assembly-symmetry/prop.ts b/src/extensions/rcsb/assembly-symmetry/prop.ts index c88daa19a..849d4db60 100644 --- a/src/extensions/rcsb/assembly-symmetry/prop.ts +++ b/src/extensions/rcsb/assembly-symmetry/prop.ts @@ -35,7 +35,7 @@ export function isBiologicalAssembly(structure: Structure): boolean { const mmcif = structure.models[0].sourceData.data.db; if (!mmcif.pdbx_struct_assembly.details.isDefined) return false; const id = structure.units[0].conformation.operator.assembly?.id || ''; - if (id === '' || id === 'deposited') return true; + if (id === '') return true; const indices = Column.indicesOf(mmcif.pdbx_struct_assembly.id, e => e === id); if (indices.length !== 1) return false; const details = mmcif.pdbx_struct_assembly.details.value(indices[0]); @@ -63,7 +63,7 @@ export namespace AssemblySymmetry { const client = new GraphQLClient(props.serverUrl, ctx.assetManager); const variables: AssemblySymmetryQueryVariables = { - assembly_id: structure.units[0].conformation.operator.assembly?.id || 'deposited', + assembly_id: structure.units[0].conformation.operator.assembly?.id || '', entry_id: structure.units[0].model.entryId }; const result = await client.request(ctx.runtime, query, variables); diff --git a/src/mol-plugin-state/builder/structure.ts b/src/mol-plugin-state/builder/structure.ts index ba172758e..cdc7b9834 100644 --- a/src/mol-plugin-state/builder/structure.ts +++ b/src/mol-plugin-state/builder/structure.ts @@ -90,7 +90,7 @@ export class StructureBuilder { const model = StateObjectRef.resolveAndCheck(state, modelRef); if (model) { const symm = ModelSymmetry.Provider.get(model.obj?.data!); - if (!symm || symm?.assemblies.length === 0) params = { name: 'deposited', params: { } }; + if (!symm || symm?.assemblies.length === 0) params = { name: 'model', params: { } }; } } diff --git a/src/mol-plugin-state/builder/structure/hierarchy-preset.ts b/src/mol-plugin-state/builder/structure/hierarchy-preset.ts index 22b82a091..640ed039f 100644 --- a/src/mol-plugin-state/builder/structure/hierarchy-preset.ts +++ b/src/mol-plugin-state/builder/structure/hierarchy-preset.ts @@ -43,7 +43,7 @@ const defaultPreset = TrajectoryHierarchyPresetProvider({ id: 'preset-trajectory-default', display: { name: 'Default (Assembly)', group: 'Preset', - description: 'Shows the first assembly or, if that is unavailable, the first deposited model.' + description: 'Shows the first assembly or, if that is unavailable, the first model.' }, isApplicable: o => { return true; @@ -93,7 +93,7 @@ const allModels = TrajectoryHierarchyPresetProvider({ for (let i = 0; i < tr.length; i++) { const model = await builder.createModel(trajectory, { modelIndex: i }); const modelProperties = await builder.insertModelProperties(model, params.modelProperties, { isCollapsed: true }); - const structure = await builder.createStructure(modelProperties || model, { name: 'deposited', params: {} }); + const structure = await builder.createStructure(modelProperties || model, { name: 'model', params: {} }); const structureProperties = await builder.insertStructureProperties(structure, params.structureProperties); models.push(model); diff --git a/src/mol-plugin-state/helpers/root-structure.ts b/src/mol-plugin-state/helpers/root-structure.ts index 850e0aee0..b8b698c77 100644 --- a/src/mol-plugin-state/helpers/root-structure.ts +++ b/src/mol-plugin-state/helpers/root-structure.ts @@ -17,7 +17,7 @@ import { PluginStateObject as SO } from '../objects'; import { ModelSymmetry } from '../../mol-model-formats/structure/property/symmetry'; export namespace RootStructureDefinition { - export function getParams(model?: Model, defaultValue?: 'auto' | 'deposited' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') { + export function getParams(model?: Model, defaultValue?: 'auto' | 'model' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') { const symmetry = model && ModelSymmetry.Provider.get(model); const assemblyIds = symmetry ? symmetry.assemblies.map(a => [a.id, `${a.id}: ${stringToWords(a.details)}`] as [string, string]) : []; @@ -41,7 +41,7 @@ export namespace RootStructureDefinition { const modes = { auto: PD.EmptyGroup(), - deposited: PD.EmptyGroup(), + model: PD.EmptyGroup(), assembly: PD.Group({ id: PD.Optional(model ? PD.Select(assemblyIds.length ? assemblyIds[0][0] : '', assemblyIds, { label: 'Asm Id', description: 'Assembly Id' }) @@ -75,7 +75,7 @@ export namespace RootStructureDefinition { options.push(['auto', 'Auto']); } - options.push(['deposited', 'Deposited']); + options.push(['model', 'Model']); if (assemblyIds.length > 0) { options.push(['assembly', 'Assembly']); @@ -88,7 +88,7 @@ export namespace RootStructureDefinition { } return { - type: PD.MappedStatic(defaultValue || 'deposited', modes, { options }) + type: PD.MappedStatic(defaultValue || 'model', modes, { options }) }; } @@ -110,19 +110,17 @@ export namespace RootStructureDefinition { } if (!symmetry || symmetry.assemblies.length === 0) { - if (id !== 'deposited') { - plugin.log.warn(`Model '${model.entryId}' has no assembly, returning deposited structure.`); - } + plugin.log.warn(`Model '${model.entryId}' has no assembly, returning model structure.`); } else { asm = Symmetry.findAssembly(model, id || ''); if (!asm) { - plugin.log.warn(`Model '${model.entryId}' has no assembly called '${id}', returning deposited structure.`); + plugin.log.warn(`Model '${model.entryId}' has no assembly called '${id}', returning model structure.`); } } const base = Structure.ofModel(model); if (!asm) { - const label = { label: 'Deposited', description: Structure.elementDescription(base) }; + const label = { label: 'Model', description: Structure.elementDescription(base) }; return new SO.Molecule.Structure(base, label); } @@ -155,14 +153,14 @@ export namespace RootStructureDefinition { export async function create(plugin: PluginContext, ctx: RuntimeContext, model: Model, params?: Params): Promise<SO.Molecule.Structure> { const symmetry = ModelSymmetry.Provider.get(model); - if (!symmetry || !params || params.name === 'deposited') { + if (!symmetry || !params || params.name === 'model') { const s = Structure.ofModel(model); - return new SO.Molecule.Structure(s, { label: 'Deposited', description: Structure.elementDescription(s) }); + return new SO.Molecule.Structure(s, { label: 'Model', description: Structure.elementDescription(s) }); } if (params.name === 'auto') { if (symmetry.assemblies.length === 0) { const s = Structure.ofModel(model); - return new SO.Molecule.Structure(s, { label: 'Deposited', description: Structure.elementDescription(s) }); + return new SO.Molecule.Structure(s, { label: 'Model', description: Structure.elementDescription(s) }); } else { return buildAssembly(plugin, ctx, model); } diff --git a/src/mol-plugin-state/transforms/model.ts b/src/mol-plugin-state/transforms/model.ts index 5f1aefbfa..00ff8c94c 100644 --- a/src/mol-plugin-state/transforms/model.ts +++ b/src/mol-plugin-state/transforms/model.ts @@ -371,7 +371,7 @@ const StructureFromTrajectory = PluginStateTransform.BuiltIn({ type StructureFromModel = typeof StructureFromModel const StructureFromModel = PluginStateTransform.BuiltIn({ name: 'structure-from-model', - display: { name: 'Structure', description: 'Create a molecular structure (deposited, assembly, or symmetry) from the specified model.' }, + display: { name: 'Structure', description: 'Create a molecular structure (model, assembly, or symmetry) from the specified model.' }, from: SO.Molecule.Model, to: SO.Molecule.Structure, params(a) { return RootStructureDefinition.getParams(a && a.data); } -- GitLab