jbrowse-plugin-msaview 2.1.0 → 2.2.1

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 (170) hide show
  1. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +3 -3
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  3. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +3 -1
  4. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -1
  5. package/dist/ExternalLink.d.ts +3 -0
  6. package/dist/ExternalLink.js +11 -0
  7. package/dist/ExternalLink.js.map +1 -0
  8. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +28 -33
  9. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +1 -1
  10. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js +0 -6
  11. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js.map +1 -1
  12. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.d.ts +1 -0
  13. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js +12 -22
  14. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +1 -1
  15. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.d.ts +2 -0
  16. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js +20 -0
  17. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js.map +1 -0
  18. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.d.ts +24 -0
  19. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js.map +1 -0
  20. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.d.ts +10 -0
  21. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js +27 -0
  22. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js.map +1 -0
  23. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +5 -5
  24. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  25. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/NcbiBlastPanel.d.ts → ManualMSALoader/ManualMSALoader.d.ts} +2 -2
  26. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +103 -0
  27. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -0
  28. package/dist/LaunchMsaView/components/{EnsemblGeneTree → ManualMSALoader}/fetchGeneList.js.map +1 -1
  29. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.d.ts +14 -0
  30. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js +12 -0
  31. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js.map +1 -0
  32. package/dist/LaunchMsaView/components/{MSALoader/MSALoader.d.ts → NCBIBlastQuery/NCBIBlastAutomaticPanel.d.ts} +4 -2
  33. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +89 -0
  34. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -0
  35. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.d.ts +10 -0
  36. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +55 -0
  37. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -0
  38. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.d.ts +5 -0
  39. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js +11 -0
  40. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js.map +1 -0
  41. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.d.ts +7 -0
  42. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +30 -0
  43. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -0
  44. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.d.ts +5 -0
  45. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +26 -0
  46. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +1 -0
  47. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.d.ts → NCBIBlastQuery/blastLaunchView.d.ts} +2 -1
  48. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.js → NCBIBlastQuery/blastLaunchView.js} +3 -6
  49. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -0
  50. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +1 -0
  51. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +2 -0
  52. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -0
  53. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +17 -16
  54. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  55. package/dist/LaunchMsaView/components/TranscriptSelector.d.ts +10 -0
  56. package/dist/LaunchMsaView/components/TranscriptSelector.js +45 -0
  57. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -0
  58. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/calculateProteinSequence.d.ts → calculateProteinSequence.d.ts} +1 -2
  59. package/dist/LaunchMsaView/components/calculateProteinSequence.js +39 -0
  60. package/dist/LaunchMsaView/components/calculateProteinSequence.js.map +1 -0
  61. package/dist/LaunchMsaView/components/fetchSeq.js.map +1 -0
  62. package/dist/LaunchMsaView/components/types.js +2 -0
  63. package/dist/LaunchMsaView/components/types.js.map +1 -0
  64. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.d.ts → useFeatureSequence.d.ts} +2 -1
  65. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.js → useFeatureSequence.js} +12 -1
  66. package/dist/LaunchMsaView/components/useFeatureSequence.js.map +1 -0
  67. package/dist/LaunchMsaView/components/util.js.map +1 -0
  68. package/dist/LaunchMsaView/util.d.ts +5 -1
  69. package/dist/LaunchMsaView/util.js +15 -1
  70. package/dist/LaunchMsaView/util.js.map +1 -1
  71. package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +2 -1
  72. package/dist/MsaViewPanel/components/LoadingBLAST.js +6 -6
  73. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  74. package/dist/MsaViewPanel/components/MsaViewPanel.js +1 -1
  75. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  76. package/dist/MsaViewPanel/components/RIDLink.d.ts +2 -1
  77. package/dist/MsaViewPanel/components/RIDLink.js +6 -9
  78. package/dist/MsaViewPanel/components/RIDLink.js.map +1 -1
  79. package/dist/MsaViewPanel/doLaunchBlast.js +18 -20
  80. package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -1
  81. package/dist/MsaViewPanel/model.d.ts +3 -4
  82. package/dist/MsaViewPanel/model.js.map +1 -1
  83. package/dist/ReadOnlyTextField2.d.ts +4 -0
  84. package/dist/ReadOnlyTextField2.js +20 -0
  85. package/dist/ReadOnlyTextField2.js.map +1 -0
  86. package/dist/jbrowse-plugin-msaview.umd.production.min.js +41 -51
  87. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  88. package/dist/utils/fetch.d.ts +1 -1
  89. package/dist/utils/fetch.js.map +1 -1
  90. package/dist/utils/ncbiBlast.d.ts +2 -2
  91. package/dist/utils/ncbiBlast.js +29 -15
  92. package/dist/utils/ncbiBlast.js.map +1 -1
  93. package/dist/utils/types.d.ts +20 -0
  94. package/dist/utils/types.js +2 -0
  95. package/dist/utils/types.js.map +1 -0
  96. package/package.json +3 -3
  97. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +3 -3
  98. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +2 -1
  99. package/src/ExternalLink.tsx +15 -0
  100. package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +39 -55
  101. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.ts +0 -6
  102. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +19 -54
  103. package/src/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.ts +22 -0
  104. package/src/LaunchMsaView/components/EnsemblGeneTree/types.ts +28 -0
  105. package/src/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.ts +29 -0
  106. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +9 -5
  107. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +219 -0
  108. package/src/LaunchMsaView/components/ManualMSALoader/launchView.ts +34 -0
  109. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +226 -0
  110. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +111 -0
  111. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.tsx +34 -0
  112. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +82 -0
  113. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.tsx +75 -0
  114. package/src/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.ts → NCBIBlastQuery/blastLaunchView.ts} +4 -5
  115. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +1 -0
  116. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +27 -37
  117. package/src/LaunchMsaView/components/TranscriptSelector.tsx +99 -0
  118. package/src/LaunchMsaView/components/{NewNCBIBlastQuery/calculateProteinSequence.ts → calculateProteinSequence.ts} +12 -22
  119. package/src/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.ts → useFeatureSequence.ts} +16 -2
  120. package/src/LaunchMsaView/util.ts +22 -2
  121. package/src/MsaViewPanel/components/LoadingBLAST.tsx +26 -8
  122. package/src/MsaViewPanel/components/MsaViewPanel.tsx +5 -1
  123. package/src/MsaViewPanel/components/RIDLink.tsx +8 -8
  124. package/src/MsaViewPanel/doLaunchBlast.ts +29 -30
  125. package/src/MsaViewPanel/model.ts +1 -0
  126. package/src/ReadOnlyTextField2.tsx +33 -0
  127. package/src/utils/fetch.ts +2 -2
  128. package/src/utils/ncbiBlast.ts +40 -30
  129. package/src/utils/types.ts +14 -0
  130. package/dist/LaunchMsaView/components/MSALoader/MSALoader.js +0 -94
  131. package/dist/LaunchMsaView/components/MSALoader/MSALoader.js.map +0 -1
  132. package/dist/LaunchMsaView/components/MSALoader/fetchGeneList.d.ts +0 -1
  133. package/dist/LaunchMsaView/components/MSALoader/fetchGeneList.js +0 -12
  134. package/dist/LaunchMsaView/components/MSALoader/fetchGeneList.js.map +0 -1
  135. package/dist/LaunchMsaView/components/MSALoader/preCalculatedLaunchView.d.ts +0 -9
  136. package/dist/LaunchMsaView/components/MSALoader/preCalculatedLaunchView.js +0 -36
  137. package/dist/LaunchMsaView/components/MSALoader/preCalculatedLaunchView.js.map +0 -1
  138. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js +0 -85
  139. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js.map +0 -1
  140. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js +0 -47
  141. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js.map +0 -1
  142. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/fetchSeq.js.map +0 -1
  143. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.d.ts +0 -1
  144. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js +0 -2
  145. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js.map +0 -1
  146. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.js.map +0 -1
  147. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/types.js.map +0 -1
  148. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js.map +0 -1
  149. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/util.js.map +0 -1
  150. package/dist/OpenInNewIcon.d.ts +0 -3
  151. package/dist/OpenInNewIcon.js +0 -8
  152. package/dist/OpenInNewIcon.js.map +0 -1
  153. package/src/LaunchMsaView/components/MSALoader/MSALoader.tsx +0 -130
  154. package/src/LaunchMsaView/components/MSALoader/fetchGeneList.ts +0 -13
  155. package/src/LaunchMsaView/components/MSALoader/preCalculatedLaunchView.ts +0 -55
  156. package/src/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.tsx +0 -171
  157. package/src/LaunchMsaView/components/NewNCBIBlastQuery/index.tsx +0 -1
  158. package/src/OpenInNewIcon.tsx +0 -14
  159. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery → EnsemblGeneTree}/types.js +0 -0
  160. /package/dist/LaunchMsaView/components/{EnsemblGeneTree → ManualMSALoader}/fetchGeneList.d.ts +0 -0
  161. /package/dist/LaunchMsaView/components/{EnsemblGeneTree → ManualMSALoader}/fetchGeneList.js +0 -0
  162. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/fetchSeq.d.ts → fetchSeq.d.ts} +0 -0
  163. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/fetchSeq.js → fetchSeq.js} +0 -0
  164. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/types.d.ts → types.d.ts} +0 -0
  165. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/util.d.ts → util.d.ts} +0 -0
  166. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/util.js → util.js} +0 -0
  167. /package/src/LaunchMsaView/components/{EnsemblGeneTree → ManualMSALoader}/fetchGeneList.ts +0 -0
  168. /package/src/LaunchMsaView/components/{NewNCBIBlastQuery/fetchSeq.ts → fetchSeq.ts} +0 -0
  169. /package/src/LaunchMsaView/components/{NewNCBIBlastQuery/types.ts → types.ts} +0 -0
  170. /package/src/LaunchMsaView/components/{NewNCBIBlastQuery/util.ts → util.ts} +0 -0
@@ -1,130 +0,0 @@
1
- import React, { useEffect, useState } from 'react'
2
-
3
- import { FileSelector } from '@jbrowse/core/ui'
4
- import {
5
- AbstractTrackModel,
6
- Feature,
7
- FileLocation,
8
- getContainingView,
9
- getSession,
10
- } from '@jbrowse/core/util'
11
- import { openLocation } from '@jbrowse/core/util/io'
12
- import { Button, DialogActions, DialogContent } from '@mui/material'
13
- import { observer } from 'mobx-react'
14
- import { makeStyles } from 'tss-react/mui'
15
-
16
- import { fetchGeneList } from './fetchGeneList'
17
- import { preCalculatedLaunchView } from './preCalculatedLaunchView'
18
- import { getGeneDisplayName, getId, getTranscriptFeatures } from '../../util'
19
-
20
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
21
-
22
- const useStyles = makeStyles()({
23
- dialogContent: {
24
- width: '80em',
25
- },
26
- })
27
-
28
- const PreLoadedMSA = observer(function PreLoadedMSA2({
29
- model,
30
- feature,
31
- handleClose,
32
- }: {
33
- model: AbstractTrackModel
34
- feature: Feature
35
- handleClose: () => void
36
- }) {
37
- const session = getSession(model)
38
- const view = getContainingView(model) as LinearGenomeViewModel
39
- const { classes } = useStyles()
40
- const [, setError] = useState<unknown>()
41
- const [geneNameList, setGeneNameList] = useState<string[]>()
42
- const [fileLocation, setFileLocation] = useState<FileLocation>()
43
-
44
- useEffect(() => {
45
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
46
- ;(async () => {
47
- try {
48
- const data = await fetchGeneList()
49
- setGeneNameList(data)
50
- const set = new Set(data)
51
- const options = getTranscriptFeatures(feature)
52
- const ret = options.find(val => set.has(getId(val)))
53
- if (ret) {
54
- setUserSelection(getId(ret))
55
- }
56
- } catch (e) {
57
- console.error(e)
58
- setError(e)
59
- }
60
- })()
61
- }, [feature])
62
-
63
- useEffect(() => {
64
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
65
- ;(async () => {
66
- try {
67
- if (fileLocation) {
68
- await openLocation(fileLocation).readFile()
69
- }
70
- } catch (e) {
71
- console.error(e)
72
- setError(e)
73
- }
74
- })()
75
- }, [fileLocation, feature])
76
-
77
- const set = new Set(geneNameList)
78
- const options = getTranscriptFeatures(feature)
79
- const ret = options.find(val => set.has(getId(val)))
80
- const [userSelection, setUserSelection] = useState(getId(options[0]))
81
-
82
- return (
83
- <>
84
- <DialogContent className={classes.dialogContent}>
85
- <FileSelector location={fileLocation} setLocation={setFileLocation} />
86
- </DialogContent>
87
-
88
- <DialogActions>
89
- <Button
90
- color="primary"
91
- variant="contained"
92
- onClick={() => {
93
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
94
- ;(async () => {
95
- try {
96
- if (!ret) {
97
- return
98
- }
99
- await preCalculatedLaunchView({
100
- userSelection,
101
- session,
102
- newViewTitle: getGeneDisplayName(ret),
103
- view,
104
- feature: ret,
105
- })
106
- handleClose()
107
- } catch (e) {
108
- console.error(e)
109
- setError(e)
110
- }
111
- })()
112
- }}
113
- >
114
- Submit
115
- </Button>
116
- <Button
117
- color="secondary"
118
- variant="contained"
119
- onClick={() => {
120
- handleClose()
121
- }}
122
- >
123
- Cancel
124
- </Button>
125
- </DialogActions>
126
- </>
127
- )
128
- })
129
-
130
- export default PreLoadedMSA
@@ -1,13 +0,0 @@
1
- export async function fetchGeneList() {
2
- const res = await fetch(
3
- 'https://jbrowse.org/demos/msaview/knownCanonical/list.txt',
4
- )
5
- if (!res.ok) {
6
- throw new Error(`HTTP ${res.status} fetching list ${await res.text()}`)
7
- }
8
- const result = await res.text()
9
- return result
10
- .split('\n')
11
- .map(f => f.trim())
12
- .filter(f => !!f)
13
- }
@@ -1,55 +0,0 @@
1
- import { AbstractSessionModel, Feature } from '@jbrowse/core/util'
2
- import { ungzip } from 'pako'
3
-
4
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
5
-
6
- async function myfetch(url: string) {
7
- const res = await fetch(url)
8
- if (!res.ok) {
9
- throw new Error(`HTTP ${res.status} fetching ${await res.text()}`)
10
- }
11
- const data = await res.arrayBuffer()
12
- return new TextDecoder().decode(ungzip(data))
13
- }
14
-
15
- export async function preCalculatedLaunchView({
16
- userSelection,
17
- session,
18
- newViewTitle,
19
- view,
20
- feature,
21
- }: {
22
- session: AbstractSessionModel
23
- userSelection: string
24
- newViewTitle: string
25
- view: LinearGenomeViewModel
26
- feature: Feature
27
- }) {
28
- const d = await myfetch(
29
- `https://jbrowse.org/demos/msaview/knownCanonical/${userSelection}.mfa.gz`,
30
- )
31
-
32
- session.addView('MsaView', {
33
- type: 'MsaView',
34
- displayName: newViewTitle,
35
- treeAreaWidth: 200,
36
- treeWidth: 100,
37
- drawNodeBubbles: false,
38
- labelsAlignRight: true,
39
- showBranchLen: false,
40
- colWidth: 10,
41
- rowHeight: 12,
42
- colorSchemeName: 'percent_identity_dynamic',
43
- treeFilehandle: {
44
- uri: 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/multiz100way/hg38.100way.nh',
45
- },
46
- treeMetadataFilehandle: {
47
- uri: 'https://s3.amazonaws.com/jbrowse.org/demos/app/species.json',
48
- },
49
- data: {
50
- msa: d,
51
- },
52
- connectedViewId: view.id,
53
- connectedFeature: feature.toJSON(),
54
- })
55
- }
@@ -1,171 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import { ErrorMessage } from '@jbrowse/core/ui'
4
- import {
5
- AbstractTrackModel,
6
- Feature,
7
- getContainingView,
8
- } from '@jbrowse/core/util'
9
- import { Button, DialogActions, DialogContent, MenuItem } from '@mui/material'
10
- import { observer } from 'mobx-react'
11
- import { makeStyles } from 'tss-react/mui'
12
-
13
- import { getProteinSequence } from './calculateProteinSequence'
14
- import { ncbiBlastLaunchView } from './ncbiBlastLaunchView'
15
- import { useFeatureSequence } from './useFeatureSequence'
16
- import TextField2 from '../../../TextField2'
17
- import {
18
- getGeneDisplayName,
19
- getId,
20
- getTranscriptDisplayName,
21
- getTranscriptFeatures,
22
- } from '../../util'
23
-
24
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
25
-
26
- const useStyles = makeStyles()({
27
- dialogContent: {
28
- width: '80em',
29
- },
30
- textAreaFont: {
31
- fontFamily: 'Courier New',
32
- },
33
- })
34
-
35
- const NcbiBlastPanel = observer(function NcbiBlastPanel2({
36
- handleClose,
37
- feature,
38
- model,
39
- }: {
40
- model: AbstractTrackModel
41
- feature: Feature
42
- handleClose: () => void
43
- }) {
44
- const { classes } = useStyles()
45
- const view = getContainingView(model) as LinearGenomeViewModel
46
- const [blastDatabase, setBlastDatabase] = useState('nr')
47
- const [msaAlgorithm, setMsaAlgorithm] = useState('clustalo')
48
-
49
- const options = getTranscriptFeatures(feature)
50
- const [userSelection, setUserSelection] = useState(getId(options[0]))
51
- const selectedTranscript = options.find(val => getId(val) === userSelection)!
52
- const { sequence, error } = useFeatureSequence({
53
- view,
54
- feature: selectedTranscript,
55
- })
56
- const proteinSequence =
57
- sequence && !('error' in sequence)
58
- ? getProteinSequence({
59
- seq: sequence.seq,
60
- selectedTranscript,
61
- })
62
- : ''
63
-
64
- const blastDatabaseOptions = ['nr', 'nr_cluster_seq']
65
- const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft']
66
- return (
67
- <DialogContent className={classes.dialogContent}>
68
- {error ? <ErrorMessage error={error} /> : null}
69
- <TextField2
70
- value={blastDatabase}
71
- onChange={event => {
72
- setBlastDatabase(event.target.value)
73
- }}
74
- label="BLAST blastDatabase"
75
- select
76
- >
77
- {blastDatabaseOptions.map(val => (
78
- <MenuItem value={val} key={val}>
79
- {val}
80
- </MenuItem>
81
- ))}
82
- </TextField2>
83
-
84
- <TextField2
85
- value={msaAlgorithm}
86
- onChange={event => {
87
- setMsaAlgorithm(event.target.value)
88
- }}
89
- label="MSA Algorithm"
90
- select
91
- >
92
- {msaAlgorithms.map(val => (
93
- <MenuItem value={val} key={val}>
94
- {val}
95
- </MenuItem>
96
- ))}
97
- </TextField2>
98
-
99
- <TextField2
100
- value={userSelection}
101
- onChange={event => {
102
- setUserSelection(event.target.value)
103
- }}
104
- label="Choose isoform to BLAST"
105
- select
106
- >
107
- {options.map(val => (
108
- <MenuItem value={getId(val)} key={val.id()}>
109
- {getGeneDisplayName(feature)} - {getTranscriptDisplayName(val)}
110
- </MenuItem>
111
- ))}
112
- </TextField2>
113
- <TextField2
114
- variant="outlined"
115
- multiline
116
- minRows={5}
117
- maxRows={10}
118
- fullWidth
119
- value={
120
- proteinSequence
121
- ? `>${getTranscriptDisplayName(selectedTranscript)}\n${proteinSequence}`
122
- : 'Loading...'
123
- }
124
- slotProps={{
125
- input: {
126
- readOnly: true,
127
- classes: {
128
- input: classes.textAreaFont,
129
- },
130
- },
131
- }}
132
- />
133
-
134
- <DialogActions>
135
- <Button
136
- color="primary"
137
- variant="contained"
138
- onClick={() => {
139
- const newView = ncbiBlastLaunchView({
140
- feature: selectedTranscript,
141
- view,
142
- newViewTitle: `NCBI BLAST - ${getGeneDisplayName(feature)} - ${getTranscriptDisplayName(selectedTranscript)} - ${msaAlgorithm}`,
143
- })
144
- newView.setBlastParams({
145
- blastProgram: 'blastp',
146
- blastDatabase,
147
- msaAlgorithm,
148
- selectedTranscript,
149
- proteinSequence,
150
- })
151
- handleClose()
152
- }}
153
- disabled={!proteinSequence}
154
- >
155
- Submit
156
- </Button>
157
- <Button
158
- color="secondary"
159
- variant="contained"
160
- onClick={() => {
161
- handleClose()
162
- }}
163
- >
164
- Cancel
165
- </Button>
166
- </DialogActions>
167
- </DialogContent>
168
- )
169
- })
170
-
171
- export default NcbiBlastPanel
@@ -1 +0,0 @@
1
- export { default } from './NcbiBlastPanel'
@@ -1,14 +0,0 @@
1
- import React from 'react'
2
-
3
- import { SvgIcon } from '@mui/material'
4
-
5
- import type { SvgIconProps } from '@mui/material'
6
-
7
- export default function OpenInNewIcon(props: SvgIconProps) {
8
- return (
9
- <SvgIcon {...props}>
10
- <path d="M0 0h24v24H0z" fill="none" />
11
- <path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z" />
12
- </SvgIcon>
13
- )
14
- }