jbrowse-plugin-mafviewer 1.4.5 → 1.4.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 (169) hide show
  1. package/dist/BigMafAdapter/BigMafAdapter.js +4 -5
  2. package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
  3. package/dist/BigMafAdapter/configSchema.d.ts +2 -2
  4. package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js +38 -108
  5. package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js.map +1 -1
  6. package/dist/LinearMafDisplay/components/MAFTooltip.d.ts +0 -3
  7. package/dist/LinearMafDisplay/components/MAFTooltip.js.map +1 -1
  8. package/dist/LinearMafDisplay/components/MsaHighlightOverlay.d.ts +9 -0
  9. package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js +34 -0
  10. package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js.map +1 -0
  11. package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js +1 -1
  12. package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js.map +1 -1
  13. package/dist/LinearMafDisplay/components/useDragSelection.d.ts +25 -0
  14. package/dist/LinearMafDisplay/components/useDragSelection.js +103 -0
  15. package/dist/LinearMafDisplay/components/useDragSelection.js.map +1 -0
  16. package/dist/LinearMafDisplay/configSchema.d.ts +3 -30
  17. package/dist/LinearMafDisplay/stateModel.d.ts +1043 -121
  18. package/dist/LinearMafDisplay/stateModel.js +85 -41
  19. package/dist/LinearMafDisplay/stateModel.js.map +1 -1
  20. package/dist/LinearMafDisplay/types.d.ts +2 -2
  21. package/dist/LinearMafDisplay/util.d.ts +5 -0
  22. package/dist/LinearMafDisplay/util.js +25 -4
  23. package/dist/LinearMafDisplay/util.js.map +1 -1
  24. package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +41 -5
  25. package/dist/LinearMafRenderer/LinearMafRenderer.js +1 -1
  26. package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
  27. package/dist/LinearMafRenderer/components/LinearMafRendering.d.ts +14 -5
  28. package/dist/LinearMafRenderer/components/LinearMafRendering.js +21 -19
  29. package/dist/LinearMafRenderer/components/LinearMafRendering.js.map +1 -1
  30. package/dist/LinearMafRenderer/configSchema.d.ts +1 -6
  31. package/dist/LinearMafRenderer/configSchema.js +1 -6
  32. package/dist/LinearMafRenderer/configSchema.js.map +1 -1
  33. package/dist/LinearMafRenderer/rendering/insertions.d.ts +1 -1
  34. package/dist/LinearMafRenderer/rendering/insertions.js +2 -2
  35. package/dist/LinearMafRenderer/rendering/mismatches.d.ts +1 -1
  36. package/dist/LinearMafRenderer/rendering/mismatches.js +3 -3
  37. package/dist/LinearMafRenderer/rendering/types.d.ts +1 -1
  38. package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +1 -1
  39. package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
  40. package/dist/MafAddTrackWorkflow/index.js +1 -1
  41. package/dist/MafAddTrackWorkflow/index.js.map +1 -1
  42. package/dist/MafGetSequences/MafGetSequences.d.ts +1 -0
  43. package/dist/MafGetSequences/MafGetSequences.js +2 -1
  44. package/dist/MafGetSequences/MafGetSequences.js.map +1 -1
  45. package/dist/MafSequenceWidget/LabelsCanvas.d.ts +8 -0
  46. package/dist/MafSequenceWidget/LabelsCanvas.js +37 -0
  47. package/dist/MafSequenceWidget/LabelsCanvas.js.map +1 -0
  48. package/dist/MafSequenceWidget/MafSequenceHoverHighlight.d.ts +6 -0
  49. package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js +52 -0
  50. package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js.map +1 -0
  51. package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.d.ts +2 -0
  52. package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js +12 -0
  53. package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js.map +1 -0
  54. package/dist/MafSequenceWidget/MafSequenceWidget.d.ts +6 -0
  55. package/dist/MafSequenceWidget/MafSequenceWidget.js +189 -0
  56. package/dist/MafSequenceWidget/MafSequenceWidget.js.map +1 -0
  57. package/dist/MafSequenceWidget/SequenceCanvas.d.ts +12 -0
  58. package/dist/MafSequenceWidget/SequenceCanvas.js +86 -0
  59. package/dist/MafSequenceWidget/SequenceCanvas.js.map +1 -0
  60. package/dist/MafSequenceWidget/SequenceDisplay.d.ts +12 -0
  61. package/dist/MafSequenceWidget/SequenceDisplay.js +117 -0
  62. package/dist/MafSequenceWidget/SequenceDisplay.js.map +1 -0
  63. package/dist/MafSequenceWidget/SequenceTooltip.d.ts +11 -0
  64. package/dist/MafSequenceWidget/SequenceTooltip.js +39 -0
  65. package/dist/MafSequenceWidget/SequenceTooltip.js.map +1 -0
  66. package/dist/MafSequenceWidget/baseColors.d.ts +3 -0
  67. package/dist/MafSequenceWidget/baseColors.js +64 -0
  68. package/dist/MafSequenceWidget/baseColors.js.map +1 -0
  69. package/dist/MafSequenceWidget/colToGenomePos.d.ts +13 -0
  70. package/dist/MafSequenceWidget/colToGenomePos.js +32 -0
  71. package/dist/MafSequenceWidget/colToGenomePos.js.map +1 -0
  72. package/dist/MafSequenceWidget/colToGenomePos.test.d.ts +1 -0
  73. package/dist/MafSequenceWidget/colToGenomePos.test.js +136 -0
  74. package/dist/MafSequenceWidget/colToGenomePos.test.js.map +1 -0
  75. package/dist/MafSequenceWidget/configSchema.d.ts +1 -0
  76. package/dist/MafSequenceWidget/configSchema.js +3 -0
  77. package/dist/MafSequenceWidget/configSchema.js.map +1 -0
  78. package/dist/MafSequenceWidget/constants.d.ts +4 -0
  79. package/dist/MafSequenceWidget/constants.js +5 -0
  80. package/dist/MafSequenceWidget/constants.js.map +1 -0
  81. package/dist/MafSequenceWidget/index.d.ts +2 -0
  82. package/dist/MafSequenceWidget/index.js +16 -0
  83. package/dist/MafSequenceWidget/index.js.map +1 -0
  84. package/dist/MafSequenceWidget/stateModelFactory.d.ts +67 -0
  85. package/dist/MafSequenceWidget/stateModelFactory.js +21 -0
  86. package/dist/MafSequenceWidget/stateModelFactory.js.map +1 -0
  87. package/dist/MafTabixAdapter/MafTabixAdapter.js +4 -35
  88. package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
  89. package/dist/MafTabixAdapter/configSchema.d.ts +4 -4
  90. package/dist/MafTrack/configSchema.d.ts +16 -11
  91. package/dist/index.js +2 -0
  92. package/dist/index.js.map +1 -1
  93. package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +12 -24
  94. package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
  95. package/dist/util/clipboard.d.ts +2 -0
  96. package/dist/util/clipboard.js +28 -0
  97. package/dist/util/clipboard.js.map +1 -0
  98. package/dist/util/fastaUtils.d.ts +2 -1
  99. package/dist/util/fastaUtils.js +72 -2
  100. package/dist/util/fastaUtils.js.map +1 -1
  101. package/dist/util/fastaUtils.test.js +190 -0
  102. package/dist/util/fastaUtils.test.js.map +1 -1
  103. package/dist/util/parseAssemblyName.d.ts +32 -0
  104. package/dist/util/parseAssemblyName.js +87 -0
  105. package/dist/util/parseAssemblyName.js.map +1 -0
  106. package/dist/util/parseAssemblyName.test.d.ts +1 -0
  107. package/dist/util/parseAssemblyName.test.js +269 -0
  108. package/dist/util/parseAssemblyName.test.js.map +1 -0
  109. package/package.json +7 -7
  110. package/src/BigMafAdapter/BigMafAdapter.ts +5 -5
  111. package/src/LinearMafDisplay/components/LinearMafDisplayComponent.tsx +62 -144
  112. package/src/LinearMafDisplay/components/MAFTooltip.tsx +0 -3
  113. package/src/LinearMafDisplay/components/MsaHighlightOverlay.tsx +62 -0
  114. package/src/LinearMafDisplay/components/Sidebar/SvgWrapper.tsx +1 -1
  115. package/src/LinearMafDisplay/components/useDragSelection.ts +159 -0
  116. package/src/LinearMafDisplay/stateModel.ts +135 -48
  117. package/src/LinearMafDisplay/types.ts +2 -2
  118. package/src/LinearMafDisplay/util.ts +31 -5
  119. package/src/LinearMafRenderer/LinearMafRenderer.ts +1 -1
  120. package/src/LinearMafRenderer/components/LinearMafRendering.tsx +38 -24
  121. package/src/LinearMafRenderer/configSchema.ts +1 -6
  122. package/src/LinearMafRenderer/rendering/insertions.ts +2 -2
  123. package/src/LinearMafRenderer/rendering/mismatches.ts +3 -3
  124. package/src/LinearMafRenderer/rendering/types.ts +1 -1
  125. package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +1 -1
  126. package/src/MafAddTrackWorkflow/index.ts +1 -1
  127. package/src/MafGetSequences/MafGetSequences.ts +10 -2
  128. package/src/MafSequenceWidget/LabelsCanvas.tsx +58 -0
  129. package/src/MafSequenceWidget/MafSequenceHoverHighlight.tsx +83 -0
  130. package/src/MafSequenceWidget/MafSequenceHoverHighlightExtension.tsx +24 -0
  131. package/src/MafSequenceWidget/MafSequenceWidget.tsx +294 -0
  132. package/src/MafSequenceWidget/SequenceCanvas.tsx +136 -0
  133. package/src/MafSequenceWidget/SequenceDisplay.tsx +188 -0
  134. package/src/MafSequenceWidget/SequenceTooltip.tsx +70 -0
  135. package/src/MafSequenceWidget/baseColors.ts +76 -0
  136. package/src/MafSequenceWidget/colToGenomePos.test.ts +166 -0
  137. package/src/MafSequenceWidget/colToGenomePos.ts +40 -0
  138. package/src/MafSequenceWidget/configSchema.ts +3 -0
  139. package/src/MafSequenceWidget/constants.ts +4 -0
  140. package/src/MafSequenceWidget/index.ts +24 -0
  141. package/src/MafSequenceWidget/stateModelFactory.ts +43 -0
  142. package/src/MafTabixAdapter/MafTabixAdapter.ts +12 -51
  143. package/src/index.ts +2 -0
  144. package/src/util/__snapshots__/fastaUtils.test.ts.snap +35 -0
  145. package/src/util/clipboard.ts +35 -0
  146. package/src/util/fastaUtils.test.ts +199 -0
  147. package/src/util/fastaUtils.ts +94 -1
  148. package/src/util/parseAssemblyName.test.ts +350 -0
  149. package/src/util/parseAssemblyName.ts +106 -0
  150. package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.d.ts +0 -11
  151. package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js +0 -97
  152. package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js.map +0 -1
  153. package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.d.ts +0 -14
  154. package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js +0 -69
  155. package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js.map +0 -1
  156. package/dist/LinearMafDisplay/components/util.d.ts +0 -1
  157. package/dist/LinearMafDisplay/components/util.js +0 -8
  158. package/dist/LinearMafDisplay/components/util.js.map +0 -1
  159. package/dist/util/fetchSequences.d.ts +0 -18
  160. package/dist/util/fetchSequences.js +0 -39
  161. package/dist/util/fetchSequences.js.map +0 -1
  162. package/dist/util/useSequences.d.ts +0 -21
  163. package/dist/util/useSequences.js +0 -64
  164. package/dist/util/useSequences.js.map +0 -1
  165. package/src/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.tsx +0 -175
  166. package/src/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.tsx +0 -105
  167. package/src/LinearMafDisplay/components/util.ts +0 -7
  168. package/src/util/fetchSequences.ts +0 -57
  169. package/src/util/useSequences.ts +0 -90
@@ -0,0 +1,106 @@
1
+ export interface ParsedAssemblyName {
2
+ assemblyName: string
3
+ chr: string
4
+ }
5
+
6
+ /**
7
+ * Parses assembly name and chromosome from a combined string in MAF tabix format.
8
+ *
9
+ * Handles multiple formats:
10
+ * - Single string with no dots: assemblyName is the entire string, chr is empty
11
+ * - `assembly.chr`: Single dot separates assembly name from chromosome
12
+ * - `assembly.version.chr`: Two dots where middle part is numeric (version number)
13
+ * - assemblyName includes the version (e.g., "hg38.1" from "hg38.1.chr1")
14
+ * - `assembly.chr.more`: Two dots where middle part is non-numeric
15
+ * - assemblyName is first part, chr includes rest (e.g., "mm10" and "chr1.random")
16
+ */
17
+ export function parseAssemblyAndChr(
18
+ assemblyAndChr: string,
19
+ ): ParsedAssemblyName {
20
+ const firstDotIndex = assemblyAndChr.indexOf('.')
21
+ if (firstDotIndex === -1) {
22
+ return {
23
+ assemblyName: assemblyAndChr,
24
+ chr: '',
25
+ }
26
+ }
27
+
28
+ const secondDotIndex = assemblyAndChr.indexOf('.', firstDotIndex + 1)
29
+ if (secondDotIndex === -1) {
30
+ return {
31
+ assemblyName: assemblyAndChr.slice(0, firstDotIndex),
32
+ chr: assemblyAndChr.slice(firstDotIndex + 1),
33
+ }
34
+ }
35
+
36
+ const secondPart = assemblyAndChr.slice(firstDotIndex + 1, secondDotIndex)
37
+ const isNumeric = secondPart.length > 0 && !Number.isNaN(+secondPart)
38
+
39
+ if (isNumeric) {
40
+ return {
41
+ assemblyName: assemblyAndChr.slice(0, secondDotIndex),
42
+ chr: assemblyAndChr.slice(secondDotIndex + 1),
43
+ }
44
+ }
45
+
46
+ return {
47
+ assemblyName: assemblyAndChr.slice(0, firstDotIndex),
48
+ chr: assemblyAndChr.slice(firstDotIndex + 1),
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Parses assembly name and chromosome from a combined string in BigMaf format.
54
+ *
55
+ * Uses simple dot splitting: org.chr where org is before the first dot,
56
+ * chr is everything after the first dot.
57
+ */
58
+ export function parseAssemblyAndChrSimple(
59
+ organismChr: string,
60
+ ): ParsedAssemblyName {
61
+ const dotIndex = organismChr.indexOf('.')
62
+ if (dotIndex === -1) {
63
+ return {
64
+ assemblyName: organismChr,
65
+ chr: '',
66
+ }
67
+ }
68
+ return {
69
+ assemblyName: organismChr.slice(0, dotIndex),
70
+ chr: organismChr.slice(dotIndex + 1),
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Selects the appropriate sequence from alignments based on the lookup order:
76
+ * 1. refAssemblyName config value (if provided)
77
+ * 2. query.assemblyName (from the region being queried)
78
+ * 3. firstAssemblyNameFound (fallback to first assembly in data)
79
+ */
80
+ export function selectReferenceSequence(
81
+ alignments: Record<string, { seq: string }>,
82
+ refAssemblyName: string | undefined,
83
+ queryAssemblyName: string | undefined,
84
+ firstAssemblyNameFound: string | undefined,
85
+ ): string | undefined {
86
+ let entry
87
+ if (refAssemblyName) {
88
+ entry = alignments[refAssemblyName]
89
+ if (entry) {
90
+ return entry.seq
91
+ }
92
+ }
93
+ if (queryAssemblyName) {
94
+ entry = alignments[queryAssemblyName]
95
+ if (entry) {
96
+ return entry.seq
97
+ }
98
+ }
99
+ if (firstAssemblyNameFound) {
100
+ entry = alignments[firstAssemblyNameFound]
101
+ if (entry) {
102
+ return entry.seq
103
+ }
104
+ }
105
+ return undefined
106
+ }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { LinearMafDisplayModel } from '../../stateModel';
3
- declare const GetSequenceDialog: ({ onClose, model, selectionCoords, }: {
4
- onClose: () => void;
5
- model: LinearMafDisplayModel;
6
- selectionCoords?: {
7
- dragStartX: number;
8
- dragEndX: number;
9
- };
10
- }) => React.JSX.Element;
11
- export default GetSequenceDialog;
@@ -1,97 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Dialog, ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
3
- import { getSession } from '@jbrowse/core/util';
4
- import { Button, DialogActions, DialogContent, TextField, ToggleButton, ToggleButtonGroup, } from '@mui/material';
5
- import { observer } from 'mobx-react';
6
- import { makeStyles } from 'tss-react/mui';
7
- import { useSequences } from '../../../util/useSequences';
8
- const useStyles = makeStyles()({
9
- dialogContent: {
10
- width: '80em',
11
- },
12
- textAreaInput: {
13
- fontFamily: 'monospace',
14
- whiteSpace: 'pre',
15
- overflowX: 'auto',
16
- },
17
- ml: {
18
- marginLeft: 10,
19
- },
20
- });
21
- const GetSequenceDialog = observer(function ({ onClose, model, selectionCoords, }) {
22
- const [showAllLetters, setShowAllLetters] = useState(true);
23
- const { classes } = useStyles();
24
- const { sequence, loading, error } = useSequences({
25
- model,
26
- selectionCoords,
27
- showAllLetters,
28
- });
29
- const sequenceTooLarge = sequence ? sequence.length > 1_000_000 : false;
30
- return (React.createElement(Dialog, { open: true, onClose: onClose, title: "Subsequence Data", maxWidth: "xl" },
31
- React.createElement(DialogContent, null,
32
- React.createElement("div", { style: {
33
- display: 'flex',
34
- alignItems: 'center',
35
- marginBottom: '16px',
36
- } },
37
- React.createElement(ToggleButtonGroup, { value: showAllLetters, exclusive: true, size: "small", onChange: (_event, newDisplayMode) => {
38
- if (newDisplayMode !== null) {
39
- setShowAllLetters(newDisplayMode);
40
- }
41
- } },
42
- React.createElement(ToggleButton, { value: true }, "Show All Letters"),
43
- React.createElement(ToggleButton, { value: false }, "Show Only Differences")),
44
- React.createElement("div", { style: { flexGrow: 1 } }),
45
- React.createElement(Button, { variant: "contained", color: "primary", disabled: loading || !sequence, onClick: () => {
46
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
47
- ;
48
- (async () => {
49
- try {
50
- await navigator.clipboard.writeText(sequence);
51
- getSession(model).notify('Sequence copied to clipboard', 'info');
52
- }
53
- catch (e) {
54
- console.error(e);
55
- getSession(model).notifyError(`${e}`, e);
56
- }
57
- })();
58
- } }, "Copy to Clipboard"),
59
- React.createElement(Button, { variant: "contained", color: "secondary", disabled: loading || !sequence, onClick: () => {
60
- try {
61
- const url = URL.createObjectURL(new Blob([sequence], { type: 'text/plain' }));
62
- // Create a temporary anchor element
63
- const a = document.createElement('a');
64
- a.href = url;
65
- a.download = 'sequence.fasta';
66
- // Trigger the download
67
- document.body.append(a);
68
- a.click();
69
- // Clean up
70
- a.remove();
71
- URL.revokeObjectURL(url);
72
- getSession(model).notify('Sequence downloaded', 'info');
73
- }
74
- catch (e) {
75
- console.error(e);
76
- getSession(model).notifyError(`${e}`, e);
77
- }
78
- } }, "Download")),
79
- error ? (React.createElement(ErrorMessage, { error: error })) : (React.createElement(React.Fragment, null,
80
- loading ? React.createElement(LoadingEllipses, null) : null,
81
- React.createElement(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, disabled: sequenceTooLarge, className: classes.dialogContent, fullWidth: true, value: loading
82
- ? 'Loading...'
83
- : sequenceTooLarge
84
- ? 'Reference sequence too large to display, use the download FASTA button'
85
- : sequence, slotProps: {
86
- input: {
87
- readOnly: true,
88
- classes: {
89
- input: classes.textAreaInput,
90
- },
91
- },
92
- } })))),
93
- React.createElement(DialogActions, null,
94
- React.createElement(Button, { color: "primary", variant: "outlined", onClick: onClose }, "Close"))));
95
- });
96
- export default GetSequenceDialog;
97
- //# sourceMappingURL=GetSequenceDialog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetSequenceDialog.js","sourceRoot":"","sources":["../../../../src/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAIzD,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC7B,aAAa,EAAE;QACb,KAAK,EAAE,MAAM;KACd;IACD,aAAa,EAAE;QACb,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,MAAM;KAClB;IACD,EAAE,EAAE;QACF,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAG,QAAQ,CAAC,UAAU,EAC3C,OAAO,EACP,KAAK,EACL,eAAe,GAQhB;IACC,MAAM,CAAC,cAAc,EAAE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KAAK,CAAC,CAAC,CAAC,CAAA;4BAChB,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;wBAC1C,CAAC;oBACH,CAAC,eAGM,CACL;YAEL,KAAK,CAAC,CAAC,CAAC,CACP,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CAC/B,CAAC,CAAC,CAAC,CACF;gBACG,OAAO,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAG,CAAC,CAAC,CAAC,IAAI;gBACrC,oBAAC,SAAS,IACR,OAAO,EAAC,UAAU,EAClB,SAAS,QACT,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,EAAE,EACX,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,OAAO,CAAC,aAAa,EAChC,SAAS,QACT,KAAK,EACH,OAAO;wBACL,CAAC,CAAC,YAAY;wBACd,CAAC,CAAC,gBAAgB;4BAChB,CAAC,CAAC,wEAAwE;4BAC1E,CAAC,CAAC,QAAQ,EAEhB,SAAS,EAAE;wBACT,KAAK,EAAE;4BACL,QAAQ,EAAE,IAAI;4BACd,OAAO,EAAE;gCACP,KAAK,EAAE,OAAO,CAAC,aAAa;6BAC7B;yBACF;qBACF,GACD,CACD,CACJ,CACa;QAChB,oBAAC,aAAa;YACZ,oBAAC,MAAM,IAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YAElD,CACK,CACT,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,iBAAiB,CAAA"}
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- declare const InsertionSequenceDialog: ({ onClose, model, insertionData, }: {
3
- onClose: () => void;
4
- model: {
5
- showAsUpperCase: boolean;
6
- };
7
- insertionData: {
8
- sequence: string;
9
- sampleLabel: string;
10
- chr: string;
11
- pos: number;
12
- };
13
- }) => React.JSX.Element;
14
- export default InsertionSequenceDialog;
@@ -1,69 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Dialog } from '@jbrowse/core/ui';
3
- import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
4
- import { observer } from 'mobx-react';
5
- import { makeStyles } from 'tss-react/mui';
6
- const useStyles = makeStyles()({
7
- dialogContent: {
8
- width: '60em',
9
- },
10
- textAreaInput: {
11
- fontFamily: 'monospace',
12
- whiteSpace: 'pre',
13
- overflowX: 'auto',
14
- },
15
- });
16
- const InsertionSequenceDialog = observer(function ({ onClose, model, insertionData, }) {
17
- const { classes } = useStyles();
18
- const [copied, setCopied] = useState(false);
19
- const { sequence, sampleLabel, chr, pos } = insertionData;
20
- const { showAsUpperCase } = model;
21
- const displaySequence = showAsUpperCase
22
- ? sequence.toUpperCase()
23
- : sequence.toLowerCase();
24
- return (React.createElement(Dialog, { open: true, onClose: onClose, title: `Insertion Sequence (${sequence.length}bp)`, maxWidth: "lg" },
25
- React.createElement(DialogContent, null,
26
- React.createElement("div", { style: { marginBottom: 16 } },
27
- React.createElement("strong", null, "Sample:"),
28
- " ",
29
- sampleLabel,
30
- React.createElement("br", null),
31
- React.createElement("strong", null, "Position:"),
32
- " ",
33
- chr,
34
- ":",
35
- pos.toLocaleString('en-US'),
36
- React.createElement("br", null),
37
- React.createElement("strong", null, "Length:"),
38
- " ",
39
- sequence.length,
40
- "bp"),
41
- React.createElement(TextField, { variant: "outlined", multiline: true, minRows: 3, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: displaySequence, slotProps: {
42
- input: {
43
- readOnly: true,
44
- classes: {
45
- input: classes.textAreaInput,
46
- },
47
- },
48
- } })),
49
- React.createElement(DialogActions, null,
50
- React.createElement(Button, { variant: "contained", color: "primary", onClick: () => {
51
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
52
- ;
53
- (async () => {
54
- try {
55
- await navigator.clipboard.writeText(displaySequence);
56
- setCopied(true);
57
- setTimeout(() => {
58
- setCopied(false);
59
- }, 1000);
60
- }
61
- catch (e) {
62
- console.error(e);
63
- }
64
- })();
65
- } }, copied ? 'Copied!' : 'Copy to Clipboard'),
66
- React.createElement(Button, { color: "secondary", variant: "contained", onClick: onClose }, "Close"))));
67
- });
68
- export default InsertionSequenceDialog;
69
- //# sourceMappingURL=InsertionSequenceDialog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InsertionSequenceDialog.js","sourceRoot":"","sources":["../../../../src/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC7B,aAAa,EAAE;QACb,KAAK,EAAE,MAAM;KACd;IACD,aAAa,EAAE;QACb,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAA;AAEF,MAAM,uBAAuB,GAAG,QAAQ,CAAC,UAAU,EACjD,OAAO,EACP,KAAK,EACL,aAAa,GAYd;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3C,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,aAAa,CAAA;IACzD,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAA;IACjC,MAAM,eAAe,GAAG,eAAe;QACrC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE;Q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AAC,CAAC,CAAC,CAAA;wBAClB,CAAC;oBACH,CAAC,CAAC,EAAE,CAAA;gBACN,CAAC,IAEA,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAClC;YACT,oBAAC,MAAM,IAAC,KAAK,EAAC,WAAW,EAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,YAErD,CACK,CACT,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- export declare function max(arr: number[], init?: number): number;
@@ -1,8 +0,0 @@
1
- export function max(arr, init = Number.NEGATIVE_INFINITY) {
2
- let max = init;
3
- for (const entry of arr) {
4
- max = Math.max(entry, max);
5
- }
6
- return max;
7
- }
8
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/LinearMafDisplay/components/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,CAAC,GAAa,EAAE,IAAI,GAAG,MAAM,CAAC,iBAAiB;IAChE,IAAI,GAAG,GAAG,IAAI,CAAA;IACd,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { LinearMafDisplayModel } from '../LinearMafDisplay/stateModel';
2
- interface SelectionCoords {
3
- dragStartX: number;
4
- dragEndX: number;
5
- }
6
- /**
7
- * Fetch sequences for the given selection coordinates
8
- * @param model - The LinearMafDisplayModel
9
- * @param selectionCoords - The selection coordinates (dragStartX and dragEndX)
10
- * @param showAllLetters - Whether to show all letters or just the differences
11
- * @returns Promise that resolves to the FASTA sequence
12
- */
13
- export declare function fetchSequences({ model, selectionCoords, showAllLetters, }: {
14
- model: LinearMafDisplayModel;
15
- selectionCoords: SelectionCoords;
16
- showAllLetters: boolean;
17
- }): Promise<string>;
18
- export {};
@@ -1,39 +0,0 @@
1
- import { getContainingView, getSession } from '@jbrowse/core/util';
2
- import { getRpcSessionId } from '@jbrowse/core/util/tracks';
3
- /**
4
- * Fetch sequences for the given selection coordinates
5
- * @param model - The LinearMafDisplayModel
6
- * @param selectionCoords - The selection coordinates (dragStartX and dragEndX)
7
- * @param showAllLetters - Whether to show all letters or just the differences
8
- * @returns Promise that resolves to the FASTA sequence
9
- */
10
- export async function fetchSequences({ model, selectionCoords, showAllLetters, }) {
11
- const { samples, adapterConfig } = model;
12
- const { rpcManager } = getSession(model);
13
- const sessionId = getRpcSessionId(model);
14
- const view = getContainingView(model);
15
- const { refName, assemblyName } = view.displayedRegions[0];
16
- const { dragStartX, dragEndX } = selectionCoords;
17
- const [s, e] = [
18
- Math.min(dragStartX, dragEndX),
19
- Math.max(dragStartX, dragEndX),
20
- ];
21
- const fastaSequence = (await rpcManager.call(sessionId, 'MafGetSequences', {
22
- sessionId,
23
- adapterConfig,
24
- samples,
25
- showAllLetters,
26
- regions: [
27
- {
28
- refName,
29
- start: view.pxToBp(s).coord - 1,
30
- end: view.pxToBp(e).coord,
31
- assemblyName,
32
- },
33
- ],
34
- }));
35
- return fastaSequence
36
- .map((r, idx) => `>${samples[idx].label}\n${r}`)
37
- .join('\n');
38
- }
39
- //# sourceMappingURL=fetchSequences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchSequences.js","sourceRoot":"","sources":["../../src/util/fetchSequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAU3D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,KAAK,EACL,eAAe,EACf,cAAc,GAKf;IACC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;IACxC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACxC,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAA0B,CAAA;IAC9D,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAE,CAAA;IAC3D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAA;IAChD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QACb,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC;KAC/B,CAAA;IAED,MAAM,aAAa,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,EAAE;QACzE,SAAS;QACT,aAAa;QACb,OAAO;QACP,cAAc;QACd,OAAO,EAAE;YACP;gBACE,OAAO;gBACP,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;gBAC/B,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;gBACzB,YAAY;aACb;SACF;KACF,CAAC,CAAa,CAAA;IAEf,OAAO,aAAa;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,OAAQ,CAAC,GAAG,CAAE,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;SACjD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { LinearMafDisplayModel } from '../LinearMafDisplay/stateModel';
2
- interface SelectionCoords {
3
- dragStartX: number;
4
- dragEndX: number;
5
- }
6
- interface UseSequencesOptions {
7
- model: LinearMafDisplayModel;
8
- selectionCoords?: SelectionCoords;
9
- showAllLetters: boolean;
10
- }
11
- /**
12
- * React hook to fetch sequences for the given selection coordinates
13
- * @param options - The options for fetching sequences
14
- * @returns An object containing the sequence, loading state, and error
15
- */
16
- export declare function useSequences({ model, selectionCoords, showAllLetters, }: UseSequencesOptions): {
17
- sequence: string;
18
- loading: boolean;
19
- error: unknown;
20
- };
21
- export {};
@@ -1,64 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { getContainingView, getSession } from '@jbrowse/core/util';
3
- import { getRpcSessionId } from '@jbrowse/core/util/tracks';
4
- /**
5
- * React hook to fetch sequences for the given selection coordinates
6
- * @param options - The options for fetching sequences
7
- * @returns An object containing the sequence, loading state, and error
8
- */
9
- export function useSequences({ model, selectionCoords, showAllLetters, }) {
10
- const [sequence, setSequence] = useState('');
11
- const [loading, setLoading] = useState(true);
12
- const [error, setError] = useState();
13
- useEffect(() => {
14
- // If no selection coordinates, no need to fetch
15
- if (!selectionCoords) {
16
- return;
17
- }
18
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
19
- ;
20
- (async () => {
21
- try {
22
- setLoading(true);
23
- setError(undefined);
24
- const { samples, adapterConfig } = model;
25
- const { rpcManager } = getSession(model);
26
- const sessionId = getRpcSessionId(model);
27
- const view = getContainingView(model);
28
- const { refName, assemblyName } = view.displayedRegions[0];
29
- const { dragStartX, dragEndX } = selectionCoords;
30
- const [s, e] = [
31
- Math.min(dragStartX, dragEndX),
32
- Math.max(dragStartX, dragEndX),
33
- ];
34
- const fastaSequence = (await rpcManager.call(sessionId, 'MafGetSequences', {
35
- sessionId,
36
- adapterConfig,
37
- samples,
38
- showAllLetters,
39
- regions: [
40
- {
41
- refName,
42
- start: view.pxToBp(s).coord - 1,
43
- end: view.pxToBp(e).coord,
44
- assemblyName,
45
- },
46
- ],
47
- }));
48
- const formattedSequence = fastaSequence
49
- .map((r, idx) => `>${samples[idx].label}\n${r}`)
50
- .join('\n');
51
- setSequence(formattedSequence);
52
- }
53
- catch (e) {
54
- console.error(e);
55
- setError(e);
56
- }
57
- finally {
58
- setLoading(false);
59
- }
60
- })();
61
- }, [model, selectionCoords, showAllLetters]);
62
- return { sequence, loading, error };
63
- }
64
- //# sourceMappingURL=useSequences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSequences.js","sourceRoot":"","sources":["../../src/util/useSequences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAgB3D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,eAAe,EACf,cAAc,GACM;IACpB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAA;IACpD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAW,CAAA;IAE7C,SAAS,CAAC,GAAG,EAAE;QACb,gDAAgD;QAChD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAM;QACR,CAAC;QACD,mEAAmE;QACnE,CAAC;QAAA,CAAC,KAAK,IAAI,EAAE;YACX,IAAI,CAAC;gBACH,UAAU,CAAC,IAAI,CAAC,CAAA;gBAChB,QAAQ,CAAC,SAAS,CAAC,CAAA;gBAEnB,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;gBACxC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;gBACxC,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;gBACxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAA0B,CAAA;gB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,CAAA;IAE5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;AACrC,CAAC"}
@@ -1,175 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import { Dialog, ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui'
4
- import { getSession } from '@jbrowse/core/util'
5
- import {
6
- Button,
7
- DialogActions,
8
- DialogContent,
9
- TextField,
10
- ToggleButton,
11
- ToggleButtonGroup,
12
- } from '@mui/material'
13
- import { observer } from 'mobx-react'
14
- import { makeStyles } from 'tss-react/mui'
15
-
16
- import { useSequences } from '../../../util/useSequences'
17
-
18
- import type { LinearMafDisplayModel } from '../../stateModel'
19
-
20
- const useStyles = makeStyles()({
21
- dialogContent: {
22
- width: '80em',
23
- },
24
- textAreaInput: {
25
- fontFamily: 'monospace',
26
- whiteSpace: 'pre',
27
- overflowX: 'auto',
28
- },
29
- ml: {
30
- marginLeft: 10,
31
- },
32
- })
33
-
34
- const GetSequenceDialog = observer(function ({
35
- onClose,
36
- model,
37
- selectionCoords,
38
- }: {
39
- onClose: () => void
40
- model: LinearMafDisplayModel
41
- selectionCoords?: {
42
- dragStartX: number
43
- dragEndX: number
44
- }
45
- }) {
46
- const [showAllLetters, setShowAllLetters] = useState(true)
47
- const { classes } = useStyles()
48
- const { sequence, loading, error } = useSequences({
49
- model,
50
- selectionCoords,
51
- showAllLetters,
52
- })
53
- const sequenceTooLarge = sequence ? sequence.length > 1_000_000 : false
54
-
55
- return (
56
- <Dialog open onClose={onClose} title="Subsequence Data" maxWidth="xl">
57
- <DialogContent>
58
- <div
59
- style={{
60
- display: 'flex',
61
- alignItems: 'center',
62
- marginBottom: '16px',
63
- }}
64
- >
65
- <ToggleButtonGroup
66
- value={showAllLetters}
67
- exclusive
68
- size="small"
69
- onChange={(_event, newDisplayMode) => {
70
- if (newDisplayMode !== null) {
71
- setShowAllLetters(newDisplayMode)
72
- }
73
- }}
74
- >
75
- <ToggleButton value={true}>Show All Letters</ToggleButton>
76
- <ToggleButton value={false}>Show Only Differences</ToggleButton>
77
- </ToggleButtonGroup>
78
- <div style={{ flexGrow: 1 }} />
79
- <Button
80
- variant="contained"
81
- color="primary"
82
- disabled={loading || !sequence}
83
- onClick={() => {
84
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
85
- ;(async () => {
86
- try {
87
- await navigator.clipboard.writeText(sequence)
88
- getSession(model).notify(
89
- 'Sequence copied to clipboard',
90
- 'info',
91
- )
92
- } catch (e) {
93
- console.error(e)
94
- getSession(model).notifyError(`${e}`, e)
95
- }
96
- })()
97
- }}
98
- >
99
- Copy to Clipboard
100
- </Button>
101
- <Button
102
- variant="contained"
103
- color="secondary"
104
- disabled={loading || !sequence}
105
- onClick={() => {
106
- try {
107
- const url = URL.createObjectURL(
108
- new Blob([sequence], { type: 'text/plain' }),
109
- )
110
-
111
- // Create a temporary anchor element
112
- const a = document.createElement('a')
113
- a.href = url
114
- a.download = 'sequence.fasta'
115
-
116
- // Trigger the download
117
- document.body.append(a)
118
- a.click()
119
-
120
- // Clean up
121
- a.remove()
122
- URL.revokeObjectURL(url)
123
- getSession(model).notify('Sequence downloaded', 'info')
124
- } catch (e) {
125
- console.error(e)
126
- getSession(model).notifyError(`${e}`, e)
127
- }
128
- }}
129
- >
130
- Download
131
- </Button>
132
- </div>
133
-
134
- {error ? (
135
- <ErrorMessage error={error} />
136
- ) : (
137
- <>
138
- {loading ? <LoadingEllipses /> : null}
139
- <TextField
140
- variant="outlined"
141
- multiline
142
- minRows={5}
143
- maxRows={10}
144
- disabled={sequenceTooLarge}
145
- className={classes.dialogContent}
146
- fullWidth
147
- value={
148
- loading
149
- ? 'Loading...'
150
- : sequenceTooLarge
151
- ? 'Reference sequence too large to display, use the download FASTA button'
152
- : sequence
153
- }
154
- slotProps={{
155
- input: {
156
- readOnly: true,
157
- classes: {
158
- input: classes.textAreaInput,
159
- },
160
- },
161
- }}
162
- />
163
- </>
164
- )}
165
- </DialogContent>
166
- <DialogActions>
167
- <Button color="primary" variant="outlined" onClick={onClose}>
168
- Close
169
- </Button>
170
- </DialogActions>
171
- </Dialog>
172
- )
173
- })
174
-
175
- export default GetSequenceDialog