jbrowse-plugin-msaview 2.3.5 → 2.4.0

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 (148) hide show
  1. package/README.md +15 -216
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +4 -15
  3. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  4. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +5 -8
  5. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -1
  6. package/dist/AddHighlightModel/util.d.ts +3 -0
  7. package/dist/AddHighlightModel/util.js +3 -0
  8. package/dist/AddHighlightModel/util.js.map +1 -1
  9. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +3 -8
  10. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  11. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +26 -14
  12. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  13. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +16 -7
  14. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
  15. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +6 -7
  16. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  17. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +4 -4
  18. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -1
  19. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +8 -1
  20. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -1
  21. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +15 -7
  22. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
  23. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +8 -1
  24. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +1 -1
  25. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.d.ts +4 -4
  26. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js +2 -2
  27. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -1
  28. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +4 -0
  29. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +2 -0
  30. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -1
  31. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +3 -0
  32. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js.map +1 -1
  33. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +17 -23
  34. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  35. package/dist/LaunchMsaView/components/PreLoadedMSA/types.d.ts +1 -0
  36. package/dist/LaunchMsaView/components/PreLoadedMSA/types.js +4 -1
  37. package/dist/LaunchMsaView/components/PreLoadedMSA/types.js.map +1 -1
  38. package/dist/LaunchMsaView/components/TabPanel.js +1 -1
  39. package/dist/LaunchMsaView/components/TabPanel.js.map +1 -1
  40. package/dist/LaunchMsaView/components/TranscriptSelector.js +7 -3
  41. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
  42. package/dist/LaunchMsaView/components/types.d.ts +0 -3
  43. package/dist/LaunchMsaView/components/useFeatureSequence.d.ts +4 -4
  44. package/dist/LaunchMsaView/components/useFeatureSequence.js +2 -4
  45. package/dist/LaunchMsaView/components/useFeatureSequence.js.map +1 -1
  46. package/dist/LaunchMsaView/components/useSWRFeatureSequence.d.ts +4 -5
  47. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js +11 -30
  48. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js.map +1 -1
  49. package/dist/MsaViewPanel/afterCreateAutoruns.js +10 -25
  50. package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -1
  51. package/dist/MsaViewPanel/components/ConnectStructureDialog.js +15 -10
  52. package/dist/MsaViewPanel/components/ConnectStructureDialog.js.map +1 -1
  53. package/dist/MsaViewPanel/components/LoadingBLAST.js +2 -3
  54. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  55. package/dist/MsaViewPanel/components/MsaViewPanel.js +8 -1
  56. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  57. package/dist/MsaViewPanel/model.d.ts +6 -13
  58. package/dist/MsaViewPanel/model.js +15 -26
  59. package/dist/MsaViewPanel/model.js.map +1 -1
  60. package/dist/MsaViewPanel/msaDataStore.d.ts +0 -1
  61. package/dist/MsaViewPanel/msaDataStore.js +0 -9
  62. package/dist/MsaViewPanel/msaDataStore.js.map +1 -1
  63. package/dist/MsaViewPanel/pairwiseAlignment.js +6 -6
  64. package/dist/MsaViewPanel/pairwiseAlignment.js.map +1 -1
  65. package/dist/MsaViewPanel/structureConnection.d.ts +28 -4
  66. package/dist/MsaViewPanel/structureConnection.js +10 -6
  67. package/dist/MsaViewPanel/structureConnection.js.map +1 -1
  68. package/dist/MsaViewPanel/structureConnection.test.js +1 -19
  69. package/dist/MsaViewPanel/structureConnection.test.js.map +1 -1
  70. package/dist/jbrowse-plugin-msaview.umd.production.min.js +25 -27
  71. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  72. package/dist/utils/blastCache.d.ts +7 -13
  73. package/dist/utils/blastCache.js +0 -12
  74. package/dist/utils/blastCache.js.map +1 -1
  75. package/dist/utils/msa.d.ts +2 -1
  76. package/dist/utils/msa.js +0 -3
  77. package/dist/utils/msa.js.map +1 -1
  78. package/dist/utils/ncbiBlast.d.ts +3 -2
  79. package/dist/utils/ncbiBlast.js +1 -1
  80. package/dist/utils/ncbiBlast.js.map +1 -1
  81. package/dist/utils/taxonomyNames.js +9 -4
  82. package/dist/utils/taxonomyNames.js.map +1 -1
  83. package/dist/version.d.ts +1 -1
  84. package/dist/version.js +1 -1
  85. package/package.json +19 -19
  86. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +7 -22
  87. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +10 -10
  88. package/src/AddHighlightModel/util.ts +6 -0
  89. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +3 -16
  90. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +30 -19
  91. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +17 -9
  92. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +14 -18
  93. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +4 -10
  94. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +9 -1
  95. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +15 -8
  96. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.tsx +9 -1
  97. package/src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts +6 -6
  98. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +7 -0
  99. package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +3 -0
  100. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +23 -29
  101. package/src/LaunchMsaView/components/PreLoadedMSA/types.ts +6 -0
  102. package/src/LaunchMsaView/components/TabPanel.tsx +1 -1
  103. package/src/LaunchMsaView/components/TranscriptSelector.tsx +7 -3
  104. package/src/LaunchMsaView/components/types.ts +0 -3
  105. package/src/LaunchMsaView/components/useFeatureSequence.ts +1 -7
  106. package/src/LaunchMsaView/components/useSWRFeatureSequence.ts +10 -37
  107. package/src/MsaViewPanel/afterCreateAutoruns.ts +13 -39
  108. package/src/MsaViewPanel/components/ConnectStructureDialog.tsx +23 -25
  109. package/src/MsaViewPanel/components/LoadingBLAST.tsx +4 -3
  110. package/src/MsaViewPanel/components/MsaViewPanel.tsx +9 -1
  111. package/src/MsaViewPanel/model.ts +31 -39
  112. package/src/MsaViewPanel/msaDataStore.ts +0 -9
  113. package/src/MsaViewPanel/pairwiseAlignment.ts +6 -6
  114. package/src/MsaViewPanel/structureConnection.test.ts +0 -21
  115. package/src/MsaViewPanel/structureConnection.ts +30 -7
  116. package/src/utils/blastCache.ts +14 -37
  117. package/src/utils/msa.ts +5 -6
  118. package/src/utils/ncbiBlast.ts +9 -5
  119. package/src/utils/taxonomyNames.ts +13 -4
  120. package/src/version.ts +1 -1
  121. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.d.ts +0 -8
  122. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +0 -70
  123. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +0 -1
  124. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.d.ts +0 -13
  125. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js +0 -12
  126. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js.map +0 -1
  127. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.d.ts +0 -6
  128. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js +0 -25
  129. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +0 -1
  130. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.d.ts +0 -2
  131. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js +0 -20
  132. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js.map +0 -1
  133. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.d.ts +0 -24
  134. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js +0 -2
  135. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js.map +0 -1
  136. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.d.ts +0 -10
  137. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js +0 -11
  138. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js.map +0 -1
  139. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.d.ts +0 -1
  140. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js +0 -2
  141. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js.map +0 -1
  142. package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +0 -123
  143. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.ts +0 -30
  144. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +0 -47
  145. package/src/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.ts +0 -22
  146. package/src/LaunchMsaView/components/EnsemblGeneTree/types.ts +0 -28
  147. package/src/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.ts +0 -17
  148. package/src/LaunchMsaView/components/EnsemblGeneTree/util.ts +0 -6
@@ -18,7 +18,7 @@ import { makeStyles } from 'tss-react/mui'
18
18
 
19
19
  import CachedBlastResults from './CachedBlastResults'
20
20
  import { blastLaunchView } from './blastLaunchView'
21
- import { msaAlgorithms } from './consts'
21
+ import { blastDatabaseOptions, blastPrograms, msaAlgorithms } from './consts'
22
22
  import { useCachedBlastResults } from './useCachedBlastResults'
23
23
  import TextField2 from '../../../components/TextField2'
24
24
  import {
@@ -29,7 +29,7 @@ import {
29
29
  import TranscriptSelector from '../TranscriptSelector'
30
30
  import { useTranscriptSelection } from '../useTranscriptSelection'
31
31
 
32
- import type { MsaAlgorithm } from './consts'
32
+ import type { BlastDatabase, BlastProgram, MsaAlgorithm } from './consts'
33
33
  import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
34
34
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
35
35
 
@@ -55,12 +55,6 @@ const useStyles = makeStyles()({
55
55
  },
56
56
  })
57
57
 
58
- const blastDatabaseOptions = ['nr', 'nr_cluster_seq'] as const
59
- const blastPrograms = ['blastp', 'quick-blastp'] as const
60
-
61
- type blastDatabaseOptionsT = (typeof blastDatabaseOptions)[number]
62
- type blastProgramsT = (typeof blastPrograms)[number]
63
-
64
58
  const NCBIBlastAutomaticPanel = observer(function ({
65
59
  handleClose,
66
60
  feature,
@@ -78,11 +72,11 @@ const NCBIBlastAutomaticPanel = observer(function ({
78
72
  const view = getContainingView(model) as LinearGenomeViewModel
79
73
  const [launchViewError, setLaunchViewError] = useState<unknown>()
80
74
  const [selectedBlastDatabase, setSelectedBlastDatabase] =
81
- useState<blastDatabaseOptionsT>('nr')
75
+ useState<BlastDatabase>('nr')
82
76
  const [selectedMsaAlgorithm, setSelectedMsaAlgorithm] =
83
77
  useState<MsaAlgorithm>('clustalo')
84
78
  const [selectedBlastProgram, setSelectedBlastProgram] =
85
- useState<blastProgramsT>('quick-blastp')
79
+ useState<BlastProgram>('quick-blastp')
86
80
 
87
81
  const geneIds = useMemo(() => getGeneIdentifiers(feature), [feature])
88
82
  const { results: cachedResults, error: cachedResultsError } =
@@ -109,8 +103,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
109
103
  select
110
104
  value={selectedBlastDatabase}
111
105
  onChange={event => {
112
- const newDb = event.target
113
- .value as (typeof blastDatabaseOptions)[number]
106
+ const newDb = event.target.value as BlastDatabase
114
107
  setSelectedBlastDatabase(newDb)
115
108
  if (newDb === 'nr_cluster_seq') {
116
109
  setSelectedBlastProgram('blastp')
@@ -150,9 +143,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
150
143
  select
151
144
  value={selectedBlastProgram}
152
145
  onChange={event => {
153
- setSelectedBlastProgram(
154
- event.target.value as (typeof blastPrograms)[number],
155
- )
146
+ setSelectedBlastProgram(event.target.value as BlastProgram)
156
147
  }}
157
148
  >
158
149
  {blastPrograms.map(val => (
@@ -229,18 +220,23 @@ const NCBIBlastAutomaticPanel = observer(function ({
229
220
  proteinSequence,
230
221
  },
231
222
  })
223
+ handleClose()
232
224
  } catch (e) {
233
225
  console.error(e)
234
226
  setLaunchViewError(e)
235
227
  }
236
-
237
- handleClose()
238
228
  }}
239
229
  disabled={!proteinSequence}
240
230
  >
241
231
  Submit
242
232
  </Button>
243
- <Button color="secondary" variant="contained" onClick={handleClose}>
233
+ <Button
234
+ color="secondary"
235
+ variant="contained"
236
+ onClick={() => {
237
+ handleClose()
238
+ }}
239
+ >
244
240
  Cancel
245
241
  </Button>
246
242
  </DialogActions>
@@ -26,6 +26,9 @@ const useStyles = makeStyles()({
26
26
  margin: 30,
27
27
  maxWidth: 600,
28
28
  },
29
+ infoText: {
30
+ marginTop: 20,
31
+ },
29
32
  })
30
33
 
31
34
  const NCBIBlastManualPanel = observer(function ({
@@ -77,7 +80,7 @@ const NCBIBlastManualPanel = observer(function ({
77
80
  </div>
78
81
  ) : null}
79
82
 
80
- <Typography style={{ marginTop: 20 }}>
83
+ <Typography className={classes.infoText}>
81
84
  Click the link above and run your BLAST query, and once you have
82
85
  results, click "Multiple Alignment" at the top of the results page to
83
86
  be redirected to COBALT, NCBI's multiple sequence aligner. Once COBALT
@@ -93,15 +96,6 @@ const NCBIBlastManualPanel = observer(function ({
93
96
  onClick={() => {
94
97
  handleClose()
95
98
  }}
96
- >
97
- Submit
98
- </Button>
99
- <Button
100
- color="secondary"
101
- variant="contained"
102
- onClick={() => {
103
- handleClose()
104
- }}
105
99
  >
106
100
  Close
107
101
  </Button>
@@ -3,6 +3,7 @@ import React, { useState } from 'react'
3
3
  import { useLocalStorage } from '@jbrowse/core/util'
4
4
  import SettingsIcon from '@mui/icons-material/Settings'
5
5
  import { IconButton } from '@mui/material'
6
+ import { makeStyles } from 'tss-react/mui'
6
7
 
7
8
  import NCBIBlastAutomaticPanel from './NCBIBlastAutomaticPanel'
8
9
  import NCBIBlastManualPanel from './NCBIBlastManualPanel'
@@ -13,6 +14,12 @@ import { BASE_BLAST_URL } from './consts'
13
14
 
14
15
  import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
15
16
 
17
+ const useStyles = makeStyles()({
18
+ settingsButton: {
19
+ float: 'right',
20
+ },
21
+ })
22
+
16
23
  const panelMap = {
17
24
  automatic: NCBIBlastAutomaticPanel,
18
25
  rid: NCBIBlastRIDPanel,
@@ -34,13 +41,14 @@ export default function NCBIBlastPanel({
34
41
  BASE_BLAST_URL,
35
42
  )
36
43
  const [settingsOpen, setSettingsOpen] = useState(false)
44
+ const { classes } = useStyles()
37
45
 
38
46
  const Panel = panelMap[lookupMethod as keyof typeof panelMap]
39
47
 
40
48
  return (
41
49
  <>
42
50
  <IconButton
43
- style={{ float: 'right' }}
51
+ className={classes.settingsButton}
44
52
  size="small"
45
53
  onClick={() => {
46
54
  setSettingsOpen(true)
@@ -28,6 +28,15 @@ const useStyles = makeStyles()({
28
28
  dialogContent: {
29
29
  width: '80em',
30
30
  },
31
+ marginBottom: {
32
+ marginBottom: 16,
33
+ },
34
+ ridField: {
35
+ width: 150,
36
+ },
37
+ infoText: {
38
+ marginTop: 20,
39
+ },
31
40
  })
32
41
 
33
42
  const NCBIBlastRIDPanel = observer(function ({
@@ -60,7 +69,6 @@ const NCBIBlastRIDPanel = observer(function ({
60
69
  } = useTranscriptSelection({ feature, view })
61
70
 
62
71
  const e = proteinSequenceError ?? launchViewError
63
- const style = { width: 150 }
64
72
  const trimmedRid = rid.trim()
65
73
 
66
74
  return (
@@ -69,7 +77,7 @@ const NCBIBlastRIDPanel = observer(function ({
69
77
  {children}
70
78
  {e ? <ErrorMessage error={e} /> : null}
71
79
 
72
- <Typography variant="body2" style={{ marginBottom: 16 }}>
80
+ <Typography variant="body2" className={classes.marginBottom}>
73
81
  Enter the RID (Request ID) from a previously submitted NCBI BLAST
74
82
  query. You can find the RID in the BLAST results page URL or at the
75
83
  top of the results page. RIDs are typically valid for 24-36 hours
@@ -81,7 +89,7 @@ const NCBIBlastRIDPanel = observer(function ({
81
89
  label="BLAST RID"
82
90
  placeholder="e.g., ABC12345"
83
91
  fullWidth
84
- style={{ marginBottom: 16 }}
92
+ className={classes.marginBottom}
85
93
  value={rid}
86
94
  onChange={event => {
87
95
  setRid(event.target.value)
@@ -89,7 +97,7 @@ const NCBIBlastRIDPanel = observer(function ({
89
97
  />
90
98
 
91
99
  {trimmedRid ? (
92
- <Typography variant="body2" style={{ marginBottom: 16 }}>
100
+ <Typography variant="body2" className={classes.marginBottom}>
93
101
  <ExternalLink href={`${baseUrl}?CMD=Get&RID=${trimmedRid}`}>
94
102
  View BLAST results on NCBI
95
103
  </ExternalLink>
@@ -99,7 +107,7 @@ const NCBIBlastRIDPanel = observer(function ({
99
107
  <TextField2
100
108
  variant="outlined"
101
109
  label="MSA Algorithm"
102
- style={style}
110
+ className={classes.ridField}
103
111
  select
104
112
  value={selectedMsaAlgorithm}
105
113
  onChange={event => {
@@ -122,7 +130,7 @@ const NCBIBlastRIDPanel = observer(function ({
122
130
  proteinSequence={proteinSequence}
123
131
  />
124
132
 
125
- <Typography style={{ marginTop: 20 }}>
133
+ <Typography className={classes.infoText}>
126
134
  This will fetch the BLAST results for the provided RID and run them
127
135
  through a multiple sequence alignment. The protein sequence from the
128
136
  selected transcript will be added as the query sequence in the MSA.
@@ -152,12 +160,11 @@ const NCBIBlastRIDPanel = observer(function ({
152
160
  rid: trimmedRid,
153
161
  },
154
162
  })
163
+ handleClose()
155
164
  } catch (e) {
156
165
  console.error(e)
157
166
  setLaunchViewError(e)
158
167
  }
159
-
160
- handleClose()
161
168
  }}
162
169
  disabled={!proteinSequence || !trimmedRid}
163
170
  >
@@ -7,10 +7,17 @@ import {
7
7
  DialogContent,
8
8
  DialogTitle,
9
9
  } from '@mui/material'
10
+ import { makeStyles } from 'tss-react/mui'
10
11
 
11
12
  import { BASE_BLAST_URL } from './consts'
12
13
  import TextField2 from '../../../components/TextField2'
13
14
 
15
+ const useStyles = makeStyles()({
16
+ urlField: {
17
+ minWidth: 300,
18
+ },
19
+ })
20
+
14
21
  export default function NCBISettingsDialog({
15
22
  handleClose,
16
23
  baseUrl,
@@ -18,6 +25,7 @@ export default function NCBISettingsDialog({
18
25
  handleClose: (arg?: string) => void
19
26
  baseUrl: string
20
27
  }) {
28
+ const { classes } = useStyles()
21
29
  const [tempBaseUrl, setTempBaseUrl] = useState(baseUrl)
22
30
  return (
23
31
  <Dialog
@@ -36,7 +44,7 @@ export default function NCBISettingsDialog({
36
44
  fullWidth
37
45
  variant="outlined"
38
46
  value={tempBaseUrl}
39
- style={{ minWidth: '300px' }}
47
+ className={classes.urlField}
40
48
  onChange={e => {
41
49
  setTempBaseUrl(e.target.value)
42
50
  }}
@@ -1,6 +1,6 @@
1
1
  import { getSession } from '@jbrowse/core/util'
2
2
 
3
- import type { JBrowsePluginMsaViewModel } from '../../../MsaViewPanel/model'
3
+ import type { BlastParams } from '../../../MsaViewPanel/model'
4
4
  import type { CachedBlastResult } from '../../../utils/blastCache'
5
5
  import type { Feature } from '@jbrowse/core/util'
6
6
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
@@ -14,9 +14,9 @@ export function blastLaunchView({
14
14
  newViewTitle: string
15
15
  view: LinearGenomeViewModel
16
16
  feature: Feature
17
- blastParams: Record<string, unknown>
17
+ blastParams: BlastParams
18
18
  }) {
19
- return getSession(view).addView('MsaView', {
19
+ getSession(view).addView('MsaView', {
20
20
  type: 'MsaView',
21
21
  displayName: newViewTitle,
22
22
  connectedViewId: view.id,
@@ -25,7 +25,7 @@ export function blastLaunchView({
25
25
  colWidth: 10,
26
26
  rowHeight: 12,
27
27
  blastParams,
28
- }) as JBrowsePluginMsaViewModel
28
+ })
29
29
  }
30
30
 
31
31
  export function blastLaunchViewFromCache({
@@ -37,7 +37,7 @@ export function blastLaunchViewFromCache({
37
37
  view: LinearGenomeViewModel
38
38
  cached: CachedBlastResult
39
39
  }) {
40
- return getSession(view).addView('MsaView', {
40
+ getSession(view).addView('MsaView', {
41
41
  type: 'MsaView',
42
42
  displayName: newViewTitle,
43
43
  connectedViewId: view.id,
@@ -49,5 +49,5 @@ export function blastLaunchViewFromCache({
49
49
  tree: cached.tree,
50
50
  treeMetadata: cached.treeMetadata,
51
51
  },
52
- }) as JBrowsePluginMsaViewModel
52
+ })
53
53
  }
@@ -1,3 +1,10 @@
1
1
  export const BASE_BLAST_URL = 'https://blast.ncbi.nlm.nih.gov/Blast.cgi'
2
+
2
3
  export const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft'] as const
3
4
  export type MsaAlgorithm = (typeof msaAlgorithms)[number]
5
+
6
+ export const blastDatabaseOptions = ['nr', 'nr_cluster_seq'] as const
7
+ export type BlastDatabase = (typeof blastDatabaseOptions)[number]
8
+
9
+ export const blastPrograms = ['blastp', 'quick-blastp'] as const
10
+ export type BlastProgram = (typeof blastPrograms)[number]
@@ -10,6 +10,9 @@ const swrConfig = {
10
10
  revalidateOnFocus: false,
11
11
  revalidateOnReconnect: false,
12
12
  revalidateIfStale: false,
13
+ refreshWhenHidden: false,
14
+ refreshWhenOffline: false,
15
+ shouldRetryOnError: false,
13
16
  }
14
17
 
15
18
  export function useCachedBlastResults(geneIds: string[]) {
@@ -1,6 +1,5 @@
1
1
  import React, { useState } from 'react'
2
2
 
3
- import { readConfObject } from '@jbrowse/core/configuration'
4
3
  import { ErrorMessage, LoadingEllipses, SanitizedHTML } from '@jbrowse/core/ui'
5
4
  import { getContainingView, getEnv, getSession } from '@jbrowse/core/util'
6
5
  import { Button, DialogActions, DialogContent, MenuItem } from '@mui/material'
@@ -15,8 +14,8 @@ import { useTranscriptSelection } from '../useTranscriptSelection'
15
14
  import { swrFlags } from './consts'
16
15
  import { fetchMSA, fetchMSAList } from './fetchMSAData'
17
16
  import { preCalculatedLaunchView } from './preCalculatedLaunchView'
17
+ import { readMsaDatasets } from './types'
18
18
 
19
- import type { Dataset } from './types'
20
19
  import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
21
20
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
22
21
 
@@ -24,6 +23,9 @@ const useStyles = makeStyles()({
24
23
  dialogContent: {
25
24
  width: '80em',
26
25
  },
26
+ selectedContainer: {
27
+ marginTop: 50,
28
+ },
27
29
  })
28
30
 
29
31
  const PreLoadedMSA = observer(function ({
@@ -42,10 +44,7 @@ const PreLoadedMSA = observer(function ({
42
44
  const { assemblyNames } = view
43
45
  const [viewError, setViewError] = useState<unknown>()
44
46
 
45
- const { jbrowse } = session
46
- const datasets = readConfObject(jbrowse, ['msa', 'datasets']) as
47
- | Dataset[]
48
- | undefined
47
+ const datasets = readMsaDatasets(session.jbrowse)
49
48
  const [selectedDatasetId, setSelectedDatasetId] = useState(
50
49
  datasets?.[0]?.datasetId,
51
50
  )
@@ -55,14 +54,8 @@ const PreLoadedMSA = observer(function ({
55
54
  isLoading: msaListLoading,
56
55
  error: msaListFetchError,
57
56
  } = useSWR(
58
- selectedDatasetId ? `${selectedDatasetId}-msa-list` : 'none-msa-list',
59
- () =>
60
- selectedDataset
61
- ? fetchMSAList({
62
- config: selectedDataset.adapter,
63
- pluginManager,
64
- })
65
- : undefined,
57
+ selectedDataset ? `${selectedDataset.datasetId}-msa-list` : null,
58
+ () => fetchMSAList({ config: selectedDataset!.adapter, pluginManager }),
66
59
  swrFlags,
67
60
  )
68
61
 
@@ -80,25 +73,20 @@ const PreLoadedMSA = observer(function ({
80
73
  isLoading: msaDataLoading,
81
74
  error: msaDataFetchError,
82
75
  } = useSWR(
83
- selectedId && selectedDatasetId
84
- ? `${selectedDatasetId}-${selectedId}-${msaList?.length}-msa`
85
- : 'none-msa',
76
+ selectedId && selectedDataset && msaList
77
+ ? `${selectedDataset.datasetId}-${selectedId}-${msaList.length}-msa`
78
+ : null,
86
79
  () =>
87
- selectedId && selectedDataset && msaList
88
- ? fetchMSA({
89
- msaId: selectedId,
90
- config: selectedDataset.adapter,
91
- pluginManager,
92
- })
93
- : undefined,
80
+ fetchMSA({
81
+ msaId: selectedId,
82
+ config: selectedDataset!.adapter,
83
+ pluginManager,
84
+ }),
94
85
  swrFlags,
95
86
  )
96
87
 
97
88
  const e =
98
89
  msaListFetchError ?? msaDataFetchError ?? proteinSequenceError ?? viewError
99
- if (e) {
100
- console.error(e)
101
- }
102
90
  return (
103
91
  <>
104
92
  <DialogContent className={classes.dialogContent}>
@@ -120,7 +108,7 @@ const PreLoadedMSA = observer(function ({
120
108
  </TextField2>
121
109
 
122
110
  {selectedDataset ? (
123
- <div style={{ marginTop: 50 }}>
111
+ <div className={classes.selectedContainer}>
124
112
  {!msaListLoading && msaDataLoading ? (
125
113
  <LoadingEllipses
126
114
  variant="h6"
@@ -183,7 +171,13 @@ const PreLoadedMSA = observer(function ({
183
171
  >
184
172
  Submit
185
173
  </Button>
186
- <Button color="secondary" variant="contained" onClick={handleClose}>
174
+ <Button
175
+ color="secondary"
176
+ variant="contained"
177
+ onClick={() => {
178
+ handleClose()
179
+ }}
180
+ >
187
181
  Cancel
188
182
  </Button>
189
183
  </DialogActions>
@@ -1,3 +1,5 @@
1
+ import { readConfObject } from '@jbrowse/core/configuration'
2
+
1
3
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration'
2
4
 
3
5
  export interface Dataset {
@@ -6,3 +8,7 @@ export interface Dataset {
6
8
  description?: string
7
9
  adapter: AnyConfigurationModel
8
10
  }
11
+
12
+ export function readMsaDatasets(jbrowse: AnyConfigurationModel) {
13
+ return readConfObject(jbrowse, ['msa', 'datasets']) as Dataset[] | undefined
14
+ }
@@ -13,7 +13,7 @@ export default function TabPanel({
13
13
  }) {
14
14
  return (
15
15
  <div role="tabpanel" hidden={value !== index} {...other}>
16
- {value === index && <div>{children}</div>}
16
+ {value === index ? <div>{children}</div> : null}
17
17
  </div>
18
18
  )
19
19
  }
@@ -21,6 +21,10 @@ const useStyles = makeStyles()({
21
21
  minWidth: {
22
22
  minWidth: 300,
23
23
  },
24
+ centered: {
25
+ alignContent: 'center',
26
+ marginLeft: 20,
27
+ },
24
28
  })
25
29
 
26
30
  export default function TranscriptSelector({
@@ -70,7 +74,7 @@ export default function TranscriptSelector({
70
74
  )
71
75
  })}
72
76
  </TextField>
73
- <div style={{ alignContent: 'center', marginLeft: 20 }}>
77
+ <div className={classes.centered}>
74
78
  <Button
75
79
  variant="contained"
76
80
  color="primary"
@@ -83,7 +87,7 @@ export default function TranscriptSelector({
83
87
  </div>
84
88
  </div>
85
89
 
86
- {showSequence && (
90
+ {showSequence ? (
87
91
  <ReadOnlyTextField2
88
92
  value={
89
93
  proteinSequence
@@ -91,7 +95,7 @@ export default function TranscriptSelector({
91
95
  : 'Loading...'
92
96
  }
93
97
  />
94
- )}
98
+ ) : null}
95
99
  </>
96
100
  )
97
101
  }
@@ -6,7 +6,4 @@ export interface Feat {
6
6
 
7
7
  export interface SeqState {
8
8
  seq: string
9
- upstream?: string
10
- downstream?: string
11
- error?: unknown
12
9
  }
@@ -6,23 +6,17 @@ import type { Feature } from '@jbrowse/core/util'
6
6
  export function useFeatureSequence({
7
7
  view,
8
8
  feature,
9
- upDownBp = 0,
10
- forceLoad = true,
11
9
  }: {
12
10
  view: { assemblyNames?: string[] } | undefined
13
11
  feature?: Feature
14
- upDownBp?: number
15
- forceLoad?: boolean
16
12
  }) {
17
13
  const { sequence, error } = useSWRFeatureSequence({
18
14
  view,
19
15
  feature,
20
- upDownBp,
21
- forceLoad,
22
16
  })
23
17
 
24
18
  const proteinSequence =
25
- sequence && !('error' in sequence) && feature
19
+ sequence && feature
26
20
  ? getProteinSequenceFromFeature({
27
21
  seq: sequence.seq,
28
22
  feature,
@@ -3,77 +3,50 @@ import useSWR from 'swr'
3
3
 
4
4
  import { fetchSeq } from './fetchSeq'
5
5
 
6
- import type { SeqState } from './types'
7
6
  import type { Feature } from '@jbrowse/core/util'
8
7
 
9
8
  async function featureSequenceFetcher({
10
9
  feature,
11
10
  assemblyName,
12
- upDownBp,
13
11
  view,
14
12
  }: {
15
13
  feature: Feature
16
14
  assemblyName: string
17
- upDownBp: number
18
15
  view: { assemblyNames?: string[] }
19
- }): Promise<SeqState | undefined> {
16
+ }) {
20
17
  const session = getSession(view)
21
18
  const { start, end, refName } = feature.toJSON() as {
22
19
  start: number
23
20
  end: number
24
21
  refName: string
25
22
  }
26
-
27
- const b = start - upDownBp
28
- const e = end + upDownBp
29
- const [seq, upstream, downstream] = await Promise.all([
30
- fetchSeq({
31
- start,
32
- end,
33
- refName,
34
- assemblyName,
35
- session,
36
- }),
37
- fetchSeq({
38
- start: Math.max(0, b),
39
- end: start,
40
- refName,
41
- assemblyName,
42
- session,
43
- }),
44
- fetchSeq({
45
- start: end,
46
- end: e,
47
- refName,
48
- assemblyName,
49
- session,
50
- }),
51
- ])
52
- return { seq, upstream, downstream }
23
+ const seq = await fetchSeq({
24
+ start,
25
+ end,
26
+ refName,
27
+ assemblyName,
28
+ session,
29
+ })
30
+ return { seq }
53
31
  }
54
32
 
55
33
  export function useSWRFeatureSequence({
56
34
  view,
57
35
  feature,
58
- upDownBp = 0,
59
- forceLoad = true,
60
36
  }: {
61
37
  view: { assemblyNames?: string[] } | undefined
62
38
  feature?: Feature
63
- upDownBp?: number
64
- forceLoad?: boolean
65
39
  }) {
66
40
  const assemblyName = view?.assemblyNames?.[0]
67
41
  const { data, error } = useSWR(
68
42
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
69
43
  feature && assemblyName && view
70
- ? [feature.id(), assemblyName, upDownBp, forceLoad, 'feature-sequence']
44
+ ? [feature.id(), assemblyName, 'feature-sequence']
71
45
  : null,
72
46
  () =>
73
47
  featureSequenceFetcher({
74
48
  feature: feature!,
75
49
  assemblyName: assemblyName!,
76
- upDownBp,
77
50
  view: view!,
78
51
  }),
79
52
  {