jbrowse-plugin-msaview 2.0.6 → 2.2.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 (181) 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/{NewNCBIBlastQuery/NcbiBlastPanel.d.ts → EnsemblGeneTree/EnsemblGeneTree.d.ts} +2 -2
  9. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +76 -0
  10. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +1 -0
  11. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.d.ts +13 -0
  12. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js +12 -0
  13. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js.map +1 -0
  14. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.d.ts +6 -0
  15. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js +25 -0
  16. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +1 -0
  17. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.d.ts +2 -0
  18. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js +20 -0
  19. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js.map +1 -0
  20. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.d.ts +24 -0
  21. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js +2 -0
  22. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js.map +1 -0
  23. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.d.ts +10 -0
  24. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js +27 -0
  25. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js.map +1 -0
  26. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.d.ts +4 -0
  27. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js +38 -0
  28. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js.map +1 -0
  29. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +22 -16
  30. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  31. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.d.ts +8 -0
  32. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +103 -0
  33. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -0
  34. package/dist/LaunchMsaView/components/ManualMSALoader/fetchGeneList.d.ts +1 -0
  35. package/dist/LaunchMsaView/components/ManualMSALoader/fetchGeneList.js +12 -0
  36. package/dist/LaunchMsaView/components/ManualMSALoader/fetchGeneList.js.map +1 -0
  37. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.d.ts +14 -0
  38. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js +12 -0
  39. package/dist/LaunchMsaView/components/ManualMSALoader/launchView.js.map +1 -0
  40. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.d.ts +10 -0
  41. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +89 -0
  42. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -0
  43. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.d.ts +10 -0
  44. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +55 -0
  45. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -0
  46. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.d.ts +5 -0
  47. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js +11 -0
  48. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js.map +1 -0
  49. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.d.ts +7 -0
  50. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +30 -0
  51. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -0
  52. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.d.ts +5 -0
  53. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +26 -0
  54. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +1 -0
  55. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.d.ts → NCBIBlastQuery/blastLaunchView.d.ts} +2 -1
  56. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.js → NCBIBlastQuery/blastLaunchView.js} +3 -6
  57. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -0
  58. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +1 -0
  59. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +2 -0
  60. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -0
  61. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +18 -19
  62. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  63. package/dist/LaunchMsaView/components/TabPanel.d.ts +6 -0
  64. package/dist/LaunchMsaView/components/TabPanel.js +6 -0
  65. package/dist/LaunchMsaView/components/TabPanel.js.map +1 -0
  66. package/dist/LaunchMsaView/components/TranscriptSelector.d.ts +10 -0
  67. package/dist/LaunchMsaView/components/TranscriptSelector.js +45 -0
  68. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -0
  69. package/dist/LaunchMsaView/components/calculateProteinSequence.d.ts +17 -0
  70. package/dist/LaunchMsaView/components/calculateProteinSequence.js +39 -0
  71. package/dist/LaunchMsaView/components/calculateProteinSequence.js.map +1 -0
  72. package/dist/LaunchMsaView/components/fetchSeq.d.ts +8 -0
  73. package/dist/LaunchMsaView/components/fetchSeq.js +23 -0
  74. package/dist/LaunchMsaView/components/fetchSeq.js.map +1 -0
  75. package/dist/LaunchMsaView/components/types.d.ts +10 -0
  76. package/dist/LaunchMsaView/components/types.js +2 -0
  77. package/dist/LaunchMsaView/components/types.js.map +1 -0
  78. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.d.ts → useFeatureSequence.d.ts} +3 -6
  79. package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.js → useFeatureSequence.js} +13 -23
  80. package/dist/LaunchMsaView/components/useFeatureSequence.js.map +1 -0
  81. package/dist/LaunchMsaView/components/util.js.map +1 -0
  82. package/dist/LaunchMsaView/util.d.ts +5 -1
  83. package/dist/LaunchMsaView/util.js +15 -1
  84. package/dist/LaunchMsaView/util.js.map +1 -1
  85. package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +2 -1
  86. package/dist/MsaViewPanel/components/LoadingBLAST.js +6 -6
  87. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  88. package/dist/MsaViewPanel/components/MsaViewPanel.js +1 -1
  89. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  90. package/dist/MsaViewPanel/components/RIDLink.d.ts +2 -1
  91. package/dist/MsaViewPanel/components/RIDLink.js +6 -9
  92. package/dist/MsaViewPanel/components/RIDLink.js.map +1 -1
  93. package/dist/MsaViewPanel/doLaunchBlast.js +18 -20
  94. package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -1
  95. package/dist/MsaViewPanel/model.d.ts +15 -12
  96. package/dist/MsaViewPanel/model.js.map +1 -1
  97. package/dist/ReadOnlyTextField2.d.ts +4 -0
  98. package/dist/ReadOnlyTextField2.js +20 -0
  99. package/dist/ReadOnlyTextField2.js.map +1 -0
  100. package/dist/index.d.ts +15 -0
  101. package/dist/index.js +17 -0
  102. package/dist/index.js.map +1 -1
  103. package/dist/jbrowse-plugin-msaview.umd.production.min.js +33 -31
  104. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  105. package/dist/utils/fetch.d.ts +1 -1
  106. package/dist/utils/fetch.js.map +1 -1
  107. package/dist/utils/ncbiBlast.d.ts +2 -2
  108. package/dist/utils/ncbiBlast.js +29 -15
  109. package/dist/utils/ncbiBlast.js.map +1 -1
  110. package/dist/utils/types.d.ts +20 -0
  111. package/dist/utils/types.js +2 -0
  112. package/dist/utils/types.js.map +1 -0
  113. package/package.json +3 -3
  114. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +3 -3
  115. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +2 -1
  116. package/src/ExternalLink.tsx +15 -0
  117. package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +127 -0
  118. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.ts +30 -0
  119. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +46 -0
  120. package/src/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.ts +22 -0
  121. package/src/LaunchMsaView/components/EnsemblGeneTree/types.ts +28 -0
  122. package/src/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.ts +29 -0
  123. package/src/LaunchMsaView/components/EnsemblGeneTree/util.ts +45 -0
  124. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +36 -21
  125. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +219 -0
  126. package/src/LaunchMsaView/components/ManualMSALoader/fetchGeneList.ts +13 -0
  127. package/src/LaunchMsaView/components/ManualMSALoader/launchView.ts +34 -0
  128. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +226 -0
  129. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +111 -0
  130. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.tsx +34 -0
  131. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +82 -0
  132. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.tsx +75 -0
  133. package/src/LaunchMsaView/components/{NewNCBIBlastQuery/ncbiBlastLaunchView.ts → NCBIBlastQuery/blastLaunchView.ts} +4 -5
  134. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +1 -0
  135. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +28 -44
  136. package/src/LaunchMsaView/components/TabPanel.tsx +19 -0
  137. package/src/LaunchMsaView/components/TranscriptSelector.tsx +99 -0
  138. package/src/LaunchMsaView/components/calculateProteinSequence.ts +68 -0
  139. package/src/LaunchMsaView/components/fetchSeq.ts +37 -0
  140. package/src/LaunchMsaView/components/types.ts +11 -0
  141. package/src/LaunchMsaView/components/{NewNCBIBlastQuery/useFeatureSequence.ts → useFeatureSequence.ts} +20 -42
  142. package/src/LaunchMsaView/util.ts +22 -2
  143. package/src/MsaViewPanel/components/LoadingBLAST.tsx +26 -8
  144. package/src/MsaViewPanel/components/MsaViewPanel.tsx +5 -1
  145. package/src/MsaViewPanel/components/RIDLink.tsx +8 -8
  146. package/src/MsaViewPanel/doLaunchBlast.ts +29 -30
  147. package/src/MsaViewPanel/model.ts +1 -0
  148. package/src/ReadOnlyTextField2.tsx +33 -0
  149. package/src/index.ts +23 -0
  150. package/src/utils/fetch.ts +2 -2
  151. package/src/utils/ncbiBlast.ts +40 -30
  152. package/src/utils/types.ts +14 -0
  153. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js +0 -85
  154. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js.map +0 -1
  155. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.d.ts +0 -26
  156. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js +0 -48
  157. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js.map +0 -1
  158. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.d.ts +0 -1
  159. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js +0 -2
  160. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js.map +0 -1
  161. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.js.map +0 -1
  162. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js.map +0 -1
  163. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/util.js.map +0 -1
  164. package/dist/LaunchMsaView/components/TabUtils.d.ts +0 -8
  165. package/dist/LaunchMsaView/components/TabUtils.js +0 -7
  166. package/dist/LaunchMsaView/components/TabUtils.js.map +0 -1
  167. package/dist/LaunchMsaView/components/tabUtil.d.ts +0 -4
  168. package/dist/LaunchMsaView/components/tabUtil.js +0 -7
  169. package/dist/LaunchMsaView/components/tabUtil.js.map +0 -1
  170. package/dist/OpenInNewIcon.d.ts +0 -3
  171. package/dist/OpenInNewIcon.js +0 -8
  172. package/dist/OpenInNewIcon.js.map +0 -1
  173. package/src/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.tsx +0 -171
  174. package/src/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.ts +0 -92
  175. package/src/LaunchMsaView/components/NewNCBIBlastQuery/index.tsx +0 -1
  176. package/src/LaunchMsaView/components/TabUtils.tsx +0 -25
  177. package/src/LaunchMsaView/components/tabUtil.ts +0 -6
  178. package/src/OpenInNewIcon.tsx +0 -14
  179. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/util.d.ts → util.d.ts} +0 -0
  180. /package/dist/LaunchMsaView/components/{NewNCBIBlastQuery/util.js → util.js} +0 -0
  181. /package/src/LaunchMsaView/components/{NewNCBIBlastQuery/util.ts → util.ts} +0 -0
@@ -1,4 +1,4 @@
1
1
  export declare function myfetch(url: string, args?: RequestInit): Promise<Response>;
2
2
  export declare function textfetch(url: string, args?: RequestInit): Promise<string>;
3
- export declare function jsonfetch(url: string, args?: RequestInit): Promise<any>;
3
+ export declare function jsonfetch<T>(url: string, args?: RequestInit): Promise<T>;
4
4
  export declare function timeout(time: number): Promise<unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,IAAkB;IAC3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAEvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,QAAQ,QAAQ,CAAC,MAAM,aAAa,GAAG,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,CACnE,CAAA;IACH,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,IAAkB;IAC7D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACzC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,IAAkB;IAC7D,MAAM,QAAQ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+1,8 @@
1
- export declare const BLAST_URL = "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi";
2
- export declare function queryBlast({ query, blastDatabase, blastProgram, onProgress, onRid, }: {
1
+ export declare function queryBlast({ query, blastDatabase, blastProgram, baseUrl, onProgress, onRid, }: {
3
2
  query: string;
4
3
  blastDatabase: string;
5
4
  blastProgram: string;
5
+ baseUrl: string;
6
6
  onProgress: (arg: string) => void;
7
7
  onRid: (arg: string) => void;
8
8
  }): Promise<{
@@ -1,26 +1,30 @@
1
1
  import { jsonfetch, textfetch, timeout } from './fetch';
2
- export const BLAST_URL = `https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi`;
3
- export async function queryBlast({ query, blastDatabase, blastProgram, onProgress, onRid, }) {
2
+ export async function queryBlast({ query, blastDatabase, blastProgram, baseUrl, onProgress, onRid, }) {
4
3
  onProgress('Submitting to NCBI BLAST...');
5
4
  const { rid } = await initialQuery({
6
5
  query,
7
6
  blastDatabase,
8
7
  blastProgram,
8
+ baseUrl,
9
9
  });
10
10
  onRid(rid);
11
- await waitForRid({ rid, onProgress });
12
- const ret = (await jsonfetch(`${BLAST_URL}?CMD=Get&RID=${rid}&FORMAT_TYPE=JSON2_S&FORMAT_OBJECT=Alignment`));
11
+ await waitForRid({
12
+ rid,
13
+ onProgress,
14
+ baseUrl,
15
+ });
16
+ const ret = await jsonfetch(`${baseUrl}?CMD=Get&RID=${rid}&FORMAT_TYPE=JSON2_S&FORMAT_OBJECT=Alignment`);
13
17
  return {
14
18
  rid,
15
19
  hits: ret.BlastOutput2[0]?.report.results.search.hits ?? [],
16
20
  };
17
21
  }
18
- async function initialQuery({ query, blastProgram, blastDatabase, }) {
19
- const res = await textfetch(BLAST_URL, {
22
+ async function initialQuery({ query, blastProgram, blastDatabase, baseUrl, }) {
23
+ const res = await textfetch(baseUrl, {
20
24
  method: 'POST',
21
25
  body: new URLSearchParams({
22
26
  CMD: 'Put',
23
- PROGRAM: blastProgram,
27
+ PROGRAM: blastProgram === 'quick-blastp' ? 'blastp' : blastProgram,
24
28
  DATABASE: blastDatabase,
25
29
  QUERY: query,
26
30
  ...(blastDatabase === 'nr_clustered_seq'
@@ -29,6 +33,9 @@ async function initialQuery({ query, blastProgram, blastDatabase, }) {
29
33
  DB_TYPE: 'Experimental Databases',
30
34
  }
31
35
  : {}),
36
+ ...(blastProgram === 'quick-blastp'
37
+ ? { BLAST_PROGRAMS: 'kmerBlastp' }
38
+ : {}),
32
39
  }),
33
40
  });
34
41
  // the initial submission/query to the BLAST "REST API" does not return JSON
@@ -39,9 +46,12 @@ async function initialQuery({ query, blastProgram, blastDatabase, }) {
39
46
  if (!rid) {
40
47
  throw new Error('Failed to get RID from BLAST request');
41
48
  }
42
- return { rid, rtoe };
49
+ return {
50
+ rid,
51
+ rtoe,
52
+ };
43
53
  }
44
- async function waitForRid({ rid, onProgress, }) {
54
+ async function waitForRid({ rid, onProgress, baseUrl, }) {
45
55
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
46
56
  while (true) {
47
57
  const iter = 20;
@@ -49,15 +59,19 @@ async function waitForRid({ rid, onProgress, }) {
49
59
  await timeout(1000);
50
60
  onProgress(`Re-checking BLAST status in... ${iter - i}`);
51
61
  }
52
- const res = await textfetch(`${BLAST_URL}?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=${rid}`);
53
- if (/\s+Status=WAITING/m.test(res)) {
62
+ const res = await textfetch(`${baseUrl}?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=${rid}`);
63
+ const isWaiting = /\s+Status=WAITING/m.test(res);
64
+ const isFailed = /\s+Status=FAILED/m.test(res);
65
+ const isReady = /\s+Status=READY/m.test(res);
66
+ const hasHits = /\s+ThereAreHits=yes/m.test(res);
67
+ if (isWaiting) {
54
68
  continue;
55
69
  }
56
- else if (/\s+Status=FAILED/m.test(res)) {
57
- throw new Error(`BLAST ${rid} failed; please report to blast-help@ncbi.nlm.nih.gov`);
70
+ if (isFailed) {
71
+ throw new Error(`BLAST ${rid} failed`);
58
72
  }
59
- else if (/\s+Status=READY/m.test(res)) {
60
- if (/\s+ThereAreHits=yes/m.test(res)) {
73
+ if (isReady) {
74
+ if (hasHits) {
61
75
  return true;
62
76
  }
63
77
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"ncbiBlast.js","sourceRoot":"","sources":["../../src/utils/ncbiBlast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,gDAAgD,CAAA;AAEzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAC/B,KAAK,EACL,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,GAON;IACC,UAAU,CAAC,6BAA6B,CAAC,CAAA;IACzC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,YAAY,CAAC;QACjC,KAAK;QACL,aAAa;QACb,YAAY;KACb,CAAC,CAAA;IACF,KAAK,CAAC,GAAG,CAAC,CAAA;IACV,MAAM,UAAU,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAA;IACrC,MAAM,GAAG,GAAG,CAAC,MAAM,SAAS,CAC1B,GAAG,SAAS,gBAAgB,GAAG,8CAA8C,CAC9E,CAaA,CAAA;IACD,OAAO;QACL,GAAG;QACH,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;KAC5D,CAAA;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,aAAa,GAKd;IACC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,SAAS,EAAE;QACrC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,eAAe,CAAC;YACxB,GAAG,EAAE,KAAK;YACV,OAAO,EAAE,YAAY;YACrB,QAAQ,EAAE,aAAa;YACvB,KAA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,CACzB,GAAG,OAAO,yCAAyC,GAAG,EAAE,CACzD,CAAA;QACD,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAChD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC9C,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC5C,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEhD,IAAI,SAAS,EAAE,CAAC;YACd,SAAQ;QACV,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;QACxC,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAA;YACb,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ export interface BlastResults {
2
+ BlastOutput2: {
3
+ report: {
4
+ results: {
5
+ search: {
6
+ hits: {
7
+ description: {
8
+ accession: string;
9
+ id: string;
10
+ sciname: string;
11
+ }[];
12
+ hsps: {
13
+ hseq: string;
14
+ }[];
15
+ }[];
16
+ };
17
+ };
18
+ };
19
+ }[];
20
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.6",
2
+ "version": "2.2.0",
3
3
  "license": "MIT",
4
4
  "name": "jbrowse-plugin-msaview",
5
5
  "keywords": [
@@ -52,10 +52,10 @@
52
52
  "@mui/x-data-grid": "^8.2.0",
53
53
  "@types/node": "^22.10.7",
54
54
  "@types/pako": "^2.0.1",
55
- "@types/react": "^19.0.7",
55
+ "@types/react": "^19.1.6",
56
56
  "@typescript-eslint/eslint-plugin": "^8.0.1",
57
57
  "@typescript-eslint/parser": "^8.0.1",
58
- "esbuild": "^0.25.4",
58
+ "esbuild": "^0.25.5",
59
59
  "eslint": "^9.0.0",
60
60
  "eslint-plugin-import": "^2.31.0",
61
61
  "eslint-plugin-react": "^7.20.3",
@@ -7,7 +7,7 @@ import { useStyles } from './util'
7
7
 
8
8
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
9
9
 
10
- const GenomeMouseoverHighlight = observer(function GenomeMouseoverHighlight2({
10
+ const GenomeMouseoverHighlight = observer(function ({
11
11
  model,
12
12
  }: {
13
13
  model: LinearGenomeViewModel
@@ -16,11 +16,11 @@ const GenomeMouseoverHighlight = observer(function GenomeMouseoverHighlight2({
16
16
  return hovered &&
17
17
  typeof hovered === 'object' &&
18
18
  'hoverPosition' in hovered ? (
19
- <HoverHighlight model={model} />
19
+ <GenomeMouseoverHighlightPostNullCheck model={model} />
20
20
  ) : null
21
21
  })
22
22
 
23
- const HoverHighlight = observer(function HoverHighlight2({
23
+ const GenomeMouseoverHighlightPostNullCheck = observer(function ({
24
24
  model,
25
25
  }: {
26
26
  model: LinearGenomeViewModel
@@ -42,8 +42,9 @@ const MsaToGenomeHighlight = observer(function MsaToGenomeHighlight2({
42
42
  style={{ left, width }}
43
43
  />
44
44
  )
45
+ } else {
46
+ return null
45
47
  }
46
- return null
47
48
  })}
48
49
  </>
49
50
  ) : null
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+
3
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew'
4
+ import { Link } from '@mui/material'
5
+
6
+ import type { LinkProps } from '@mui/material'
7
+
8
+ export default function ExternalLink(props: LinkProps) {
9
+ const { children, ...rest } = props
10
+ return (
11
+ <Link {...rest} target="_blank" rel="noreferrer">
12
+ {children} <OpenInNewIcon fontSize="small" />
13
+ </Link>
14
+ )
15
+ }
@@ -0,0 +1,127 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui'
4
+ import {
5
+ AbstractTrackModel,
6
+ Feature,
7
+ getContainingView,
8
+ getSession,
9
+ } from '@jbrowse/core/util'
10
+ import { Button, DialogActions, DialogContent, Link } from '@mui/material'
11
+ import { observer } from 'mobx-react'
12
+ import { makeStyles } from 'tss-react/mui'
13
+
14
+ import { ensemblGeneTreeLaunchView } from './ensemblGeneTreeLaunchView'
15
+ import { useGeneTree } from './useGeneTree'
16
+ import { getGeneDisplayName, getId, getTranscriptFeatures } from '../../util'
17
+ import TranscriptSelector from '../TranscriptSelector'
18
+ import { useFeatureSequence } from '../useFeatureSequence'
19
+
20
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
21
+
22
+
23
+ const useStyles = makeStyles()({
24
+ dialogContent: {
25
+ width: '80em',
26
+ display: 'flex',
27
+ flexDirection: 'column',
28
+ gap: 16,
29
+ },
30
+ })
31
+
32
+ const EnsemblGeneTree = observer(function ({
33
+ model,
34
+ feature,
35
+ handleClose,
36
+ }: {
37
+ model: AbstractTrackModel
38
+ feature: Feature
39
+ handleClose: () => void
40
+ }) {
41
+ const session = getSession(model)
42
+ const view = getContainingView(model) as LinearGenomeViewModel
43
+ const { classes } = useStyles()
44
+ const [launchViewError, setLaunchViewError] = useState<unknown>()
45
+ const options = getTranscriptFeatures(feature)
46
+ const [userSelection, setUserSelection] = useState(getId(options[0]))
47
+ const { treeData, isTreeLoading, treeError } = useGeneTree(userSelection)
48
+ const selectedTranscript = options.find(val => getId(val) === userSelection)!
49
+
50
+ const { proteinSequence, error: featureSequenceError } = useFeatureSequence({
51
+ view,
52
+ feature: selectedTranscript,
53
+ })
54
+
55
+ const loadingMessage = isTreeLoading
56
+ ? 'Loading tree data from Ensembl GeneTree'
57
+ : undefined
58
+ const e = treeError ?? launchViewError ?? featureSequenceError
59
+
60
+ return (
61
+ <>
62
+ <DialogContent className={classes.dialogContent}>
63
+ {e ? <ErrorMessage error={e} /> : null}
64
+ {loadingMessage ? <LoadingEllipses message={loadingMessage} /> : null}
65
+ {treeData ? (
66
+ <div>
67
+ <div>Found Ensembl Compara GeneTree: {treeData.geneTreeId}</div>
68
+ <Link
69
+ target="_blank"
70
+ href={`https://useast.ensembl.org/Multi/GeneTree/Image?gt=${treeData.geneTreeId}`}
71
+ >
72
+ See {treeData.geneTreeId} at Ensembl
73
+ </Link>
74
+ </div>
75
+ ) : null}
76
+
77
+ <TranscriptSelector
78
+ feature={feature}
79
+ options={options}
80
+ selectedTranscriptId={userSelection}
81
+ onTranscriptChange={setUserSelection}
82
+ proteinSequence={proteinSequence}
83
+ />
84
+ </DialogContent>
85
+
86
+ <DialogActions>
87
+ <Button
88
+ color="primary"
89
+ variant="contained"
90
+ onClick={() => {
91
+ try {
92
+ if (!treeData) {
93
+ return
94
+ }
95
+ setLaunchViewError(undefined)
96
+
97
+ ensemblGeneTreeLaunchView({
98
+ feature,
99
+ view,
100
+ session,
101
+ newViewTitle: getGeneDisplayName(feature),
102
+ data: treeData,
103
+ })
104
+ handleClose()
105
+ } catch (e) {
106
+ console.error(e)
107
+ setLaunchViewError(e)
108
+ }
109
+ }}
110
+ >
111
+ Submit
112
+ </Button>
113
+ <Button
114
+ color="secondary"
115
+ variant="contained"
116
+ onClick={() => {
117
+ handleClose()
118
+ }}
119
+ >
120
+ Cancel
121
+ </Button>
122
+ </DialogActions>
123
+ </>
124
+ )
125
+ })
126
+
127
+ export default EnsemblGeneTree
@@ -0,0 +1,30 @@
1
+ import type { AbstractSessionModel, Feature } from '@jbrowse/core/util'
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
3
+
4
+ export function ensemblGeneTreeLaunchView({
5
+ session,
6
+ newViewTitle,
7
+ view,
8
+ feature,
9
+ data,
10
+ }: {
11
+ session: AbstractSessionModel
12
+ newViewTitle: string
13
+ view: LinearGenomeViewModel
14
+ feature: Feature
15
+ data: {
16
+ tree: string
17
+ msa: string
18
+ treeMetadata: string
19
+ }
20
+ }) {
21
+ session.addView('MsaView', {
22
+ type: 'MsaView',
23
+ displayName: newViewTitle,
24
+ colWidth: 10,
25
+ rowHeight: 12,
26
+ data,
27
+ connectedViewId: view.id,
28
+ connectedFeature: feature.toJSON(),
29
+ })
30
+ }
@@ -0,0 +1,46 @@
1
+ import { gatherSequencesFromTree } from './gatherSequencesFromTree'
2
+ import { TreeNode } from './types'
3
+ import { fetchWithLocalStorageCache, jsonfetch, textfetch } from './util'
4
+
5
+ const base = 'https://rest.ensembl.org'
6
+
7
+ export async function geneTreeFetcher(id2: string) {
8
+ const id = id2.replace(/\..*/, '')
9
+ const { species } = await fetchWithLocalStorageCache(`${id}-ensembl`, () =>
10
+ jsonfetch<{ species: string }>(
11
+ `${base}/lookup/id/${id}?content-type=application/json`,
12
+ ),
13
+ )
14
+ const treeBase = `${base}/genetree/member/id/${species}/${id}`
15
+ const geneTreeResult = await fetchWithLocalStorageCache(`${id}-msa`, () =>
16
+ jsonfetch<{ tree: TreeNode; id: string }>(
17
+ `${treeBase}?content-type=application/json;aligned=1;sequence=pep`,
18
+ ),
19
+ )
20
+
21
+ // we query again to get newick format tree. could probably extract from json
22
+ // as alternative
23
+ const tree = await fetchWithLocalStorageCache<string>(`${id}-tree`, () =>
24
+ textfetch(`${treeBase}?nh_format=simple;content-type=text/x-nh`),
25
+ )
26
+
27
+ const res = gatherSequencesFromTree(geneTreeResult.tree)
28
+ return {
29
+ geneTreeId: geneTreeResult.id,
30
+ tree,
31
+ msa: res.map(r => `>${r.id}\n${r.seq}`).join('\n'),
32
+ treeMetadata: JSON.stringify(
33
+ Object.fromEntries(
34
+ res.map(
35
+ r =>
36
+ [
37
+ r.id,
38
+ {
39
+ genome: r.species,
40
+ },
41
+ ] as const,
42
+ ),
43
+ ),
44
+ ),
45
+ }
46
+ }
@@ -0,0 +1,22 @@
1
+ import type { TreeNode, TreeRow } from './types'
2
+
3
+ export function gatherSequencesFromTree(tree: TreeNode, arr: TreeRow[] = []) {
4
+ if (tree.children) {
5
+ for (const child of tree.children) {
6
+ if (child.sequence) {
7
+ const id = child.sequence.id[0]?.accession
8
+ if (id) {
9
+ arr.push({
10
+ id,
11
+ seq: child.sequence.mol_seq.seq,
12
+ species:
13
+ child.taxonomy.common_name || child.taxonomy.scientific_name,
14
+ genomicLocString: child.sequence.mol_seq.location,
15
+ })
16
+ }
17
+ }
18
+ gatherSequencesFromTree(child, arr)
19
+ }
20
+ }
21
+ return arr
22
+ }
@@ -0,0 +1,28 @@
1
+ export interface TreeNodeSequence {
2
+ mol_seq: {
3
+ seq: string
4
+ location?: string
5
+ }
6
+ id: {
7
+ accession: string
8
+ }[]
9
+ }
10
+
11
+ export interface TreeNodeTaxonomy {
12
+ common_name: string
13
+ scientific_name: string
14
+ }
15
+
16
+ // This is a self-referential tree data structure
17
+ export interface TreeNode {
18
+ children?: TreeNode[]
19
+ sequence?: TreeNodeSequence
20
+ taxonomy: TreeNodeTaxonomy
21
+ }
22
+
23
+ export interface TreeRow {
24
+ id: string
25
+ seq: string
26
+ species: string
27
+ genomicLocString?: string
28
+ }
@@ -0,0 +1,29 @@
1
+ import { useEffect, useState } from 'react'
2
+
3
+ import { geneTreeFetcher } from './ensemblGeneTreeUtils'
4
+
5
+ type Ret = Awaited<ReturnType<typeof geneTreeFetcher>>
6
+
7
+ export function useGeneTree(geneId: string) {
8
+ const [treeData, setTreeData] = useState<Ret>()
9
+ const [isTreeLoading, setIsTreeLoading] = useState(false)
10
+ const [treeError, setTreeError] = useState<unknown>()
11
+
12
+ useEffect(() => {
13
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
14
+ ;(async () => {
15
+ try {
16
+ setIsTreeLoading(true)
17
+ const result = await geneTreeFetcher(geneId)
18
+ setTreeData(result)
19
+ } catch (e) {
20
+ console.error(e)
21
+ setTreeError(e)
22
+ } finally {
23
+ setIsTreeLoading(false)
24
+ }
25
+ })()
26
+ }, [geneId])
27
+
28
+ return { treeData, isTreeLoading, treeError }
29
+ }
@@ -0,0 +1,45 @@
1
+ import { ungzip } from 'pako'
2
+
3
+ export async function jsonfetch<T>(url: string, arg?: RequestInit) {
4
+ const res = await fetch(url, arg)
5
+ if (!res.ok) {
6
+ throw new Error(`HTTP ${res.status} from ${url}: ${await res.text()}`)
7
+ }
8
+ return res.json() as Promise<T>
9
+ }
10
+
11
+ export async function textfetch(url: string, arg?: RequestInit) {
12
+ const res = await fetch(url, arg)
13
+ if (!res.ok) {
14
+ throw new Error(`HTTP ${res.status} from ${url}`)
15
+ }
16
+ return res.text()
17
+ }
18
+
19
+ export async function fetchWithLocalStorageCache<T>(
20
+ key: string,
21
+ fetchFn: () => Promise<T>,
22
+ ): Promise<T> {
23
+ const cachedData = localStorage.getItem(key)
24
+
25
+ if (cachedData) {
26
+ try {
27
+ return JSON.parse(cachedData) as T
28
+ } catch (error) {
29
+ console.error(`Error parsing cached data for ${key}:`, error)
30
+ // Continue to fetch fresh data if parsing fails
31
+ }
32
+ }
33
+
34
+ const data = await fetchFn()
35
+ localStorage.setItem(key, JSON.stringify(data))
36
+ return data
37
+ }
38
+
39
+ export async function unzipfetch(url: string, arg?: RequestInit) {
40
+ const res = await fetch(url, arg)
41
+ if (!res.ok) {
42
+ throw new Error(`HTTP ${res.status} from ${url}: ${await res.text()}`)
43
+ }
44
+ return ungzip(await res.arrayBuffer(), { to: 'string' })
45
+ }
@@ -2,12 +2,13 @@ import React, { useState } from 'react'
2
2
 
3
3
  import { Dialog } from '@jbrowse/core/ui'
4
4
  import { AbstractTrackModel, Feature } from '@jbrowse/core/util'
5
- import { Box, Tab, Tabs } from '@mui/material'
5
+ import { Tab, Tabs } from '@mui/material'
6
6
 
7
- import NewNcbiBlastQueryPanel from './NewNCBIBlastQuery'
7
+ import EnsemblGeneTree from './EnsemblGeneTree/EnsemblGeneTree'
8
+ import ManualMSALoader from './ManualMSALoader/ManualMSALoader'
9
+ import NCBIBlastPanel from './NCBIBlastQuery/NCBIBlastPanel'
8
10
  import PreLoadedMSA from './PreLoadedMSA/PreLoadedMSADataPanel'
9
- import CustomTabPanel from './TabUtils'
10
- import { a11yProps } from './tabUtil'
11
+ import TabPanel from './TabPanel'
11
12
 
12
13
  export default function LaunchProteinViewDialog({
13
14
  handleClose,
@@ -24,36 +25,50 @@ export default function LaunchProteinViewDialog({
24
25
  <Dialog
25
26
  maxWidth="xl"
26
27
  title="Launch MSA view"
28
+ open
27
29
  onClose={() => {
28
30
  handleClose()
29
31
  }}
30
- open
31
32
  >
32
- <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
33
- <Tabs
34
- value={value}
35
- onChange={(_, val) => {
36
- setValue(val)
37
- }}
38
- >
39
- <Tab label="NCBI BLAST query" {...a11yProps(0)} />
40
- <Tab label="UCSC 100-way dataset" {...a11yProps(1)} />
41
- </Tabs>
42
- </Box>
43
- <CustomTabPanel value={value} index={0}>
44
- <NewNcbiBlastQueryPanel
33
+ <Tabs
34
+ value={value}
35
+ onChange={(_, val) => {
36
+ setValue(val)
37
+ }}
38
+ >
39
+ <Tab label="NCBI BLAST query" value={0} />
40
+ <Tab label="UCSC 100-way dataset" value={1} />
41
+ <Tab label="Ensembl GeneTree" value={2} />
42
+ <Tab label="Manually open MSA/tree" value={3} />
43
+ </Tabs>
44
+ <TabPanel value={value} index={0}>
45
+ <NCBIBlastPanel
45
46
  handleClose={handleClose}
46
47
  feature={feature}
47
48
  model={model}
48
49
  />
49
- </CustomTabPanel>
50
- <CustomTabPanel value={value} index={1}>
50
+ </TabPanel>
51
+ <TabPanel value={value} index={1}>
51
52
  <PreLoadedMSA
52
53
  model={model}
53
54
  feature={feature}
54
55
  handleClose={handleClose}
55
56
  />
56
- </CustomTabPanel>
57
+ </TabPanel>
58
+ <TabPanel value={value} index={2}>
59
+ <EnsemblGeneTree
60
+ model={model}
61
+ feature={feature}
62
+ handleClose={handleClose}
63
+ />
64
+ </TabPanel>
65
+ <TabPanel value={value} index={3}>
66
+ <ManualMSALoader
67
+ model={model}
68
+ feature={feature}
69
+ handleClose={handleClose}
70
+ />
71
+ </TabPanel>
57
72
  </Dialog>
58
73
  )
59
74
  }