jbrowse-plugin-msaview 2.2.11 → 2.3.2

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 (129) hide show
  1. package/dist/AddHighlightModel/index.d.ts +1 -1
  2. package/dist/AddHighlightModel/index.js.map +1 -1
  3. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.d.ts +2 -1
  4. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js +1 -1
  5. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js.map +1 -1
  6. package/dist/BgzipFastaMsaAdapter/configSchema.d.ts +1 -1
  7. package/dist/BgzipFastaMsaAdapter/configSchema.js.map +1 -1
  8. package/dist/BgzipFastaMsaAdapter/index.d.ts +1 -1
  9. package/dist/BgzipFastaMsaAdapter/index.js.map +1 -1
  10. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.d.ts +1 -1
  11. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +1 -1
  12. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +1 -1
  13. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +1 -1
  14. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.d.ts +1 -1
  15. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  16. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.d.ts +1 -1
  17. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +1 -1
  18. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  19. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.d.ts +1 -1
  20. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js.map +1 -1
  21. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.d.ts +1 -2
  22. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +21 -14
  23. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
  24. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.d.ts +1 -1
  25. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +32 -35
  26. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  27. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.d.ts +1 -1
  28. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +2 -2
  29. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
  30. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.d.ts +1 -1
  31. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -1
  32. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +2 -0
  33. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +1 -0
  34. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -1
  35. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.d.ts +1 -1
  36. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +6 -8
  37. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  38. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.d.ts +2 -2
  39. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js.map +1 -1
  40. package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.d.ts +1 -1
  41. package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js.map +1 -1
  42. package/dist/LaunchMsaView/components/TranscriptSelector.d.ts +3 -3
  43. package/dist/LaunchMsaView/components/TranscriptSelector.js +4 -4
  44. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
  45. package/dist/LaunchMsaView/components/useTranscriptSelection.d.ts +1 -1
  46. package/dist/LaunchMsaView/components/useTranscriptSelection.js +1 -2
  47. package/dist/LaunchMsaView/components/useTranscriptSelection.js.map +1 -1
  48. package/dist/LaunchMsaView/components/util.js +1 -1
  49. package/dist/LaunchMsaView/components/util.js.map +1 -1
  50. package/dist/LaunchMsaView/index.d.ts +1 -1
  51. package/dist/LaunchMsaView/index.js.map +1 -1
  52. package/dist/LaunchMsaView/util.d.ts +1 -0
  53. package/dist/LaunchMsaView/util.js +10 -0
  54. package/dist/LaunchMsaView/util.js.map +1 -1
  55. package/dist/MsaViewPanel/afterCreateAutoruns.d.ts +10 -0
  56. package/dist/MsaViewPanel/afterCreateAutoruns.js +258 -0
  57. package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -0
  58. package/dist/MsaViewPanel/blosum62.d.ts +2 -0
  59. package/dist/MsaViewPanel/blosum62.js +628 -0
  60. package/dist/MsaViewPanel/blosum62.js.map +1 -0
  61. package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +1 -1
  62. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  63. package/dist/MsaViewPanel/components/MsaViewPanel.d.ts +1 -1
  64. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  65. package/dist/MsaViewPanel/doLaunchBlast.d.ts +1 -1
  66. package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -1
  67. package/dist/MsaViewPanel/genomeToMSA.d.ts +1 -1
  68. package/dist/MsaViewPanel/genomeToMSA.js.map +1 -1
  69. package/dist/MsaViewPanel/index.d.ts +1 -1
  70. package/dist/MsaViewPanel/index.js.map +1 -1
  71. package/dist/MsaViewPanel/model.d.ts +25 -39
  72. package/dist/MsaViewPanel/model.js +17 -309
  73. package/dist/MsaViewPanel/model.js.map +1 -1
  74. package/dist/MsaViewPanel/msaDataStore.d.ts +3 -4
  75. package/dist/MsaViewPanel/msaDataStore.js +59 -173
  76. package/dist/MsaViewPanel/msaDataStore.js.map +1 -1
  77. package/dist/MsaViewPanel/pairwiseAlignment.d.ts +0 -7
  78. package/dist/MsaViewPanel/pairwiseAlignment.js +1 -636
  79. package/dist/MsaViewPanel/pairwiseAlignment.js.map +1 -1
  80. package/dist/MsaViewPanel/structureConnection.js +1 -5
  81. package/dist/MsaViewPanel/structureConnection.js.map +1 -1
  82. package/dist/MsaViewPanel/util.d.ts +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/jbrowse-plugin-msaview.umd.production.min.js +30 -30
  86. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  87. package/dist/utils/msa.js +35 -77
  88. package/dist/utils/msa.js.map +1 -1
  89. package/dist/utils/ncbiBlast.js +1 -10
  90. package/dist/utils/ncbiBlast.js.map +1 -1
  91. package/package.json +31 -28
  92. package/src/AddHighlightModel/index.tsx +1 -1
  93. package/src/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.ts +3 -4
  94. package/src/BgzipFastaMsaAdapter/configSchema.ts +2 -1
  95. package/src/BgzipFastaMsaAdapter/index.ts +2 -1
  96. package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +2 -6
  97. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +2 -1
  98. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +2 -1
  99. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +6 -7
  100. package/src/LaunchMsaView/components/ManualMSALoader/launchView.ts +5 -2
  101. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +22 -17
  102. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +40 -52
  103. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +6 -13
  104. package/src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts +2 -1
  105. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +2 -0
  106. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +7 -19
  107. package/src/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.ts +2 -2
  108. package/src/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.ts +1 -2
  109. package/src/LaunchMsaView/components/TranscriptSelector.tsx +7 -6
  110. package/src/LaunchMsaView/components/useTranscriptSelection.ts +1 -6
  111. package/src/LaunchMsaView/components/util.ts +1 -1
  112. package/src/LaunchMsaView/index.ts +6 -5
  113. package/src/LaunchMsaView/util.ts +11 -0
  114. package/src/MsaViewPanel/afterCreateAutoruns.ts +299 -0
  115. package/src/MsaViewPanel/blosum62.ts +628 -0
  116. package/src/MsaViewPanel/components/LoadingBLAST.tsx +2 -1
  117. package/src/MsaViewPanel/components/MsaViewPanel.tsx +2 -1
  118. package/src/MsaViewPanel/doLaunchBlast.ts +1 -1
  119. package/src/MsaViewPanel/genomeToMSA.ts +2 -1
  120. package/src/MsaViewPanel/index.ts +2 -1
  121. package/src/MsaViewPanel/model.ts +30 -392
  122. package/src/MsaViewPanel/msaDataStore.ts +56 -196
  123. package/src/MsaViewPanel/pairwiseAlignment.ts +1 -637
  124. package/src/MsaViewPanel/structureConnection.ts +1 -5
  125. package/src/MsaViewPanel/util.ts +1 -1
  126. package/src/index.ts +4 -2
  127. package/src/utils/msa.ts +45 -100
  128. package/src/utils/ncbiBlast.ts +3 -13
  129. package/CHANGELOG.md +0 -101
@@ -1,11 +1,7 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react'
2
2
 
3
3
  import { ErrorMessage } from '@jbrowse/core/ui'
4
- import {
5
- AbstractTrackModel,
6
- Feature,
7
- getContainingView,
8
- } from '@jbrowse/core/util'
4
+ import { getContainingView } from '@jbrowse/core/util'
9
5
  import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
10
6
  import {
11
7
  Accordion,
@@ -22,40 +18,47 @@ import { makeStyles } from 'tss-react/mui'
22
18
 
23
19
  import CachedBlastResults from './CachedBlastResults'
24
20
  import { blastLaunchView } from './blastLaunchView'
21
+ import { msaAlgorithms } from './consts'
25
22
  import TextField2 from '../../../components/TextField2'
26
23
  import { getAllCachedResults } from '../../../utils/blastCache'
27
- import { getGeneDisplayName, getTranscriptDisplayName } from '../../util'
24
+ import {
25
+ getGeneDisplayName,
26
+ getGeneIdentifiers,
27
+ getTranscriptDisplayName,
28
+ } from '../../util'
28
29
  import TranscriptSelector from '../TranscriptSelector'
29
30
  import { useTranscriptSelection } from '../useTranscriptSelection'
30
31
 
32
+ import type { MsaAlgorithm } from './consts'
33
+ import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
31
34
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
32
35
 
33
- function getGeneIdentifiers(feature: Feature): string[] {
34
- const ids = [
35
- feature.id(),
36
- feature.get('id'),
37
- feature.get('name'),
38
- feature.get('gene_id'),
39
- feature.get('gene_name'),
40
- ].filter((id): id is string => !!id)
41
- return [...new Set(ids)]
42
- }
43
-
44
36
  const useStyles = makeStyles()({
45
37
  dialogContent: {
46
38
  width: '80em',
47
39
  },
48
- textAreaFont: {
49
- fontFamily: 'Courier New',
40
+ selectField: {
41
+ width: 150,
42
+ },
43
+ databaseFieldContainer: {
44
+ display: 'flex',
45
+ },
46
+ clusterSeqMessage: {
47
+ marginLeft: 4,
48
+ alignContent: 'center',
49
+ },
50
+ cachedResultsAccordion: {
51
+ marginTop: 20,
52
+ },
53
+ infoText: {
54
+ marginTop: 20,
50
55
  },
51
56
  })
52
57
 
53
58
  const blastDatabaseOptions = ['nr', 'nr_cluster_seq'] as const
54
- const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft'] as const
55
59
  const blastPrograms = ['blastp', 'quick-blastp'] as const
56
60
 
57
61
  type blastDatabaseOptionsT = (typeof blastDatabaseOptions)[number]
58
- type msaAlgorithmsT = (typeof msaAlgorithms)[number]
59
62
  type blastProgramsT = (typeof blastPrograms)[number]
60
63
 
61
64
  const NCBIBlastAutomaticPanel = observer(function ({
@@ -77,7 +80,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
77
80
  const [selectedBlastDatabase, setSelectedBlastDatabase] =
78
81
  useState<blastDatabaseOptionsT>('nr')
79
82
  const [selectedMsaAlgorithm, setSelectedMsaAlgorithm] =
80
- useState<msaAlgorithmsT>('clustalo')
83
+ useState<MsaAlgorithm>('clustalo')
81
84
  const [selectedBlastProgram, setSelectedBlastProgram] =
82
85
  useState<blastProgramsT>('quick-blastp')
83
86
  const [hasCachedResults, setHasCachedResults] = useState(false)
@@ -107,14 +110,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
107
110
  proteinSequence,
108
111
  error: proteinSequenceError,
109
112
  } = useTranscriptSelection({ feature, view })
110
-
111
- useEffect(() => {
112
- if (selectedBlastDatabase === 'nr_cluster_seq') {
113
- setSelectedBlastProgram('blastp')
114
- }
115
- }, [selectedBlastDatabase])
116
113
  const e = proteinSequenceError ?? launchViewError ?? error
117
- const style = { width: 150 }
118
114
  return (
119
115
  <>
120
116
  <DialogContent className={classes.dialogContent}>
@@ -123,13 +119,16 @@ const NCBIBlastAutomaticPanel = observer(function ({
123
119
  <TextField2
124
120
  variant="outlined"
125
121
  label="BLAST database"
126
- style={style}
122
+ className={classes.selectField}
127
123
  select
128
124
  value={selectedBlastDatabase}
129
125
  onChange={event => {
130
- setSelectedBlastDatabase(
131
- event.target.value as (typeof blastDatabaseOptions)[number],
132
- )
126
+ const newDb = event.target
127
+ .value as (typeof blastDatabaseOptions)[number]
128
+ setSelectedBlastDatabase(newDb)
129
+ if (newDb === 'nr_cluster_seq') {
130
+ setSelectedBlastProgram('blastp')
131
+ }
133
132
  }}
134
133
  >
135
134
  {blastDatabaseOptions.map(val => (
@@ -142,13 +141,11 @@ const NCBIBlastAutomaticPanel = observer(function ({
142
141
  <TextField2
143
142
  variant="outlined"
144
143
  label="MSA Algorithm"
145
- style={style}
144
+ className={classes.selectField}
146
145
  select
147
146
  value={selectedMsaAlgorithm}
148
147
  onChange={event => {
149
- setSelectedMsaAlgorithm(
150
- event.target.value as (typeof msaAlgorithms)[number],
151
- )
148
+ setSelectedMsaAlgorithm(event.target.value as MsaAlgorithm)
152
149
  }}
153
150
  >
154
151
  {msaAlgorithms.map(val => (
@@ -158,12 +155,12 @@ const NCBIBlastAutomaticPanel = observer(function ({
158
155
  ))}
159
156
  </TextField2>
160
157
 
161
- <div style={{ display: 'flex' }}>
158
+ <div className={classes.databaseFieldContainer}>
162
159
  <TextField2
163
160
  variant="outlined"
164
161
  label="BLAST program"
165
162
  disabled={selectedBlastDatabase === 'nr_cluster_seq'}
166
- style={style}
163
+ className={classes.selectField}
167
164
  select
168
165
  value={selectedBlastProgram}
169
166
  onChange={event => {
@@ -181,10 +178,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
181
178
  {selectedBlastDatabase === 'nr_cluster_seq' ? (
182
179
  <Typography
183
180
  variant="subtitle2"
184
- style={{
185
- marginLeft: 4,
186
- alignContent: 'center',
187
- }}
181
+ className={classes.clusterSeqMessage}
188
182
  >
189
183
  Can only use blastp on nr_cluster_seq
190
184
  </Typography>
@@ -200,7 +194,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
200
194
  proteinSequence={proteinSequence}
201
195
  />
202
196
 
203
- <Typography style={{ marginTop: 20 }}>
197
+ <Typography className={classes.infoText}>
204
198
  This panel will automatically submit a query to NCBI. Using blastp can
205
199
  take 10+ minutes to run, quick-blastp is generally a lot faster but is
206
200
  not available for the clustered database. After completion, all the
@@ -212,7 +206,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
212
206
  </Typography>
213
207
 
214
208
  {hasCachedResults ? (
215
- <Accordion style={{ marginTop: 20 }}>
209
+ <Accordion className={classes.cachedResultsAccordion}>
216
210
  <AccordionSummary expandIcon={<ExpandMoreIcon />}>
217
211
  <Typography>Previous BLAST Results</Typography>
218
212
  </AccordionSummary>
@@ -260,13 +254,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
260
254
  >
261
255
  Submit
262
256
  </Button>
263
- <Button
264
- color="secondary"
265
- variant="contained"
266
- onClick={() => {
267
- handleClose()
268
- }}
269
- >
257
+ <Button color="secondary" variant="contained" onClick={handleClose}>
270
258
  Cancel
271
259
  </Button>
272
260
  </DialogActions>
@@ -1,11 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
 
3
3
  import { ErrorMessage } from '@jbrowse/core/ui'
4
- import {
5
- AbstractTrackModel,
6
- Feature,
7
- getContainingView,
8
- } from '@jbrowse/core/util'
4
+ import { getContainingView } from '@jbrowse/core/util'
9
5
  import {
10
6
  Button,
11
7
  DialogActions,
@@ -17,12 +13,15 @@ import { observer } from 'mobx-react'
17
13
  import { makeStyles } from 'tss-react/mui'
18
14
 
19
15
  import { blastLaunchView } from './blastLaunchView'
16
+ import { msaAlgorithms } from './consts'
20
17
  import ExternalLink from '../../../components/ExternalLink'
21
18
  import TextField2 from '../../../components/TextField2'
22
19
  import { getGeneDisplayName, getTranscriptDisplayName } from '../../util'
23
20
  import TranscriptSelector from '../TranscriptSelector'
24
21
  import { useTranscriptSelection } from '../useTranscriptSelection'
25
22
 
23
+ import type { MsaAlgorithm } from './consts'
24
+ import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
26
25
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
27
26
 
28
27
  const useStyles = makeStyles()({
@@ -31,10 +30,6 @@ const useStyles = makeStyles()({
31
30
  },
32
31
  })
33
32
 
34
- const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft'] as const
35
-
36
- type msaAlgorithmsT = (typeof msaAlgorithms)[number]
37
-
38
33
  const NCBIBlastRIDPanel = observer(function ({
39
34
  handleClose,
40
35
  feature,
@@ -53,7 +48,7 @@ const NCBIBlastRIDPanel = observer(function ({
53
48
  const [launchViewError, setLaunchViewError] = useState<unknown>()
54
49
  const [rid, setRid] = useState('')
55
50
  const [selectedMsaAlgorithm, setSelectedMsaAlgorithm] =
56
- useState<msaAlgorithmsT>('clustalo')
51
+ useState<MsaAlgorithm>('clustalo')
57
52
 
58
53
  const {
59
54
  options,
@@ -108,9 +103,7 @@ const NCBIBlastRIDPanel = observer(function ({
108
103
  select
109
104
  value={selectedMsaAlgorithm}
110
105
  onChange={event => {
111
- setSelectedMsaAlgorithm(
112
- event.target.value as (typeof msaAlgorithms)[number],
113
- )
106
+ setSelectedMsaAlgorithm(event.target.value as MsaAlgorithm)
114
107
  }}
115
108
  >
116
109
  {msaAlgorithms.map(val => (
@@ -1,7 +1,8 @@
1
- import { Feature, getSession } from '@jbrowse/core/util'
1
+ import { getSession } from '@jbrowse/core/util'
2
2
 
3
3
  import type { JBrowsePluginMsaViewModel } from '../../../MsaViewPanel/model'
4
4
  import type { CachedBlastResult } from '../../../utils/blastCache'
5
+ import type { Feature } from '@jbrowse/core/util'
5
6
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
6
7
 
7
8
  export function blastLaunchView({
@@ -1 +1,3 @@
1
1
  export const BASE_BLAST_URL = 'https://blast.ncbi.nlm.nih.gov/Blast.cgi'
2
+ export const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft'] as const
3
+ export type MsaAlgorithm = (typeof msaAlgorithms)[number]
@@ -2,13 +2,7 @@ import React, { useState } from 'react'
2
2
 
3
3
  import { readConfObject } from '@jbrowse/core/configuration'
4
4
  import { ErrorMessage, LoadingEllipses, SanitizedHTML } from '@jbrowse/core/ui'
5
- import {
6
- AbstractTrackModel,
7
- Feature,
8
- getContainingView,
9
- getEnv,
10
- getSession,
11
- } from '@jbrowse/core/util'
5
+ import { getContainingView, getEnv, getSession } from '@jbrowse/core/util'
12
6
  import { Button, DialogActions, DialogContent, MenuItem } from '@mui/material'
13
7
  import { observer } from 'mobx-react'
14
8
  import useSWR from 'swr'
@@ -21,8 +15,9 @@ import { useTranscriptSelection } from '../useTranscriptSelection'
21
15
  import { swrFlags } from './consts'
22
16
  import { fetchMSA, fetchMSAList } from './fetchMSAData'
23
17
  import { preCalculatedLaunchView } from './preCalculatedLaunchView'
24
- import { Dataset } from './types'
25
18
 
19
+ import type { Dataset } from './types'
20
+ import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
26
21
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
27
22
 
28
23
  const useStyles = makeStyles()({
@@ -31,7 +26,7 @@ const useStyles = makeStyles()({
31
26
  },
32
27
  })
33
28
 
34
- const PreLoadedMSA = observer(function PreLoadedMSA2({
29
+ const PreLoadedMSA = observer(function ({
35
30
  model,
36
31
  feature,
37
32
  handleClose,
@@ -78,7 +73,6 @@ const PreLoadedMSA = observer(function PreLoadedMSA2({
78
73
  selectedTranscript,
79
74
  proteinSequence,
80
75
  error: proteinSequenceError,
81
- validSet,
82
76
  } = useTranscriptSelection({ feature, view, validIds: msaList })
83
77
 
84
78
  const {
@@ -87,7 +81,7 @@ const PreLoadedMSA = observer(function PreLoadedMSA2({
87
81
  error: msaDataFetchError,
88
82
  } = useSWR(
89
83
  selectedId && selectedDatasetId
90
- ? `${selectedId}-${selectedId}-${msaList?.length}-msa`
84
+ ? `${selectedDatasetId}-${selectedId}-${msaList?.length}-msa`
91
85
  : 'none-msa',
92
86
  () =>
93
87
  selectedId && selectedDataset && msaList
@@ -150,7 +144,7 @@ const PreLoadedMSA = observer(function PreLoadedMSA2({
150
144
  selectedTranscript={selectedTranscript}
151
145
  onTranscriptChange={setSelectedId}
152
146
  proteinSequence={proteinSequence}
153
- validSet={validSet}
147
+ validIds={msaList}
154
148
  />
155
149
  </div>
156
150
  ) : null}
@@ -189,13 +183,7 @@ const PreLoadedMSA = observer(function PreLoadedMSA2({
189
183
  >
190
184
  Submit
191
185
  </Button>
192
- <Button
193
- color="secondary"
194
- variant="contained"
195
- onClick={() => {
196
- handleClose()
197
- }}
198
- >
186
+ <Button color="secondary" variant="contained" onClick={handleClose}>
199
187
  Cancel
200
188
  </Button>
201
189
  </DialogActions>
@@ -1,8 +1,8 @@
1
- import { AnyConfigurationModel } from '@jbrowse/core/configuration'
2
1
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'
3
- import { Feature } from '@jbrowse/core/util'
4
2
 
5
3
  import type PluginManager from '@jbrowse/core/PluginManager'
4
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration'
5
+ import type { Feature } from '@jbrowse/core/util'
6
6
 
7
7
  export async function fetchMSAList({
8
8
  config,
@@ -1,5 +1,4 @@
1
- import { AbstractSessionModel, Feature } from '@jbrowse/core/util'
2
-
1
+ import type { AbstractSessionModel, Feature } from '@jbrowse/core/util'
3
2
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
4
3
 
5
4
  export function preCalculatedLaunchView({
@@ -1,6 +1,5 @@
1
1
  import React, { useState } from 'react'
2
2
 
3
- import { Feature } from '@jbrowse/core/util'
4
3
  import { Button, MenuItem, TextField } from '@mui/material'
5
4
  import { makeStyles } from 'tss-react/mui'
6
5
 
@@ -13,6 +12,8 @@ import {
13
12
  getTranscriptLength,
14
13
  } from '../util'
15
14
 
15
+ import type { Feature } from '@jbrowse/core/util'
16
+
16
17
  const useStyles = makeStyles()({
17
18
  flex: {
18
19
  display: 'flex',
@@ -29,7 +30,7 @@ export default function TranscriptSelector({
29
30
  selectedTranscript,
30
31
  onTranscriptChange,
31
32
  proteinSequence,
32
- validSet,
33
+ validIds,
33
34
  }: {
34
35
  feature: Feature
35
36
  options: Feature[]
@@ -37,7 +38,7 @@ export default function TranscriptSelector({
37
38
  selectedTranscript: Feature | undefined
38
39
  onTranscriptChange: (transcriptId: string) => void
39
40
  proteinSequence: string | undefined
40
- validSet?: Set<string>
41
+ validIds?: string[]
41
42
  }) {
42
43
  const { classes } = useStyles()
43
44
  const [showSequence, setShowSequence] = useState(false)
@@ -56,15 +57,15 @@ export default function TranscriptSelector({
56
57
  }}
57
58
  >
58
59
  {options.map(val => {
59
- const inSet = validSet
60
- ? [...validSet].some(id => featureMatchesId(val, id))
60
+ const inSet = validIds
61
+ ? validIds.some(id => featureMatchesId(val, id))
61
62
  : true
62
63
  const { len, mod } = getTranscriptLength(val)
63
64
  return (
64
65
  <MenuItem value={getId(val)} key={val.id()} disabled={!inSet}>
65
66
  {getTranscriptDisplayName(val)} ({len} aa){' '}
66
67
  {mod ? ` (possible fragment)` : ''}
67
- {validSet ? (inSet ? ' (has data)' : ' (no data)') : ''}
68
+ {validIds ? (inSet ? ' (has data)' : ' (no data)') : ''}
68
69
  </MenuItem>
69
70
  )
70
71
  })}
@@ -26,11 +26,6 @@ export function useTranscriptSelection({
26
26
  feature: selectedTranscript,
27
27
  })
28
28
 
29
- const validSet = useMemo(
30
- () => (validIds ? new Set(validIds) : undefined),
31
- [validIds],
32
- )
33
-
34
29
  useEffect(() => {
35
30
  if (validIds && validIds.length > 0) {
36
31
  const currentFeature = options.find(opt => getId(opt) === selectedId)
@@ -52,6 +47,6 @@ export function useTranscriptSelection({
52
47
  selectedTranscript,
53
48
  proteinSequence,
54
49
  error,
55
- validSet,
50
+ validIds,
56
51
  }
57
52
  }
@@ -18,5 +18,5 @@ export function makeId(
18
18
  }
19
19
 
20
20
  export function strip(s: string) {
21
- return s.replace('-', '')
21
+ return s.replaceAll('-', '')
22
22
  }
@@ -1,12 +1,13 @@
1
- import PluginManager from '@jbrowse/core/PluginManager'
2
- import { PluggableElementType } from '@jbrowse/core/pluggableElementTypes'
3
- import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
4
- import { MenuItem } from '@jbrowse/core/ui'
5
- import { Feature, getContainingTrack, getSession } from '@jbrowse/core/util'
1
+ import { getContainingTrack, getSession } from '@jbrowse/core/util'
6
2
  import AddIcon from '@mui/icons-material/Add'
7
3
 
8
4
  import LaunchMsaViewDialog from './components/LaunchMsaViewDialog'
9
5
 
6
+ import type PluginManager from '@jbrowse/core/PluginManager'
7
+ import type { PluggableElementType } from '@jbrowse/core/pluggableElementTypes'
8
+ import type DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
9
+ import type { MenuItem } from '@jbrowse/core/ui'
10
+ import type { Feature } from '@jbrowse/core/util'
10
11
  import type { IAnyModelType } from '@jbrowse/mobx-state-tree'
11
12
 
12
13
  function isDisplay(elt: { name: string }): elt is DisplayType {
@@ -85,3 +85,14 @@ export function getSortedTranscriptFeatures(feature: Feature) {
85
85
  export function cleanProteinSequence(seq: string) {
86
86
  return seq.replaceAll('*', '').replaceAll('&', '')
87
87
  }
88
+
89
+ export function getGeneIdentifiers(feature: Feature): string[] {
90
+ const ids = [
91
+ feature.id(),
92
+ feature.get('id'),
93
+ feature.get('name'),
94
+ feature.get('gene_id'),
95
+ feature.get('gene_name'),
96
+ ].filter((id): id is string => !!id)
97
+ return [...new Set(ids)]
98
+ }