UniTmpHelper.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. /**
  2. * Copyright (C) 2023, Protein Bioinformatics Research Group, RCNS
  3. *
  4. * Licensed under CC BY-NC 4.0, see LICENSE file for more info.
  5. *
  6. * @author Gabor Tusnady <tusnady.gabor@ttk.hu>
  7. * @author Csongor Gerdan <gerdan.csongor@ttk.hu>
  8. */
  9. import { PDBTMDescriptor } from "./tmdet-extension/types";
  10. import { setMembraneOrientation, TmDetDescriptorCache } from "./tmdet-extension/prop";
  11. import { createMembraneOrientation } from "./tmdet-extension/transformation";
  12. import { DebugUtil } from "./tmdet-extension/debug-utils";
  13. export async function fetchDescriptor(url: string) {
  14. const response = await fetch(url);
  15. const descriptor = await response.json();
  16. return descriptor;
  17. }
  18. export async function registerRegionDescriptorData(url: string, side1: "Inside"|"Outside"|null) {
  19. const pdbtmDescriptor: PDBTMDescriptor = await fetchDescriptor(url);
  20. pdbtmDescriptor.side1 = side1;
  21. TmDetDescriptorCache.add(pdbtmDescriptor);
  22. const membraneOrientation = createMembraneOrientation(pdbtmDescriptor);
  23. setMembraneOrientation(membraneOrientation);
  24. DebugUtil.log('TMDET Membrane Orientation Params:', membraneOrientation);
  25. }