-
Hi Team Observable,
I'll work on some import options but it might make for a nice addition to the library section. thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 16 replies
-
Here’s how I got it working. First I downloaded the molstar library, putting the files in curl -o docs/molstar.js https://molstar.org/viewer/molstar.js
curl -o docs/molstar.css https://molstar.org/viewer/molstar.css Then I created the following page following the plugin documentation: <link rel="stylesheet" type="text/css" href="molstar.css">
```js
import "./molstar.js";
const molstar = window.molstar;
```
<div id="app" style="position: relative; width: 800px; height: 600px;"></div>
```js echo
molstar.Viewer.create("app", {
layoutIsExpanded: false,
layoutShowControls: false,
layoutShowRemoteState: false,
layoutShowSequence: true,
layoutShowLog: false,
layoutShowLeftPanel: true,
viewportShowExpand: true,
viewportShowSelectionMode: false,
viewportShowAnimation: false,
pdbProvider: "rcsb",
emdbProvider: "rcsb",
}).then(viewer => {
viewer.loadPdb("7bv2");
viewer.loadEmdb("EMD-30210", {detail: 6});
});
``` It looks like this: ![]() You currently need to use |
Beta Was this translation helpful? Give feedback.
-
wow. you are..... amazing. fast and amazing. |
Beta Was this translation helpful? Give feedback.
-
HI Good Morning @mbostock , I ran into an issue extending the above example to use a local file. For example if we add a local PDB and attempt to use it we get encounter an issue related to file not found. Can you point me to how to let Observable know about local static assets in this case? thank you, curl -o docs/7BV2.pdb https://files.rcsb.org/download/7BV2.pdb molstar.Viewer.create("app", {
layoutIsExpanded: false,
}).then((viewer) => {
viewer.loadStructureFromUrl("7BV2.pdb", "pdb"); // <-- file is not found
}); |
Beta Was this translation helpful? Give feedback.
-
Thanks for spotting the CSS error, this was my mistake: a last-minute change so I could display the code, and I did not verify. The missing file error was due to #1367; observable cloud deploy is case sensitive — the code was requesting |
Beta Was this translation helpful? Give feedback.
Here’s how I got it working. First I downloaded the molstar library, putting the files in
docs
:Then I created the following page following the plugin documentation: