From 89869f0e142c79ed698c39cc78cc81d746e8b365 Mon Sep 17 00:00:00 2001 From: Augustin Chassine Date: Thu, 21 Sep 2023 18:00:37 +0200 Subject: [PATCH] wip: changes to demo, alphafold poc component --- src/lib/controls/Scene.svelte | 27 +++++ src/lib/elements/StructureAlphaFold.svelte | 101 ++++++++++++++++++ src/lib/elements/StructureURL.svelte | 2 +- .../components/simple-controls/+page.md | 19 +++- .../simple-controls/DemoControls.svelte | 5 +- .../simple-controls/DemoControls2.svelte | 37 +++++++ 6 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 src/lib/controls/Scene.svelte create mode 100644 src/lib/elements/StructureAlphaFold.svelte create mode 100644 src/routes/components/simple-controls/DemoControls2.svelte diff --git a/src/lib/controls/Scene.svelte b/src/lib/controls/Scene.svelte new file mode 100644 index 0000000..a6f3b24 --- /dev/null +++ b/src/lib/controls/Scene.svelte @@ -0,0 +1,27 @@ + + + + + diff --git a/src/lib/elements/StructureAlphaFold.svelte b/src/lib/elements/StructureAlphaFold.svelte new file mode 100644 index 0000000..ccdf39a --- /dev/null +++ b/src/lib/elements/StructureAlphaFold.svelte @@ -0,0 +1,101 @@ + diff --git a/src/lib/elements/StructureURL.svelte b/src/lib/elements/StructureURL.svelte index 90e214d..40ae41c 100644 --- a/src/lib/elements/StructureURL.svelte +++ b/src/lib/elements/StructureURL.svelte @@ -33,7 +33,7 @@ const model = await plugin.builders.structure.createModel(trajectory); const struct = await plugin.builders.structure.createStructure(model); structure = struct; - await plugin.builders.structure.hierarchy.applyPreset(structure, 'default'); + await plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default'); }; onMount(() => { init(); diff --git a/src/routes/components/simple-controls/+page.md b/src/routes/components/simple-controls/+page.md index 301b91e..3f87a6f 100644 --- a/src/routes/components/simple-controls/+page.md +++ b/src/routes/components/simple-controls/+page.md @@ -7,14 +7,31 @@ return m.default; }); + const loadComponentDemoWithControls2 = async () => + import('./DemoControls2.svelte').then((m) => { + return m.default; + }); + # SimpleWrapper + controls -## Highlight info +## Highlight info + ButtonBar {#if browser} {#await loadComponentDemoWithControls() then MolstarComp} +
+ +
+ {/await} +{/if} + +## Highlight info + ButtonBar variant + +{#if browser} + {#await loadComponentDemoWithControls2() then MolstarComp} +
+
{/await} {/if} diff --git a/src/routes/components/simple-controls/DemoControls.svelte b/src/routes/components/simple-controls/DemoControls.svelte index 8c4f824..5aebb86 100644 --- a/src/routes/components/simple-controls/DemoControls.svelte +++ b/src/routes/components/simple-controls/DemoControls.svelte @@ -2,7 +2,7 @@ import StructureURL from '$lib/elements/StructureURL.svelte'; import HighlightInfo from '$lib/controls/HighlightInfo.svelte'; import MolstarWrapper from '$lib/wrappers/SimpleWrapper.svelte'; - + import ButtonBar from '$lib/controls/ButtonBar.svelte'; export let structuresURLs = [ { url: 'https://files.rcsb.org/view/7YUB.cif', type: 'mmcif' }, { url: 'https://alphafold.ebi.ac.uk/files/AF-P00533-F1-model_v4.cif', type: 'mmcif' } @@ -10,7 +10,7 @@ let selectedStructuresURLs = [...structuresURLs]; - + {#each selectedStructuresURLs as structureURL (`${structureURL.url}-${structureURL.type}`)} @@ -18,6 +18,7 @@ +
Displaying: {#each selectedStructuresURLs as structureURL (`${structureURL.url}-${structureURL.type}`)} diff --git a/src/routes/components/simple-controls/DemoControls2.svelte b/src/routes/components/simple-controls/DemoControls2.svelte new file mode 100644 index 0000000..daad86f --- /dev/null +++ b/src/routes/components/simple-controls/DemoControls2.svelte @@ -0,0 +1,37 @@ + + +
+ + + + + + +
+ + + +
+ Displaying: + {#each selectedStructuresURLs as structureURL (`${structureURL.url}-${structureURL.type}`)} +

{structureURL.url} ({structureURL.type})

+ {/each} +
+
+
+