diff --git a/src/mol-plugin-state/actions/structure.ts b/src/mol-plugin-state/actions/structure.ts index 4ed8f3f93501db82eae2d836ba6f144ce122934e..7a46fd1021ad2a8c265e3a50e0d86f4db23a91d1 100644 --- a/src/mol-plugin-state/actions/structure.ts +++ b/src/mol-plugin-state/actions/structure.ts @@ -17,6 +17,7 @@ import { StateTransforms } from '../transforms'; import { Download } from '../transforms/data'; import { CustomModelProperties, CustomStructureProperties, TrajectoryFromModelAndCoordinates } from '../transforms/model'; import { Asset } from '../../mol-util/assets'; +import { PluginConfig } from '../../mol-plugin/config'; const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({ type: RootStructureDefinition.getParams(void 0, 'auto').type, @@ -26,6 +27,16 @@ const DownloadModelRepresentationOptions = (plugin: PluginContext) => PD.Group({ asTrajectory: PD.Optional(PD.Boolean(false, { description: 'Load all entries into a single trajectory.' })) }, { 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 }; type DownloadStructure = typeof DownloadStructure 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.' }, params: (_, plugin: PluginContext) => { const options = DownloadModelRepresentationOptions(plugin); + const defaultPdbProvider = plugin.config.get(PluginConfig.Download.DefaultPdbProvider) || 'pdbe'; return { source: PD.MappedStatic('pdb', { 'pdb': PD.Group({ provider: PD.Group({ id: PD.Text('1tqn', { label: 'PDB Id(s)', description: 'One or more comma/space separated PDB ids.' }), - server: PD.MappedStatic('pdbe', { - '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 }), - }), + server: PD.MappedStatic(defaultPdbProvider, PdbDownloadProvider), }, { pivot: 'id' }), options }, { isFlat: true, label: 'PDB' }), diff --git a/src/mol-plugin-state/actions/volume.ts b/src/mol-plugin-state/actions/volume.ts index e1a553ee1f7c1c7c622ffc652e89732786f2015d..7f3393c95b328eb0f9326998b6faefc571366a88 100644 --- a/src/mol-plugin-state/actions/volume.ts +++ b/src/mol-plugin-state/actions/volume.ts @@ -16,6 +16,8 @@ import { DataFormatProvider } from '../formats/provider'; import { Asset } from '../../mol-util/assets'; import { StateTransforms } from '../transforms'; +export type EmdbDownloadProvider = 'pdbe' | 'rcsb' + export { DownloadDensity }; type DownloadDensity = typeof DownloadDensity const DownloadDensity = StateAction.build({ @@ -42,7 +44,7 @@ const DownloadDensity = StateAction.build({ 'pdb-emd-ds': PD.Group({ provider: PD.Group({ 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' }), detail: PD.Numeric(3, { min: 0, max: 10, step: 1 }, { label: 'Detail' }), }, { isFlat: true }), diff --git a/src/mol-plugin-state/formats/volume.ts b/src/mol-plugin-state/formats/volume.ts index 7d11da1a771bf604d7b06e9d622e69629cbcd93e..b39e288e1e3ab02b87f22b5c307b160c8f3fb55a 100644 --- a/src/mol-plugin-state/formats/volume.ts +++ b/src/mol-plugin-state/formats/volume.ts @@ -176,7 +176,7 @@ export const DscifProvider = DataFormatProvider({ if (volumes.length > 0) { visuals[0] = tree .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; } diff --git a/src/mol-plugin-ui/state/tree.tsx b/src/mol-plugin-ui/state/tree.tsx index 016c13045473696d82a53edd79b3e9bf2397932f..cd19a9f7f7329e82fabebe96ab35e4578315136e 100644 --- a/src/mol-plugin-ui/state/tree.tsx +++ b/src/mol-plugin-ui/state/tree.tsx @@ -49,8 +49,8 @@ export class StateTree extends PluginUIComponent<{ state: State }, { showActions const ref = this.props.state.tree.root.ref; if (this.state.showActions) { return <div style={{ margin: '10px', cursor: 'default' }}> - <p>Nothing to see here.</p> - <p>Structures can be loaded from the <Icon svg={HomeOutlined} /> tab.</p> + <p>Nothing to see here yet.</p> + <p>Structures and Volumes can be loaded from the <Icon svg={HomeOutlined} /> tab.</p> </div>; } return <StateTreeNode cell={this.props.state.cells.get(ref)!} depth={0} />; diff --git a/src/mol-plugin/config.ts b/src/mol-plugin/config.ts index d3816746d29aed1b0aa01f398b8f15209bf51af3..f5bfe823f0ac11b7143a6bd2ee408d568a445868 100644 --- a/src/mol-plugin/config.ts +++ b/src/mol-plugin/config.ts @@ -7,6 +7,8 @@ import { Structure, Model } from '../mol-model/structure'; 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> { toString() { return this.key; } @@ -36,6 +38,10 @@ export const PluginConfig = { ShowExpand: item('viewer.show-expand-button', true), ShowSelectionMode: item('viewer.show-selection-model-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'), } };