index.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {RcsbFv3DAssembly} from "../../RcsbFv3D/RcsbFv3DAssembly";
  2. import {RcsbFvTrackDataElementInterface} from "@rcsb/rcsb-saguaro/lib/RcsbDataManager/RcsbDataManager";
  3. document.addEventListener("DOMContentLoaded", function(event) {
  4. function getJsonFromUrl() {
  5. const url = location.search;
  6. var query = url.substring(1);
  7. var result: any = {};
  8. query.split("&").forEach(function(part) {
  9. var item = part.split("=");
  10. result[item[0]] = decodeURIComponent(item[1]);
  11. });
  12. return result;
  13. }
  14. const args: {pdbId:string} = getJsonFromUrl().pdbId ? getJsonFromUrl() : {pdbId:"4hhb"};
  15. const sequenceConfig = {
  16. entryId: args.pdbId,
  17. title: "Title " + args.pdbId,
  18. subtitle: "Subtitle for " + args.pdbId
  19. };
  20. const panel3d = new RcsbFv3DAssembly({
  21. elementId: "pfv",
  22. config: sequenceConfig,
  23. instanceSequenceConfig:{
  24. dropdownTitle: "Chain",
  25. module: "interface"
  26. },
  27. additionalConfig: {
  28. boardConfig: {
  29. elementClickCallback: (e?: RcsbFvTrackDataElementInterface & {type?: string;}) => {
  30. console.log(`Element clicked ${e?.type}`)
  31. }
  32. }
  33. },
  34. useOperatorsFlag: true
  35. });
  36. panel3d.render();
  37. });