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.
- package/dist/BigMafAdapter/BigMafAdapter.js +4 -5
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -1
- package/dist/BigMafAdapter/configSchema.d.ts +2 -2
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js +38 -108
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js.map +1 -1
- package/dist/LinearMafDisplay/components/MAFTooltip.d.ts +0 -3
- package/dist/LinearMafDisplay/components/MAFTooltip.js.map +1 -1
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.d.ts +9 -0
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js +34 -0
- package/dist/LinearMafDisplay/components/MsaHighlightOverlay.js.map +1 -0
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js.map +1 -1
- package/dist/LinearMafDisplay/components/useDragSelection.d.ts +25 -0
- package/dist/LinearMafDisplay/components/useDragSelection.js +103 -0
- package/dist/LinearMafDisplay/components/useDragSelection.js.map +1 -0
- package/dist/LinearMafDisplay/configSchema.d.ts +3 -30
- package/dist/LinearMafDisplay/stateModel.d.ts +1043 -121
- package/dist/LinearMafDisplay/stateModel.js +85 -41
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- package/dist/LinearMafDisplay/types.d.ts +2 -2
- package/dist/LinearMafDisplay/util.d.ts +5 -0
- package/dist/LinearMafDisplay/util.js +25 -4
- package/dist/LinearMafDisplay/util.js.map +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +41 -5
- package/dist/LinearMafRenderer/LinearMafRenderer.js +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
- package/dist/LinearMafRenderer/components/LinearMafRendering.d.ts +14 -5
- package/dist/LinearMafRenderer/components/LinearMafRendering.js +21 -19
- package/dist/LinearMafRenderer/components/LinearMafRendering.js.map +1 -1
- package/dist/LinearMafRenderer/configSchema.d.ts +1 -6
- package/dist/LinearMafRenderer/configSchema.js +1 -6
- package/dist/LinearMafRenderer/configSchema.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/insertions.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/insertions.js +2 -2
- package/dist/LinearMafRenderer/rendering/mismatches.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/mismatches.js +3 -3
- package/dist/LinearMafRenderer/rendering/types.d.ts +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +1 -1
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -1
- package/dist/MafAddTrackWorkflow/index.js +1 -1
- package/dist/MafAddTrackWorkflow/index.js.map +1 -1
- package/dist/MafGetSequences/MafGetSequences.d.ts +1 -0
- package/dist/MafGetSequences/MafGetSequences.js +2 -1
- package/dist/MafGetSequences/MafGetSequences.js.map +1 -1
- package/dist/MafSequenceWidget/LabelsCanvas.d.ts +8 -0
- package/dist/MafSequenceWidget/LabelsCanvas.js +37 -0
- package/dist/MafSequenceWidget/LabelsCanvas.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.d.ts +6 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js +52 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlight.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.d.ts +2 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js +12 -0
- package/dist/MafSequenceWidget/MafSequenceHoverHighlightExtension.js.map +1 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.d.ts +6 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.js +189 -0
- package/dist/MafSequenceWidget/MafSequenceWidget.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceCanvas.d.ts +12 -0
- package/dist/MafSequenceWidget/SequenceCanvas.js +86 -0
- package/dist/MafSequenceWidget/SequenceCanvas.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceDisplay.d.ts +12 -0
- package/dist/MafSequenceWidget/SequenceDisplay.js +117 -0
- package/dist/MafSequenceWidget/SequenceDisplay.js.map +1 -0
- package/dist/MafSequenceWidget/SequenceTooltip.d.ts +11 -0
- package/dist/MafSequenceWidget/SequenceTooltip.js +39 -0
- package/dist/MafSequenceWidget/SequenceTooltip.js.map +1 -0
- package/dist/MafSequenceWidget/baseColors.d.ts +3 -0
- package/dist/MafSequenceWidget/baseColors.js +64 -0
- package/dist/MafSequenceWidget/baseColors.js.map +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.d.ts +13 -0
- package/dist/MafSequenceWidget/colToGenomePos.js +32 -0
- package/dist/MafSequenceWidget/colToGenomePos.js.map +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.d.ts +1 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.js +136 -0
- package/dist/MafSequenceWidget/colToGenomePos.test.js.map +1 -0
- package/dist/MafSequenceWidget/configSchema.d.ts +1 -0
- package/dist/MafSequenceWidget/configSchema.js +3 -0
- package/dist/MafSequenceWidget/configSchema.js.map +1 -0
- package/dist/MafSequenceWidget/constants.d.ts +4 -0
- package/dist/MafSequenceWidget/constants.js +5 -0
- package/dist/MafSequenceWidget/constants.js.map +1 -0
- package/dist/MafSequenceWidget/index.d.ts +2 -0
- package/dist/MafSequenceWidget/index.js +16 -0
- package/dist/MafSequenceWidget/index.js.map +1 -0
- package/dist/MafSequenceWidget/stateModelFactory.d.ts +67 -0
- package/dist/MafSequenceWidget/stateModelFactory.js +21 -0
- package/dist/MafSequenceWidget/stateModelFactory.js.map +1 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +4 -35
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -1
- package/dist/MafTabixAdapter/configSchema.d.ts +4 -4
- package/dist/MafTrack/configSchema.d.ts +16 -11
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +12 -24
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
- package/dist/util/clipboard.d.ts +2 -0
- package/dist/util/clipboard.js +28 -0
- package/dist/util/clipboard.js.map +1 -0
- package/dist/util/fastaUtils.d.ts +2 -1
- package/dist/util/fastaUtils.js +72 -2
- package/dist/util/fastaUtils.js.map +1 -1
- package/dist/util/fastaUtils.test.js +190 -0
- package/dist/util/fastaUtils.test.js.map +1 -1
- package/dist/util/parseAssemblyName.d.ts +32 -0
- package/dist/util/parseAssemblyName.js +87 -0
- package/dist/util/parseAssemblyName.js.map +1 -0
- package/dist/util/parseAssemblyName.test.d.ts +1 -0
- package/dist/util/parseAssemblyName.test.js +269 -0
- package/dist/util/parseAssemblyName.test.js.map +1 -0
- package/package.json +7 -7
- package/src/BigMafAdapter/BigMafAdapter.ts +5 -5
- package/src/LinearMafDisplay/components/LinearMafDisplayComponent.tsx +62 -144
- package/src/LinearMafDisplay/components/MAFTooltip.tsx +0 -3
- package/src/LinearMafDisplay/components/MsaHighlightOverlay.tsx +62 -0
- package/src/LinearMafDisplay/components/Sidebar/SvgWrapper.tsx +1 -1
- package/src/LinearMafDisplay/components/useDragSelection.ts +159 -0
- package/src/LinearMafDisplay/stateModel.ts +135 -48
- package/src/LinearMafDisplay/types.ts +2 -2
- package/src/LinearMafDisplay/util.ts +31 -5
- package/src/LinearMafRenderer/LinearMafRenderer.ts +1 -1
- package/src/LinearMafRenderer/components/LinearMafRendering.tsx +38 -24
- package/src/LinearMafRenderer/configSchema.ts +1 -6
- package/src/LinearMafRenderer/rendering/insertions.ts +2 -2
- package/src/LinearMafRenderer/rendering/mismatches.ts +3 -3
- package/src/LinearMafRenderer/rendering/types.ts +1 -1
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +1 -1
- package/src/MafAddTrackWorkflow/index.ts +1 -1
- package/src/MafGetSequences/MafGetSequences.ts +10 -2
- package/src/MafSequenceWidget/LabelsCanvas.tsx +58 -0
- package/src/MafSequenceWidget/MafSequenceHoverHighlight.tsx +83 -0
- package/src/MafSequenceWidget/MafSequenceHoverHighlightExtension.tsx +24 -0
- package/src/MafSequenceWidget/MafSequenceWidget.tsx +294 -0
- package/src/MafSequenceWidget/SequenceCanvas.tsx +136 -0
- package/src/MafSequenceWidget/SequenceDisplay.tsx +188 -0
- package/src/MafSequenceWidget/SequenceTooltip.tsx +70 -0
- package/src/MafSequenceWidget/baseColors.ts +76 -0
- package/src/MafSequenceWidget/colToGenomePos.test.ts +166 -0
- package/src/MafSequenceWidget/colToGenomePos.ts +40 -0
- package/src/MafSequenceWidget/configSchema.ts +3 -0
- package/src/MafSequenceWidget/constants.ts +4 -0
- package/src/MafSequenceWidget/index.ts +24 -0
- package/src/MafSequenceWidget/stateModelFactory.ts +43 -0
- package/src/MafTabixAdapter/MafTabixAdapter.ts +12 -51
- package/src/index.ts +2 -0
- package/src/util/__snapshots__/fastaUtils.test.ts.snap +35 -0
- package/src/util/clipboard.ts +35 -0
- package/src/util/fastaUtils.test.ts +199 -0
- package/src/util/fastaUtils.ts +94 -1
- package/src/util/parseAssemblyName.test.ts +350 -0
- package/src/util/parseAssemblyName.ts +106 -0
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.d.ts +0 -11
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js +0 -97
- package/dist/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.js.map +0 -1
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.d.ts +0 -14
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js +0 -69
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js.map +0 -1
- package/dist/LinearMafDisplay/components/util.d.ts +0 -1
- package/dist/LinearMafDisplay/components/util.js +0 -8
- package/dist/LinearMafDisplay/components/util.js.map +0 -1
- package/dist/util/fetchSequences.d.ts +0 -18
- package/dist/util/fetchSequences.js +0 -39
- package/dist/util/fetchSequences.js.map +0 -1
- package/dist/util/useSequences.d.ts +0 -21
- package/dist/util/useSequences.js +0 -64
- package/dist/util/useSequences.js.map +0 -1
- package/src/LinearMafDisplay/components/GetSequenceDialog/GetSequenceDialog.tsx +0 -175
- package/src/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.tsx +0 -105
- package/src/LinearMafDisplay/components/util.ts +0 -7
- package/src/util/fetchSequences.ts +0 -57
- 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,EAC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AAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,OAAO,CAAC,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"}
|
package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.d.ts
DELETED
|
@@ -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
|
package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InsertionSequenceDialog.js","sourceRoot":"","sources":["../../../../src/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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0 @@
|
|
|
1
|
-
export declare function max(arr: number[], init?: number): number;
|
|
@@ -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,eAA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ectionCoords {
|
|
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;AAgB3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,SAAS;oBACT,aAAa;oBACb,OAAO;oBACP,cAAc;oBACd,OAAO,EAAE;wBACP;4BACE,OAAO;4BACP,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;4BAC/B,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;4BACzB,YAAY;yBACb;qBACF;iBACF,CACF,CAAa,CAAA;gBAEd,MAAM,iBAAiB,GAAG,aAAa;qBACpC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,OAAQ,CAAC,GAAG,CAAE,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;qBACjD,IAAI,CAAC,IAAI,CAAC,CAAA;gBAEb,WAAW,CAAC,iBAAiB,CAAC,CAAA;YAChC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAChB,QAAQ,CAAC,CAAC,CAAC,CAAA;YACb,CAAC;oBAAS,CAAC;gBACT,UAAU,CAAC,KAAK,CAAC,CAAA;YACnB,CAAC;QACH,CAAC,CAAC,EAAE,CAAA;IACN,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC,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
|