jbrowse-plugin-msaview 2.0.2 → 2.0.4

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 (57) hide show
  1. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -1
  2. package/dist/AddHighlightModel/util.js +1 -1
  3. package/dist/AddHighlightModel/util.js.map +1 -1
  4. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +8 -3
  5. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  6. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js +12 -4
  7. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js.map +1 -1
  8. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js +1 -1
  9. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js.map +1 -1
  10. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js +50 -29
  11. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js.map +1 -1
  12. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +6 -2
  13. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  14. package/dist/LaunchMsaView/components/TabUtils.d.ts +1 -5
  15. package/dist/LaunchMsaView/components/TabUtils.js +1 -7
  16. package/dist/LaunchMsaView/components/TabUtils.js.map +1 -1
  17. package/dist/LaunchMsaView/components/tabUtil.d.ts +4 -0
  18. package/dist/LaunchMsaView/components/tabUtil.js +7 -0
  19. package/dist/LaunchMsaView/components/tabUtil.js.map +1 -0
  20. package/dist/LaunchMsaView/index.js +2 -3
  21. package/dist/LaunchMsaView/index.js.map +1 -1
  22. package/dist/LaunchMsaView/util.d.ts +1 -1
  23. package/dist/LaunchMsaView/util.js +1 -1
  24. package/dist/LaunchMsaView/util.js.map +1 -1
  25. package/dist/MsaViewPanel/components/LoadingBLAST.js +1 -1
  26. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  27. package/dist/MsaViewPanel/doLaunchBlast.js +17 -4
  28. package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -1
  29. package/dist/MsaViewPanel/model.d.ts +81 -29
  30. package/dist/MsaViewPanel/model.js +3 -1
  31. package/dist/MsaViewPanel/model.js.map +1 -1
  32. package/dist/MsaViewPanel/msaCoordToGenomeCoord.js +4 -4
  33. package/dist/MsaViewPanel/msaCoordToGenomeCoord.js.map +1 -1
  34. package/dist/jbrowse-plugin-msaview.umd.production.min.js +30 -30
  35. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  36. package/dist/utils/msa.js +4 -0
  37. package/dist/utils/msa.js.map +1 -1
  38. package/dist/utils/ncbiBlast.js +8 -5
  39. package/dist/utils/ncbiBlast.js.map +1 -1
  40. package/package.json +11 -11
  41. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +4 -2
  42. package/src/AddHighlightModel/util.ts +1 -1
  43. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +11 -3
  44. package/src/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.tsx +12 -4
  45. package/src/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.ts +2 -2
  46. package/src/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.ts +69 -34
  47. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +6 -2
  48. package/src/LaunchMsaView/components/TabUtils.tsx +1 -7
  49. package/src/LaunchMsaView/components/tabUtil.ts +6 -0
  50. package/src/LaunchMsaView/index.ts +36 -31
  51. package/src/LaunchMsaView/util.ts +2 -2
  52. package/src/MsaViewPanel/components/LoadingBLAST.tsx +2 -2
  53. package/src/MsaViewPanel/doLaunchBlast.ts +22 -4
  54. package/src/MsaViewPanel/model.ts +4 -2
  55. package/src/MsaViewPanel/msaCoordToGenomeCoord.ts +4 -4
  56. package/src/utils/msa.ts +3 -0
  57. package/src/utils/ncbiBlast.ts +22 -10
package/src/utils/msa.ts CHANGED
@@ -98,6 +98,7 @@ async function wait({
98
98
  algorithm: string
99
99
  onProgress: (arg: string) => void
100
100
  }) {
101
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
101
102
  while (true) {
102
103
  for (let i = 0; i < 10; i++) {
103
104
  await timeout(1000)
@@ -107,6 +108,8 @@ async function wait({
107
108
 
108
109
  if (result === 'FINISHED') {
109
110
  break
111
+ } else if (result.includes('FAILURE')) {
112
+ throw new Error(`Failed to run: jobId ${jobId}`)
110
113
  }
111
114
  }
112
115
  }
@@ -23,15 +23,26 @@ export async function queryBlast({
23
23
  })
24
24
  onRid(rid)
25
25
  await waitForRid({ rid, onProgress })
26
- const ret = await jsonfetch(
26
+ const ret = (await jsonfetch(
27
27
  `${BLAST_URL}?CMD=Get&RID=${rid}&FORMAT_TYPE=JSON2_S&FORMAT_OBJECT=Alignment`,
28
- )
29
- const hits = ret.BlastOutput2[0].report.results.search.hits as {
30
- description: { accession: string; id: string; sciname: string }[]
31
- hsps: { hseq: string }[]
32
- }[]
33
-
34
- return { rid, hits }
28
+ )) as {
29
+ BlastOutput2: {
30
+ report: {
31
+ results: {
32
+ search: {
33
+ hits: {
34
+ description: { accession: string; id: string; sciname: string }[]
35
+ hsps: { hseq: string }[]
36
+ }[]
37
+ }
38
+ }
39
+ }
40
+ }[]
41
+ }
42
+ return {
43
+ rid,
44
+ hits: ret.BlastOutput2[0]?.report.results.search.hits ?? [],
45
+ }
35
46
  }
36
47
 
37
48
  async function initialQuery({
@@ -62,8 +73,8 @@ async function initialQuery({
62
73
  // the initial submission/query to the BLAST "REST API" does not return JSON
63
74
  // as a response (e.g. FORMAT_TYPE=JSON does not work), so the RID is
64
75
  // literally parsed from the text of the HTML that is returned
65
- const rid = res.match(/^ RID = (.*$)/m)?.[1]
66
- const rtoe = res.match(/^ RTOE = (.*$)/m)?.[1]
76
+ const rid = /^ {4}RID = (.*$)/m.exec(res)?.[1]
77
+ const rtoe = /^ {4}RTOE = (.*$)/m.exec(res)?.[1]
67
78
 
68
79
  if (!rid) {
69
80
  throw new Error('Failed to get RID from BLAST request')
@@ -78,6 +89,7 @@ async function waitForRid({
78
89
  rid: string
79
90
  onProgress: (arg: string) => void
80
91
  }) {
92
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
81
93
  while (true) {
82
94
  const iter = 20
83
95
  for (let i = 0; i < iter; i++) {