jmbuhr / quarto-molstar

Shortcode to embed proteins and trajectories with Mol*
https://jmbuhr.de/quarto-molstar/
MIT License
42 stars 4 forks source link

Support for MolViewSpec output? #16

Closed zachcp closed 5 months ago

zachcp commented 5 months ago

I recently came across the mol-view-spec repo and it seems like a great way to programatically setup more complicated views that can be distributed. How difficult do you think it would be to support this format in quarto-molstar?

zachcp commented 5 months ago

This looks like you would only need to specify the MVSJ file and it will load the rest. Would you be open to a PR?


<link rel="stylesheet" type="text/css" href="molstar.css">
<script src="molstar.js"></script>
<div id = "app"></div>

<script>
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.loadMvsFromUrl("./test.json", "mvsj");  //  <== Looks like the viewer can load an MVSJ with just this line.
});

</script>
jmbuhr commented 5 months ago

absolutely, would be a great addition :)

jmbuhr commented 5 months ago

I didn't expect this to work, because we are getting the js and css for the embedded molstar from their web-viewer example (https://github.com/jmbuhr/quarto-molstar?tab=readme-ov-file#update-mol-extension-developement), in which I didn't see the UI for the extension, but maybe it's still built in.

zachcp commented 5 months ago

FYI: https://zachcp.github.io/molstarspec-docs/