Skip to content
Snippets Groups Projects
Commit 2a7d2587 authored by Alexander Rose's avatar Alexander Rose
Browse files

add Download providers to Config

parent 54fb9bee
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ import { StateTransforms } from '../transforms'; ...@@ -17,6 +17,7 @@ import { StateTransforms } from '../transforms';
import { Download } from '../transforms/data'; import { Download } from '../transforms/data';
import { CustomModelProperties, CustomStructureProperties, TrajectoryFromModelAndCoordinates } from '../transforms/model'; import { CustomModelProperties, CustomStructureProperties, TrajectoryFromModelAndCoordinates } from '../transforms/model';
import { Asset } from '../../mol-util/assets'; import { Asset } from '../../mol-util/assets';
import { PluginConfig } from '../../mol-plugin/config';
const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({ const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({
type: RootStructureDefinition.getParams(void 0, 'auto').type, type: RootStructureDefinition.getParams(void 0, 'auto').type,
...@@ -26,6 +27,16 @@ const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({ ...@@ -26,6 +27,16 @@ const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({
asTrajectory: PD.Optional(PD.Boolean(false, { description: 'Load all entries into a single trajectory.' })) asTrajectory: PD.Optional(PD.Boolean(false, { description: 'Load all entries into a single trajectory.' }))
}, { isExpanded: false }); }, { isExpanded: false });
export const PdbDownloadProvider = {
'rcsb': PD.Group({
encoding: PD.Select('bcif', [['cif', 'cif'], ['bcif', 'bcif']] as ['cif' | 'bcif', string][]),
}, { label: 'RCSB PDB', isFlat: true }),
'pdbe': PD.Group({
variant: PD.Select('updated-bcif', [['updated-bcif', 'Updated (bcif)'], ['updated', 'Updated'], ['archival', 'Archival']] as ['updated' | 'archival', string][]),
}, { label: 'PDBe', isFlat: true }),
};
export type PdbDownloadProvider = keyof typeof PdbDownloadProvider;
export { DownloadStructure }; export { DownloadStructure };
type DownloadStructure = typeof DownloadStructure type DownloadStructure = typeof DownloadStructure
const DownloadStructure = StateAction.build({ const DownloadStructure = StateAction.build({
...@@ -33,19 +44,13 @@ const DownloadStructure = StateAction.build({ ...@@ -33,19 +44,13 @@ const DownloadStructure = StateAction.build({
display: { name: 'Download Structure', description: 'Load a structure from the provided source and create its representation.' }, display: { name: 'Download Structure', description: 'Load a structure from the provided source and create its representation.' },
params: (_, plugin: PluginContext) => { params: (_, plugin: PluginContext) => {
const options = DownloadModelRepresentationOptions(plugin); const options = DownloadModelRepresentationOptions(plugin);
const defaultPdbProvider = plugin.config.get(PluginConfig.Download.DefaultPdbProvider) || 'pdbe';
return { return {
source: PD.MappedStatic('pdb', { source: PD.MappedStatic('pdb', {
'pdb': PD.Group({ 'pdb': PD.Group({
provider: PD.Group({ provider: PD.Group({
id: PD.Text('1tqn', { label: 'PDB Id(s)', description: 'One or more comma/space separated PDB ids.' }), id: PD.Text('1tqn', { label: 'PDB Id(s)', description: 'One or more comma/space separated PDB ids.' }),
server: PD.MappedStatic('pdbe', { server: PD.MappedStatic(defaultPdbProvider, PdbDownloadProvider),
'rcsb': PD.Group({
encoding: PD.Select('bcif', [['cif', 'cif'], ['bcif', 'bcif']] as ['cif' | 'bcif', string][]),
}, { label: 'RCSB PDB', isFlat: true }),
'pdbe': PD.Group({
variant: PD.Select('updated-bcif', [['updated-bcif', 'Updated (bcif)'], ['updated', 'Updated'], ['archival', 'Archival']] as ['updated' | 'archival', string][]),
}, { label: 'PDBe', isFlat: true }),
}),
}, { pivot: 'id' }), }, { pivot: 'id' }),
options options
}, { isFlat: true, label: 'PDB' }), }, { isFlat: true, label: 'PDB' }),
......
...@@ -16,6 +16,8 @@ import { DataFormatProvider } from '../formats/provider'; ...@@ -16,6 +16,8 @@ import { DataFormatProvider } from '../formats/provider';
import { Asset } from '../../mol-util/assets'; import { Asset } from '../../mol-util/assets';
import { StateTransforms } from '../transforms'; import { StateTransforms } from '../transforms';
export type EmdbDownloadProvider = 'pdbe' | 'rcsb'
export { DownloadDensity }; export { DownloadDensity };
type DownloadDensity = typeof DownloadDensity type DownloadDensity = typeof DownloadDensity
const DownloadDensity = StateAction.build({ const DownloadDensity = StateAction.build({
...@@ -42,7 +44,7 @@ const DownloadDensity = StateAction.build({ ...@@ -42,7 +44,7 @@ const DownloadDensity = StateAction.build({
'pdb-emd-ds': PD.Group({ 'pdb-emd-ds': PD.Group({
provider: PD.Group({ provider: PD.Group({
id: PD.Text('emd-8004', { label: 'Id' }), id: PD.Text('emd-8004', { label: 'Id' }),
server: PD.Select('pdbe', [['pdbe', 'PDBe'], ['rcsb', 'RCSB PDB']]), server: PD.Select<EmdbDownloadProvider>('pdbe', [['pdbe', 'PDBe'], ['rcsb', 'RCSB PDB']]),
}, { pivot: 'id' }), }, { pivot: 'id' }),
detail: PD.Numeric(3, { min: 0, max: 10, step: 1 }, { label: 'Detail' }), detail: PD.Numeric(3, { min: 0, max: 10, step: 1 }, { label: 'Detail' }),
}, { isFlat: true }), }, { isFlat: true }),
......
...@@ -176,7 +176,7 @@ export const DscifProvider = DataFormatProvider({ ...@@ -176,7 +176,7 @@ export const DscifProvider = DataFormatProvider({
if (volumes.length > 0) { if (volumes.length > 0) {
visuals[0] = tree visuals[0] = tree
.to(volumes[0]) .to(volumes[0])
.apply(StateTransforms.Representation.VolumeRepresentation3D, VolumeRepresentation3DHelpers.getDefaultParamsStatic(plugin, 'isosurface', { isoValue: VolumeIsoValue.relative(1.5), alpha: 0.3 }, 'uniform', { value: ColorNames.teal })) .apply(StateTransforms.Representation.VolumeRepresentation3D, VolumeRepresentation3DHelpers.getDefaultParamsStatic(plugin, 'isosurface', { isoValue: VolumeIsoValue.relative(1.5), alpha: 1 }, 'uniform', { value: ColorNames.teal }))
.selector; .selector;
} }
......
...@@ -49,8 +49,8 @@ export class StateTree extends PluginUIComponent<{ state: State }, { showActions ...@@ -49,8 +49,8 @@ export class StateTree extends PluginUIComponent<{ state: State }, { showActions
const ref = this.props.state.tree.root.ref; const ref = this.props.state.tree.root.ref;
if (this.state.showActions) { if (this.state.showActions) {
return <div style={{ margin: '10px', cursor: 'default' }}> return <div style={{ margin: '10px', cursor: 'default' }}>
<p>Nothing to see here.</p> <p>Nothing to see here yet.</p>
<p>Structures can be loaded from the <Icon svg={HomeOutlined} /> tab.</p> <p>Structures and Volumes can be loaded from the <Icon svg={HomeOutlined} /> tab.</p>
</div>; </div>;
} }
return <StateTreeNode cell={this.props.state.cells.get(ref)!} depth={0} />; return <StateTreeNode cell={this.props.state.cells.get(ref)!} depth={0} />;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
import { Structure, Model } from '../mol-model/structure'; import { Structure, Model } from '../mol-model/structure';
import { PluginContext } from './context'; import { PluginContext } from './context';
import { PdbDownloadProvider } from '../mol-plugin-state/actions/structure';
import { EmdbDownloadProvider } from '../mol-plugin-state/actions/volume';
export class PluginConfigItem<T = any> { export class PluginConfigItem<T = any> {
toString() { return this.key; } toString() { return this.key; }
...@@ -36,6 +38,10 @@ export const PluginConfig = { ...@@ -36,6 +38,10 @@ export const PluginConfig = {
ShowExpand: item('viewer.show-expand-button', true), ShowExpand: item('viewer.show-expand-button', true),
ShowSelectionMode: item('viewer.show-selection-model-button', true), ShowSelectionMode: item('viewer.show-selection-model-button', true),
ShowAnimation: item('viewer.show-animation-button', true), ShowAnimation: item('viewer.show-animation-button', true),
},
Download: {
DefaultPdbProvider: item<PdbDownloadProvider>('download.default-pdb-provider', 'pdbe'),
DefaultEmdbProvider: item<EmdbDownloadProvider>('download.default-emdb-provider', 'pdbe'),
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment