jbrowse-plugin-msaview 2.8.2 → 2.9.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 (87) hide show
  1. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastRIDPanel.d.ts → BlastQuery/BlastAutomaticPanel.d.ts} +2 -3
  2. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastAutomaticPanel.js → BlastQuery/BlastAutomaticPanel.js} +6 -25
  3. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastManualPanel.d.ts → BlastQuery/BlastManualPanel.d.ts} +2 -3
  4. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastManualPanel.js → BlastQuery/BlastManualPanel.js} +7 -4
  5. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastMethodSelector.d.ts → BlastQuery/BlastMethodSelector.d.ts} +2 -2
  6. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastMethodSelector.js → BlastQuery/BlastMethodSelector.js} +1 -2
  7. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastPanel.d.ts → BlastQuery/BlastPanel.d.ts} +3 -12
  8. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastPanel.js → BlastQuery/BlastPanel.js} +14 -16
  9. package/dist/LaunchMsaView/components/BlastQuery/BlastSettingsDialog.d.ts +8 -0
  10. package/dist/LaunchMsaView/components/{NCBIBlastQuery/NCBISettingsDialog.js → BlastQuery/BlastSettingsDialog.js} +13 -9
  11. package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/CachedBlastResults.js +1 -1
  12. package/dist/LaunchMsaView/components/BlastQuery/consts.d.ts +12 -0
  13. package/dist/LaunchMsaView/components/BlastQuery/consts.js +17 -0
  14. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +3 -3
  15. package/dist/LaunchMsaView/components/OrthologQuery/OrthologPanel.js +1 -1
  16. package/dist/MsaViewPanel/components/JobLink.d.ts +5 -0
  17. package/dist/MsaViewPanel/components/JobLink.js +13 -0
  18. package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +1 -2
  19. package/dist/MsaViewPanel/components/LoadingBLAST.js +8 -15
  20. package/dist/MsaViewPanel/components/MsaViewPanel.js +1 -1
  21. package/dist/MsaViewPanel/doLaunchBlast.js +11 -19
  22. package/dist/MsaViewPanel/doLaunchOrthologs.test.d.ts +1 -0
  23. package/dist/MsaViewPanel/doLaunchOrthologs.test.js +127 -0
  24. package/dist/MsaViewPanel/model.d.ts +1 -4
  25. package/dist/jbrowse-plugin-msaview.umd.production.min.js +30 -30
  26. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  27. package/dist/utils/blastCache.d.ts +8 -4
  28. package/dist/utils/blastCache.js +4 -5
  29. package/dist/utils/ebiBlast.d.ts +52 -0
  30. package/dist/utils/ebiBlast.js +63 -0
  31. package/dist/utils/ebiJobDispatcher.d.ts +33 -0
  32. package/dist/utils/ebiJobDispatcher.js +55 -0
  33. package/dist/utils/fetch.js +24 -1
  34. package/dist/utils/msa.d.ts +1 -1
  35. package/dist/utils/msa.js +25 -32
  36. package/dist/utils/types.d.ts +9 -14
  37. package/dist/utils/useLocalStorage.d.ts +1 -0
  38. package/dist/utils/useLocalStorage.js +1 -1
  39. package/dist/version.d.ts +1 -1
  40. package/dist/version.js +1 -1
  41. package/package.json +1 -1
  42. package/src/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx → BlastQuery/BlastAutomaticPanel.tsx} +13 -59
  43. package/src/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastManualPanel.tsx → BlastQuery/BlastManualPanel.tsx} +7 -6
  44. package/src/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastMethodSelector.tsx → BlastQuery/BlastMethodSelector.tsx} +2 -7
  45. package/src/LaunchMsaView/components/{NCBIBlastQuery/NCBIBlastPanel.tsx → BlastQuery/BlastPanel.tsx} +21 -25
  46. package/src/LaunchMsaView/components/{NCBIBlastQuery/NCBISettingsDialog.tsx → BlastQuery/BlastSettingsDialog.tsx} +26 -13
  47. package/src/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/CachedBlastResults.tsx +1 -1
  48. package/src/LaunchMsaView/components/BlastQuery/consts.ts +22 -0
  49. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +5 -7
  50. package/src/LaunchMsaView/components/OrthologQuery/OrthologPanel.tsx +2 -2
  51. package/src/MsaViewPanel/components/JobLink.tsx +17 -0
  52. package/src/MsaViewPanel/components/LoadingBLAST.tsx +10 -41
  53. package/src/MsaViewPanel/components/MsaViewPanel.tsx +1 -1
  54. package/src/MsaViewPanel/doLaunchBlast.ts +12 -28
  55. package/src/MsaViewPanel/doLaunchOrthologs.test.ts +159 -0
  56. package/src/MsaViewPanel/model.ts +1 -5
  57. package/src/utils/blastCache.ts +8 -9
  58. package/src/utils/ebiBlast.ts +114 -0
  59. package/src/utils/ebiJobDispatcher.ts +91 -0
  60. package/src/utils/fetch.ts +26 -1
  61. package/src/utils/msa.ts +26 -47
  62. package/src/utils/types.ts +8 -13
  63. package/src/utils/useLocalStorage.ts +1 -1
  64. package/src/version.ts +1 -1
  65. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.d.ts +0 -10
  66. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +0 -74
  67. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.d.ts +0 -5
  68. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +0 -7
  69. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +0 -4
  70. package/dist/MsaViewPanel/components/RIDLink.d.ts +0 -6
  71. package/dist/MsaViewPanel/components/RIDLink.js +0 -12
  72. package/dist/utils/ncbiBlast.d.ts +0 -30
  73. package/dist/utils/ncbiBlast.js +0 -84
  74. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +0 -137
  75. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +0 -10
  76. package/src/MsaViewPanel/components/RIDLink.tsx +0 -19
  77. package/src/utils/ncbiBlast.ts +0 -143
  78. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/CachedBlastResults.d.ts +0 -0
  79. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/MsaAlgorithmSelect.d.ts +0 -0
  80. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/MsaAlgorithmSelect.js +0 -0
  81. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/blastLaunchView.d.ts +0 -0
  82. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/blastLaunchView.js +0 -0
  83. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/useCachedBlastResults.d.ts +0 -0
  84. /package/dist/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/useCachedBlastResults.js +0 -0
  85. /package/src/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/MsaAlgorithmSelect.tsx +0 -0
  86. /package/src/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/blastLaunchView.ts +0 -0
  87. /package/src/LaunchMsaView/components/{NCBIBlastQuery → BlastQuery}/useCachedBlastResults.ts +0 -0
@@ -1,137 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import { Typography } from '@mui/material'
4
- import { observer } from 'mobx-react'
5
- import { makeStyles } from 'tss-react/mui'
6
-
7
- import MsaAlgorithmSelect from './MsaAlgorithmSelect'
8
- import { blastLaunchView } from './blastLaunchView'
9
- import ExternalLink from '../../../components/ExternalLink'
10
- import TextField2 from '../../../components/TextField2'
11
- import { getBlastViewTitle, getLinearGenomeView } from '../../util'
12
- import LaunchPanelContent from '../LaunchPanelContent'
13
- import SubmitCancelActions from '../SubmitCancelActions'
14
- import TranscriptSelector from '../TranscriptSelector'
15
- import { useTranscriptSelection } from '../useTranscriptSelection'
16
-
17
- import type { MsaAlgorithm } from './consts'
18
- import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
19
-
20
- const useStyles = makeStyles()({
21
- marginBottom: {
22
- marginBottom: 16,
23
- },
24
- ridField: {
25
- width: 150,
26
- },
27
- infoText: {
28
- marginTop: 20,
29
- },
30
- })
31
-
32
- const NCBIBlastRIDPanel = observer(function ({
33
- handleClose,
34
- feature,
35
- model,
36
- children,
37
- baseUrl,
38
- }: {
39
- model: AbstractTrackModel
40
- feature: Feature
41
- baseUrl: string
42
- handleClose: () => void
43
- children: React.ReactNode
44
- }) {
45
- const { classes } = useStyles()
46
- const view = getLinearGenomeView(model)
47
- const [launchViewError, setLaunchViewError] = useState<unknown>()
48
- const [rid, setRid] = useState('')
49
- const [selectedMsaAlgorithm, setSelectedMsaAlgorithm] =
50
- useState<MsaAlgorithm>('clustalo')
51
-
52
- const transcriptSelection = useTranscriptSelection({ feature, view })
53
- const { selectedTranscript, proteinSequence } = transcriptSelection
54
-
55
- const e = transcriptSelection.error ?? launchViewError
56
- const trimmedRid = rid.trim()
57
-
58
- return (
59
- <>
60
- <LaunchPanelContent error={e}>
61
- {children}
62
-
63
- <Typography variant="body2" className={classes.marginBottom}>
64
- Enter the RID (Request ID) from a previously submitted NCBI BLAST
65
- query. You can find the RID in the BLAST results page URL or at the
66
- top of the results page. RIDs are typically valid for 24-36 hours
67
- after submission.
68
- </Typography>
69
-
70
- <TextField2
71
- variant="outlined"
72
- label="BLAST RID"
73
- placeholder="e.g., ABC12345"
74
- fullWidth
75
- className={classes.marginBottom}
76
- value={rid}
77
- onChange={event => {
78
- setRid(event.target.value)
79
- }}
80
- />
81
-
82
- {trimmedRid ? (
83
- <Typography variant="body2" className={classes.marginBottom}>
84
- <ExternalLink href={`${baseUrl}?CMD=Get&RID=${trimmedRid}`}>
85
- View BLAST results on NCBI
86
- </ExternalLink>
87
- </Typography>
88
- ) : null}
89
-
90
- <MsaAlgorithmSelect
91
- className={classes.ridField}
92
- value={selectedMsaAlgorithm}
93
- onChange={setSelectedMsaAlgorithm}
94
- />
95
-
96
- <TranscriptSelector feature={feature} {...transcriptSelection} />
97
-
98
- <Typography className={classes.infoText}>
99
- This will fetch the BLAST results for the provided RID and run them
100
- through a multiple sequence alignment. The protein sequence from the
101
- selected transcript will be added as the query sequence in the MSA.
102
- </Typography>
103
- </LaunchPanelContent>
104
- <SubmitCancelActions
105
- submitDisabled={!proteinSequence || !trimmedRid}
106
- onSubmit={() => {
107
- try {
108
- if (selectedTranscript && trimmedRid) {
109
- setLaunchViewError(undefined)
110
- blastLaunchView({
111
- feature: selectedTranscript,
112
- view,
113
- newViewTitle: getBlastViewTitle(feature, selectedTranscript),
114
- blastParams: {
115
- baseUrl,
116
- blastProgram: 'blastp',
117
- blastDatabase: 'nr',
118
- msaAlgorithm: selectedMsaAlgorithm,
119
- selectedTranscript,
120
- proteinSequence,
121
- rid: trimmedRid,
122
- },
123
- })
124
- handleClose()
125
- }
126
- } catch (e) {
127
- console.error(e)
128
- setLaunchViewError(e)
129
- }
130
- }}
131
- onCancel={handleClose}
132
- />
133
- </>
134
- )
135
- })
136
-
137
- export default NCBIBlastRIDPanel
@@ -1,10 +0,0 @@
1
- export const BASE_BLAST_URL = 'https://blast.ncbi.nlm.nih.gov/Blast.cgi'
2
-
3
- export const msaAlgorithms = ['clustalo', 'muscle', 'kalign', 'mafft'] as const
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]
@@ -1,19 +0,0 @@
1
- import React from 'react'
2
-
3
- import { Typography } from '@mui/material'
4
-
5
- import ExternalLink from '../../components/ExternalLink'
6
-
7
- function RIDLink({ baseUrl, rid }: { rid: string; baseUrl: string }) {
8
- return (
9
- <Typography>
10
- RID {rid} (
11
- <ExternalLink href={`${baseUrl}?CMD=Get&RID=${rid}`}>
12
- see status
13
- </ExternalLink>
14
- )
15
- </Typography>
16
- )
17
- }
18
-
19
- export default RIDLink
@@ -1,143 +0,0 @@
1
- import { jsonfetch, textfetch } from './fetch'
2
- import { pollLoop } from './poll'
3
-
4
- import type { BlastResults } from './types'
5
- import type {
6
- BlastDatabase,
7
- BlastProgram,
8
- } from '../LaunchMsaView/components/NCBIBlastQuery/consts'
9
-
10
- export async function queryBlastFromRid({
11
- rid,
12
- baseUrl,
13
- onProgress,
14
- }: {
15
- rid: string
16
- baseUrl: string
17
- onProgress: (arg: string) => void
18
- }) {
19
- onProgress(`Checking BLAST status for RID: ${rid}...`)
20
- await waitForRid({
21
- rid,
22
- onProgress,
23
- baseUrl,
24
- })
25
- const ret = await jsonfetch<BlastResults>(
26
- `${baseUrl}?CMD=Get&RID=${rid}&FORMAT_TYPE=JSON2_S&FORMAT_OBJECT=Alignment`,
27
- )
28
- return {
29
- rid,
30
- hits: ret.BlastOutput2[0]?.report.results.search.hits ?? [],
31
- }
32
- }
33
-
34
- export async function queryBlast({
35
- query,
36
- blastDatabase,
37
- blastProgram,
38
- baseUrl,
39
- onProgress,
40
- onRid,
41
- }: {
42
- query: string
43
- blastDatabase: BlastDatabase
44
- blastProgram: BlastProgram
45
- baseUrl: string
46
- onProgress: (arg: string) => void
47
- onRid: (arg: string) => void
48
- }) {
49
- onProgress('Submitting to NCBI BLAST...')
50
- const { rid } = await initialQuery({
51
- query,
52
- blastDatabase,
53
- blastProgram,
54
- baseUrl,
55
- })
56
- onRid(rid)
57
- return queryBlastFromRid({ rid, baseUrl, onProgress })
58
- }
59
-
60
- async function initialQuery({
61
- query,
62
- blastProgram,
63
- blastDatabase,
64
- baseUrl,
65
- }: {
66
- query: string
67
- blastProgram: BlastProgram
68
- blastDatabase: BlastDatabase
69
- baseUrl: string
70
- }) {
71
- const res = await textfetch(baseUrl, {
72
- method: 'POST',
73
- body: new URLSearchParams({
74
- CMD: 'Put',
75
- PROGRAM: blastProgram === 'quick-blastp' ? 'blastp' : blastProgram,
76
- DATABASE: blastDatabase,
77
- QUERY: query,
78
- ...(blastDatabase === 'nr_cluster_seq'
79
- ? {
80
- CLUSTERED_DB: 'on',
81
- DB_TYPE: 'Experimental Databases',
82
- }
83
- : {}),
84
- ...(blastProgram === 'quick-blastp'
85
- ? { BLAST_PROGRAMS: 'kmerBlastp' }
86
- : {}),
87
- }),
88
- })
89
-
90
- // the initial submission/query to the BLAST "REST API" does not return JSON
91
- // as a response (e.g. FORMAT_TYPE=JSON does not work), so the RID is
92
- // literally parsed from the text of the HTML that is returned
93
- const rid = /^ {4}RID = (.*$)/m.exec(res)?.[1]
94
- const rtoe = /^ {4}RTOE = (.*$)/m.exec(res)?.[1]
95
-
96
- if (!rid) {
97
- throw new Error('Failed to get RID from BLAST request')
98
- }
99
- return {
100
- rid,
101
- rtoe,
102
- }
103
- }
104
-
105
- async function waitForRid({
106
- rid,
107
- onProgress,
108
- baseUrl,
109
- }: {
110
- rid: string
111
- onProgress: (arg: string) => void
112
- baseUrl: string
113
- }) {
114
- await pollLoop({
115
- intervalSeconds: 20,
116
- onCountdown: s => {
117
- onProgress(`Re-checking BLAST status in... ${s}`)
118
- },
119
- check: async () => {
120
- const res = await textfetch(
121
- `${baseUrl}?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=${rid}`,
122
- )
123
- const status = /\s+Status=(\S+)/m.exec(res)?.[1]
124
- const hasHits = /\s+ThereAreHits=yes/m.test(res)
125
-
126
- if (status === 'WAITING') {
127
- return false
128
- }
129
- if (status === 'FAILED') {
130
- throw new Error(`BLAST ${rid} failed`)
131
- }
132
- if (status === 'READY') {
133
- if (hasHits) {
134
- return true
135
- }
136
- throw new Error('No hits found')
137
- }
138
- throw new Error(
139
- `BLAST ${rid} returned unexpected status: ${status ?? 'unknown'}`,
140
- )
141
- },
142
- })
143
- }