@i-vresse/haddock3-ui 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +4 -1
  2. package/dist/{src/CopyToClipBoardIcon.d.ts → CopyToClipBoardIcon.d.ts} +1 -0
  3. package/dist/CopyToClipBoardIcon.d.ts.map +1 -0
  4. package/dist/CopyToClipBoardIcon.js +5 -0
  5. package/dist/CopyToClipBoardIcon.js.map +1 -0
  6. package/dist/Hetero.d.ts +17 -0
  7. package/dist/Hetero.d.ts.map +1 -0
  8. package/dist/Hetero.js +36 -0
  9. package/dist/Hetero.js.map +1 -0
  10. package/dist/HiddenFileInput.d.ts +5 -0
  11. package/dist/HiddenFileInput.d.ts.map +1 -0
  12. package/dist/HiddenFileInput.js +14 -0
  13. package/dist/HiddenFileInput.js.map +1 -0
  14. package/dist/LinkToFile.d.ts +7 -0
  15. package/dist/LinkToFile.d.ts.map +1 -0
  16. package/dist/LinkToFile.js +14 -0
  17. package/dist/LinkToFile.js.map +1 -0
  18. package/dist/cn.d.ts +12 -0
  19. package/dist/cn.d.ts.map +1 -0
  20. package/dist/cn.js +15 -0
  21. package/dist/cn.js.map +1 -0
  22. package/dist/getResName1.d.ts +21 -0
  23. package/dist/getResName1.d.ts.map +1 -0
  24. package/dist/getResName1.js +78 -0
  25. package/dist/getResName1.js.map +1 -0
  26. package/dist/index.d.ts +6 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +9 -510
  29. package/dist/index.js.map +1 -1
  30. package/dist/{src/molviewer.d.ts → molviewer.d.ts} +74 -9
  31. package/dist/molviewer.d.ts.map +1 -0
  32. package/dist/molviewer.js +393 -0
  33. package/dist/molviewer.js.map +1 -0
  34. package/dist/{src/toggles → toggles}/ResidueHeader.d.ts +2 -2
  35. package/dist/toggles/ResidueHeader.d.ts.map +1 -0
  36. package/dist/toggles/ResidueHeader.js +10 -0
  37. package/dist/toggles/ResidueHeader.js.map +1 -0
  38. package/dist/toggles/variants.d.ts +6 -0
  39. package/dist/toggles/variants.d.ts.map +1 -0
  40. package/dist/toggles/variants.js +12 -0
  41. package/dist/toggles/variants.js.map +1 -0
  42. package/dist/{src/toggles.d.ts → toggles.d.ts} +33 -2
  43. package/dist/toggles.d.ts.map +1 -0
  44. package/dist/toggles.js +116 -0
  45. package/dist/toggles.js.map +1 -0
  46. package/dist/useChunked.d.ts +30 -0
  47. package/dist/useChunked.d.ts.map +1 -0
  48. package/dist/useChunked.js +44 -0
  49. package/dist/useChunked.js.map +1 -0
  50. package/package.json +86 -15
  51. package/src/CopyToClipBoardIcon.stories.tsx +5 -0
  52. package/src/CopyToClipBoardIcon.tsx +18 -0
  53. package/src/Hetero.tsx +46 -0
  54. package/src/HiddenFileInput.stories.tsx +26 -0
  55. package/src/HiddenFileInput.tsx +15 -0
  56. package/src/LinkToFile.stories.tsx +20 -0
  57. package/src/LinkToFile.tsx +33 -0
  58. package/src/ResiduesSelect.stories.tsx +320 -0
  59. package/src/cn.ts +15 -0
  60. package/src/getResName1.ts +81 -0
  61. package/src/index.tsx +15 -0
  62. package/src/molviewer.tsx +740 -0
  63. package/src/toggles/ResidueHeader.stories.tsx +15 -0
  64. package/src/toggles/ResidueHeader.tsx +34 -0
  65. package/src/toggles/variants.ts +13 -0
  66. package/src/toggles.tsx +372 -0
  67. package/src/useChunked.test.ts +33 -0
  68. package/src/useChunked.ts +48 -0
  69. package/dist/src/CopyToClipBoardIcon.stories.d.ts +0 -3
  70. package/dist/src/MdxLayout.d.ts +0 -13
  71. package/dist/src/ResiduesSelect.stories.d.ts +0 -9
  72. package/dist/src/cn.d.ts +0 -3
  73. package/dist/src/index.d.ts +0 -9
  74. package/dist/src/molviewer--residues.stories.d.ts +0 -6
  75. package/dist/src/molviewer--simpleviewer.stories.d.ts +0 -3
  76. package/dist/src/molviewer--surface.stories.d.ts +0 -6
  77. package/dist/src/structure.d.ts +0 -1
  78. package/dist/src/toggles/ResidueHeader.stories.d.ts +0 -6
  79. package/dist/src/toggles/variants.d.ts +0 -2
  80. package/dist/src/useChunked.d.ts +0 -1
  81. package/dist/src/useChunked.stories.d.ts +0 -3
package/README.md CHANGED
@@ -12,6 +12,7 @@ The [haddock3 web application](https://github.com/i-VRESSE/haddock3-webapp) had
12
12
 
13
13
  - Components to render a 3D molecular structure from [PDB file](https://www.wwpdb.org/) using [NGL](https://nglviewer.org/)
14
14
  - Components to select residues in a molecule either passive or active
15
+ - Components to handle files
15
16
 
16
17
  ## Installation
17
18
 
@@ -27,7 +28,7 @@ For your own webapp to pick up the classes in the components, you need to add th
27
28
  export default {
28
29
  content: [
29
30
  // Existing content goes here
30
- './node_modules/@i-vresse/haddock3-ui/dist/index.js',
31
+ './node_modules/@i-vresse/haddock3-ui/dist/**/*.js',
31
32
  ],
32
33
  // Rest of the config goes here
33
34
  }
@@ -42,3 +43,5 @@ Once component is selected
42
43
  - interact with component
43
44
  - use `</>` button in footer to see the code.
44
45
  - use sliders icon button in footer to change props when available
46
+
47
+ API documentation is available at [https://i-VRESSE.github.io/haddock3-ui/api/](https://i-VRESSE.github.io/haddock3-ui/api/)
@@ -1 +1,2 @@
1
1
  export declare function CopyToClipBoardIcon(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=CopyToClipBoardIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyToClipBoardIcon.d.ts","sourceRoot":"","sources":["../src/CopyToClipBoardIcon.tsx"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,4CAiBlC"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function CopyToClipBoardIcon() {
3
+ return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.746.07A.5.5 0 0011.5.003h-6a.5.5 0 00-.5.5v2.5H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h8a.5.5 0 00.5-.5v-2.5h4.5a.5.5 0 00.5-.5v-8a.498.498 0 00-.15-.357L11.857.154a.506.506 0 00-.11-.085zM9 10.003h4v-7h-1.5a.5.5 0 01-.5-.5v-1.5H6v2h.5a.5.5 0 01.357.15L8.85 5.147c.093.09.15.217.15.357v4.5zm-8-6v9h7v-7H6.5a.5.5 0 01-.5-.5v-1.5H1z", fill: "currentColor" }) }));
4
+ }
5
+ //# sourceMappingURL=CopyToClipBoardIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyToClipBoardIcon.js","sourceRoot":"","sources":["../src/CopyToClipBoardIcon.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,mBAAmB;IAClC,OAAO,CACN,cACC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,YAElC,eACC,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,2UAA2U,EAC7U,IAAI,EAAC,cAAc,GACZ,GACH,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface Hetero {
2
+ resno: number;
3
+ resname: string;
4
+ chain: string;
5
+ /**
6
+ * HETNAME record value from the PDB file.
7
+ */
8
+ description?: string;
9
+ }
10
+ /**
11
+ * Retrieve hetero residues from a PDB file.
12
+ *
13
+ * @param file PDB file to read from
14
+ * @returns
15
+ */
16
+ export declare function heterosFromFile(file: File): Promise<Hetero[]>;
17
+ //# sourceMappingURL=Hetero.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hetero.d.ts","sourceRoot":"","sources":["../src/Hetero.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BnE"}
package/dist/Hetero.js ADDED
@@ -0,0 +1,36 @@
1
+ import { autoLoad } from "ngl";
2
+ /**
3
+ * Retrieve hetero residues from a PDB file.
4
+ *
5
+ * @param file PDB file to read from
6
+ * @returns
7
+ */
8
+ export async function heterosFromFile(file) {
9
+ const structure = await autoLoad(file);
10
+ const heteros = [];
11
+ structure.eachResidue((r) => {
12
+ if (r.isHetero() && !r.isWater() && !r.isIon()) {
13
+ const hetero = {
14
+ resno: r.resno,
15
+ resname: r.resname,
16
+ chain: r.chain.chainname,
17
+ };
18
+ if (r.entity) {
19
+ hetero.description = r.entity.description;
20
+ }
21
+ heteros.push(hetero);
22
+ }
23
+ });
24
+ heteros.sort((a, b) => {
25
+ if (a.resname !== b.resname) {
26
+ return a.resname.localeCompare(b.resname);
27
+ }
28
+ if (a.chain !== b.chain) {
29
+ return a.chain.localeCompare(b.chain);
30
+ }
31
+ return a.resno - b.resno;
32
+ });
33
+ return heteros;
34
+ }
35
+ // TODO write e2e test. Unit test not possible because ngl does not work in nodejs.
36
+ //# sourceMappingURL=Hetero.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hetero.js","sourceRoot":"","sources":["../src/Hetero.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,KAAK,CAAC;AAY/C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAU;IAC/C,MAAM,SAAS,GAAc,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YAChD,MAAM,MAAM,GAAW;gBACtB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS;aACxB,CAAC;YACF,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;gBACd,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;YAC3C,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrB,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;YAC7B,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AAChB,CAAC;AACD,mFAAmF"}
@@ -0,0 +1,5 @@
1
+ export declare function HiddenFileInput({ name, file }: {
2
+ name: string;
3
+ file: File;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=HiddenFileInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenFileInput.d.ts","sourceRoot":"","sources":["../src/HiddenFileInput.tsx"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,2CAY3E"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from "react";
3
+ export function HiddenFileInput({ name, file }) {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ if (ref.current) {
7
+ const dataTransfer = new DataTransfer();
8
+ dataTransfer.items.add(file);
9
+ ref.current.files = dataTransfer.files;
10
+ }
11
+ }, [file]);
12
+ return _jsx("input", { ref: ref, type: "file", name: name, className: "hidden" });
13
+ }
14
+ //# sourceMappingURL=HiddenFileInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenFileInput.js","sourceRoot":"","sources":["../src/HiddenFileInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAgC;IAC3E,MAAM,GAAG,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAE3C,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;YACxC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC7B,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QACxC,CAAC;IACF,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,gBAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,QAAQ,GAAG,CAAC;AACvE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ export declare function LinkToFile({ file, children, className, }: {
3
+ file: File;
4
+ children: ReactNode;
5
+ className?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=LinkToFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkToFile.d.ts","sourceRoot":"","sources":["../src/LinkToFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAK5D,wBAAgB,UAAU,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,SAAqB,GACrB,EAAE;IACF,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,2CAmBA"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { cn } from "./cn.js";
4
+ // TODO allow other a tag attributes like title or target to be passed in
5
+ export function LinkToFile({ file, children, className = undefined, }) {
6
+ const [url, setUrl] = useState("#");
7
+ useEffect(() => {
8
+ const url = URL.createObjectURL(file);
9
+ setUrl(url);
10
+ return () => URL.revokeObjectURL(url);
11
+ }, [file]);
12
+ return (_jsx("a", { className: cn("underline", className), download: file.name, href: url, type: file.type, children: children }));
13
+ }
14
+ //# sourceMappingURL=LinkToFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkToFile.js","sourceRoot":"","sources":["../src/LinkToFile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,yEAAyE;AAEzE,MAAM,UAAU,UAAU,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,SAAS,GAAG,SAAS,GAKrB;IACA,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEpC,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,CAAC;QACZ,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACN,YACC,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EACrC,QAAQ,EAAE,IAAI,CAAC,IAAI,EACnB,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,IAAI,YAEd,QAAQ,GACN,CACJ,CAAC;AACH,CAAC"}
package/dist/cn.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { type ClassValue } from "clsx";
2
+ /**
3
+ * Smartly combines multiple tailwind class names into a single string.
4
+ *
5
+ * @see https://github.com/lukeed/clsx
6
+ * @see https://github.com/dcastil/tailwind-merge
7
+ *
8
+ * @param inputs - The class names to be combined.
9
+ * @returns The combined class names as a string.
10
+ */
11
+ export declare function cn(...inputs: ClassValue[]): string;
12
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../src/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
package/dist/cn.js ADDED
@@ -0,0 +1,15 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ /**
4
+ * Smartly combines multiple tailwind class names into a single string.
5
+ *
6
+ * @see https://github.com/lukeed/clsx
7
+ * @see https://github.com/dcastil/tailwind-merge
8
+ *
9
+ * @param inputs - The class names to be combined.
10
+ * @returns The combined class names as a string.
11
+ */
12
+ export function cn(...inputs) {
13
+ return twMerge(clsx(inputs));
14
+ }
15
+ //# sourceMappingURL=cn.js.map
package/dist/cn.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.js","sourceRoot":"","sources":["../src/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACzC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Retrieves the character for a given residue name.
3
+ *
4
+ * Besides amino acids, this function also
5
+ * supports charm forcefield, amber forcefield,
6
+ * DNA nucleotides and RNA nucleotides.
7
+ *
8
+ * @param resname - The residue name to retrieve the abbreviated name for.
9
+ * @returns The abbreviated name for the given resource name, or "X" if no abbreviation is found.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { getResName1 } from "@i-vresse/haddock3-ui/getResName1";
14
+ * getResName1("ALA"); // "A"
15
+ * getResName1("DA"); // "A"
16
+ * getResName1("A"); // "A"
17
+ * getResName1("UNK"); // "X"
18
+ * ```
19
+ */
20
+ export declare function getResName1(resname: string): "H" | "R" | "K" | "I" | "F" | "L" | "W" | "A" | "M" | "P" | "C" | "N" | "V" | "G" | "S" | "Q" | "Y" | "D" | "E" | "T" | "U" | "O";
21
+ //# sourceMappingURL=getResName1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResName1.d.ts","sourceRoot":"","sources":["../src/getResName1.ts"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,qIAE1C"}
@@ -0,0 +1,78 @@
1
+ /*
2
+ * NGL does not have single letter for DNA or RNA, but molstar does.
3
+ * Use molstar implementation from
4
+ * https://github.com/molstar/molstar/blob/5a2ee03b48e1822c8843d65eb18d578af0579b9f/src/mol-model/sequence/constants.ts#L18-L85
5
+ */
6
+ const Name2OneLetter = {
7
+ HIS: "H",
8
+ ARG: "R",
9
+ LYS: "K",
10
+ ILE: "I",
11
+ PHE: "F",
12
+ LEU: "L",
13
+ TRP: "W",
14
+ ALA: "A",
15
+ MET: "M",
16
+ PRO: "P",
17
+ CYS: "C",
18
+ ASN: "N",
19
+ VAL: "V",
20
+ GLY: "G",
21
+ SER: "S",
22
+ GLN: "Q",
23
+ TYR: "Y",
24
+ ASP: "D",
25
+ GLU: "E",
26
+ THR: "T",
27
+ SEC: "U", // as per IUPAC definition
28
+ PYL: "O", // as per IUPAC definition
29
+ // charmm ff
30
+ HSD: "H",
31
+ HSE: "H",
32
+ HSP: "H",
33
+ LSN: "K",
34
+ ASPP: "D",
35
+ GLUP: "E",
36
+ // amber ff
37
+ HID: "H",
38
+ HIE: "H",
39
+ HIP: "H",
40
+ LYN: "K",
41
+ ASH: "D",
42
+ GLH: "E",
43
+ // DNA
44
+ DA: "A",
45
+ DC: "C",
46
+ DG: "G",
47
+ DT: "T",
48
+ DU: "U",
49
+ // RNA
50
+ A: "A",
51
+ C: "C",
52
+ G: "G",
53
+ T: "T",
54
+ U: "U",
55
+ };
56
+ /**
57
+ * Retrieves the character for a given residue name.
58
+ *
59
+ * Besides amino acids, this function also
60
+ * supports charm forcefield, amber forcefield,
61
+ * DNA nucleotides and RNA nucleotides.
62
+ *
63
+ * @param resname - The residue name to retrieve the abbreviated name for.
64
+ * @returns The abbreviated name for the given resource name, or "X" if no abbreviation is found.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * import { getResName1 } from "@i-vresse/haddock3-ui/getResName1";
69
+ * getResName1("ALA"); // "A"
70
+ * getResName1("DA"); // "A"
71
+ * getResName1("A"); // "A"
72
+ * getResName1("UNK"); // "X"
73
+ * ```
74
+ */
75
+ export function getResName1(resname) {
76
+ return Name2OneLetter[resname] || "X";
77
+ }
78
+ //# sourceMappingURL=getResName1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResName1.js","sourceRoot":"","sources":["../src/getResName1.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACtB,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IAER,GAAG,EAAE,GAAG,EAAE,0BAA0B;IACpC,GAAG,EAAE,GAAG,EAAE,0BAA0B;IAEpC,YAAY;IACZ,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IAET,WAAW;IACX,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,MAAM;IACN,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,MAAM;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;CACG,CAAC;AAEX;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IAC1C,OAAO,cAAc,CAAC,OAAsC,CAAC,IAAI,GAAG,CAAC;AACtE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { NGLComponent, NGLResidues, NGLStage, SimpleViewer, LigandViewer, Viewer, } from "./molviewer.js";
2
+ export { PickIn3D, ResiduesSelect } from "./toggles.js";
3
+ export { CopyToClipBoardIcon } from "./CopyToClipBoardIcon.js";
4
+ export { LinkToFile } from "./LinkToFile.js";
5
+ export { HiddenFileInput } from "./HiddenFileInput.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,MAAM,GACN,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}