jbrowse-plugin-msaview 1.0.18 → 2.0.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 (147) hide show
  1. package/CHANGELOG.md +6 -4
  2. package/README.md +6 -4
  3. package/dist/AddHighlightModel/GenomeMouseoverHighlight.d.ts +6 -0
  4. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +30 -0
  5. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -0
  6. package/dist/AddHighlightModel/HighlightComponents.d.ts +7 -0
  7. package/dist/AddHighlightModel/HighlightComponents.js +12 -0
  8. package/dist/AddHighlightModel/HighlightComponents.js.map +1 -0
  9. package/dist/AddHighlightModel/MsaToGenomeHighlight.d.ts +7 -0
  10. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +26 -0
  11. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -0
  12. package/dist/AddHighlightModel/index.d.ts +2 -0
  13. package/dist/AddHighlightModel/index.js +14 -0
  14. package/dist/AddHighlightModel/index.js.map +1 -0
  15. package/dist/AddHighlightModel/util.d.ts +9 -0
  16. package/dist/AddHighlightModel/util.js +14 -0
  17. package/dist/AddHighlightModel/util.js.map +1 -0
  18. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.d.ts +7 -0
  19. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +20 -0
  20. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -0
  21. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.d.ts +8 -0
  22. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js +76 -0
  23. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.js.map +1 -0
  24. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.d.ts +26 -0
  25. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js +48 -0
  26. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.js.map +1 -0
  27. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.d.ts +2 -0
  28. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js +3 -0
  29. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/index.js.map +1 -0
  30. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.d.ts +8 -0
  31. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.js +17 -0
  32. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.js.map +1 -0
  33. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.d.ts +20 -0
  34. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js +64 -0
  35. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.js.map +1 -0
  36. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/util.d.ts +5 -0
  37. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/util.js +7 -0
  38. package/dist/LaunchMsaView/components/NewNCBIBlastQuery/util.js.map +1 -0
  39. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.d.ts +8 -0
  40. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +90 -0
  41. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -0
  42. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchGeneList.d.ts +1 -0
  43. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchGeneList.js +12 -0
  44. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchGeneList.js.map +1 -0
  45. package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.d.ts +9 -0
  46. package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js +36 -0
  47. package/dist/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.js.map +1 -0
  48. package/dist/LaunchMsaView/components/TabUtils.d.ts +12 -0
  49. package/dist/LaunchMsaView/components/TabUtils.js +13 -0
  50. package/dist/LaunchMsaView/components/TabUtils.js.map +1 -0
  51. package/dist/LaunchMsaView/index.d.ts +2 -0
  52. package/dist/LaunchMsaView/index.js +50 -0
  53. package/dist/LaunchMsaView/index.js.map +1 -0
  54. package/dist/LaunchMsaView/util.d.ts +5 -0
  55. package/dist/LaunchMsaView/util.js +25 -0
  56. package/dist/LaunchMsaView/util.js.map +1 -0
  57. package/dist/MsaViewPanel/components/LoadingBLAST.d.ts +6 -0
  58. package/dist/MsaViewPanel/components/LoadingBLAST.js +36 -0
  59. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -0
  60. package/dist/MsaViewPanel/components/MsaViewPanel.d.ts +6 -0
  61. package/dist/MsaViewPanel/components/MsaViewPanel.js +10 -0
  62. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -0
  63. package/dist/MsaViewPanel/components/RIDLink.d.ts +5 -0
  64. package/dist/MsaViewPanel/components/RIDLink.js +17 -0
  65. package/dist/MsaViewPanel/components/RIDLink.js.map +1 -0
  66. package/dist/MsaViewPanel/doLaunchBlast.d.ts +7 -0
  67. package/dist/MsaViewPanel/doLaunchBlast.js +27 -0
  68. package/dist/MsaViewPanel/doLaunchBlast.js.map +1 -0
  69. package/dist/MsaViewPanel/genomeToMSA.d.ts +4 -0
  70. package/dist/MsaViewPanel/genomeToMSA.js +18 -0
  71. package/dist/MsaViewPanel/genomeToMSA.js.map +1 -0
  72. package/dist/MsaViewPanel/index.d.ts +2 -0
  73. package/dist/MsaViewPanel/index.js +16 -0
  74. package/dist/MsaViewPanel/index.js.map +1 -0
  75. package/dist/MsaViewPanel/model.d.ts +596 -0
  76. package/dist/MsaViewPanel/model.js +235 -0
  77. package/dist/MsaViewPanel/model.js.map +1 -0
  78. package/dist/MsaViewPanel/msaCoordToGenomeCoord.d.ts +9 -0
  79. package/dist/MsaViewPanel/msaCoordToGenomeCoord.js +20 -0
  80. package/dist/MsaViewPanel/msaCoordToGenomeCoord.js.map +1 -0
  81. package/dist/MsaViewPanel/util.d.ts +8 -0
  82. package/dist/MsaViewPanel/util.js +7 -0
  83. package/dist/MsaViewPanel/util.js.map +1 -0
  84. package/dist/OpenInNewIcon.d.ts +3 -0
  85. package/dist/OpenInNewIcon.js +8 -0
  86. package/dist/OpenInNewIcon.js.map +1 -0
  87. package/dist/TextField2.d.ts +4 -0
  88. package/dist/TextField2.js +8 -0
  89. package/dist/TextField2.js.map +1 -0
  90. package/dist/index.d.ts +8 -8
  91. package/dist/index.js +32 -7
  92. package/dist/index.js.map +1 -0
  93. package/dist/jbrowse-plugin-msaview.umd.production.min.js +109 -1
  94. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +7 -1
  95. package/dist/utils/fetch.d.ts +4 -0
  96. package/dist/utils/fetch.js +19 -0
  97. package/dist/utils/fetch.js.map +1 -0
  98. package/dist/utils/msa.d.ts +8 -0
  99. package/dist/utils/msa.js +75 -0
  100. package/dist/utils/msa.js.map +1 -0
  101. package/dist/utils/ncbiBlast.d.ts +20 -0
  102. package/dist/utils/ncbiBlast.js +66 -0
  103. package/dist/utils/ncbiBlast.js.map +1 -0
  104. package/package.json +51 -40
  105. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +44 -0
  106. package/src/AddHighlightModel/HighlightComponents.tsx +24 -0
  107. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +50 -0
  108. package/src/AddHighlightModel/index.tsx +27 -0
  109. package/src/AddHighlightModel/util.ts +14 -0
  110. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +52 -0
  111. package/src/LaunchMsaView/components/NewNCBIBlastQuery/NcbiBlastPanel.tsx +160 -0
  112. package/src/LaunchMsaView/components/NewNCBIBlastQuery/calculateProteinSequence.ts +92 -0
  113. package/src/LaunchMsaView/components/NewNCBIBlastQuery/index.tsx +2 -0
  114. package/src/LaunchMsaView/components/NewNCBIBlastQuery/ncbiBlastLaunchView.ts +28 -0
  115. package/src/LaunchMsaView/components/NewNCBIBlastQuery/useFeatureSequence.ts +85 -0
  116. package/src/LaunchMsaView/components/NewNCBIBlastQuery/util.ts +7 -0
  117. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +149 -0
  118. package/src/LaunchMsaView/components/PreLoadedMSA/fetchGeneList.ts +13 -0
  119. package/src/LaunchMsaView/components/PreLoadedMSA/preCalculatedLaunchView.ts +54 -0
  120. package/src/LaunchMsaView/components/TabUtils.tsx +30 -0
  121. package/src/LaunchMsaView/index.ts +61 -0
  122. package/src/LaunchMsaView/util.ts +30 -0
  123. package/src/MsaViewPanel/components/LoadingBLAST.tsx +59 -0
  124. package/src/MsaViewPanel/components/MsaViewPanel.tsx +22 -0
  125. package/src/MsaViewPanel/components/RIDLink.tsx +18 -0
  126. package/src/MsaViewPanel/doLaunchBlast.ts +38 -0
  127. package/src/MsaViewPanel/genomeToMSA.ts +21 -0
  128. package/src/MsaViewPanel/index.ts +19 -0
  129. package/src/MsaViewPanel/model.ts +290 -0
  130. package/src/MsaViewPanel/msaCoordToGenomeCoord.ts +29 -0
  131. package/src/MsaViewPanel/util.ts +13 -0
  132. package/src/OpenInNewIcon.tsx +11 -0
  133. package/src/TextField2.tsx +12 -0
  134. package/src/index.ts +12 -14
  135. package/src/utils/fetch.ts +25 -0
  136. package/src/utils/msa.ts +111 -0
  137. package/src/utils/ncbiBlast.ts +105 -0
  138. package/dist/config.json +0 -8
  139. package/dist/jbrowse-plugin-msaview.cjs.development.js +0 -168
  140. package/dist/jbrowse-plugin-msaview.cjs.development.js.map +0 -1
  141. package/dist/jbrowse-plugin-msaview.cjs.production.min.js +0 -2
  142. package/dist/jbrowse-plugin-msaview.cjs.production.min.js.map +0 -1
  143. package/dist/jbrowse-plugin-msaview.esm.js +0 -163
  144. package/dist/jbrowse-plugin-msaview.esm.js.map +0 -1
  145. package/dist/jbrowse-plugin-msaview.umd.development.js +0 -8659
  146. package/dist/jbrowse-plugin-msaview.umd.development.js.map +0 -1
  147. package/src/index.test.ts +0 -3
@@ -0,0 +1,4 @@
1
+ export declare function myfetch(url: string, args?: RequestInit): Promise<Response>;
2
+ export declare function textfetch(url: string, args?: RequestInit): Promise<string>;
3
+ export declare function jsonfetch(url: string, args?: RequestInit): Promise<any>;
4
+ export declare function timeout(time: number): Promise<unknown>;
@@ -0,0 +1,19 @@
1
+ export async function myfetch(url, args) {
2
+ const response = await fetch(url, args);
3
+ if (!response.ok) {
4
+ throw new Error(`HTTP ${response.status} fetching ${url} ${await response.text()}`);
5
+ }
6
+ return response;
7
+ }
8
+ export async function textfetch(url, args) {
9
+ const response = await myfetch(url, args);
10
+ return response.text();
11
+ }
12
+ export async function jsonfetch(url, args) {
13
+ const response = await myfetch(url, args);
14
+ return response.json();
15
+ }
16
+ export function timeout(time) {
17
+ return new Promise(res => setTimeout(res, time));
18
+ }
19
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +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,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACzC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;AAClD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function launchMSA({ algorithm, sequence, onProgress, }: {
2
+ algorithm: string;
3
+ sequence: string;
4
+ onProgress: (arg: string) => void;
5
+ }): Promise<{
6
+ msa: string;
7
+ tree: string;
8
+ }>;
@@ -0,0 +1,75 @@
1
+ import { textfetch, timeout } from './fetch';
2
+ const base = `https://www.ebi.ac.uk/Tools/services/rest`;
3
+ async function runClustalOmega({ sequence, onProgress, }) {
4
+ const jobId = await textfetch(`${base}/clustalo/run`, {
5
+ method: 'POST',
6
+ body: new URLSearchParams({
7
+ email: 'colin.diesh@gmail.com',
8
+ sequence,
9
+ }),
10
+ });
11
+ await wait({ jobId, algorithm: 'clustalo', onProgress });
12
+ return {
13
+ msa: await textfetch(`${base}/clustalo/result/${jobId}/aln-clustal_num`),
14
+ tree: await textfetch(`${base}/clustalo/result/${jobId}/phylotree`),
15
+ };
16
+ }
17
+ async function runMuscle({ sequence, onProgress, }) {
18
+ const jobId = await textfetch(`${base}/muscle/run`, {
19
+ method: 'POST',
20
+ body: new URLSearchParams({
21
+ email: 'colin.diesh@gmail.com',
22
+ format: 'clw',
23
+ tree: 'tree1',
24
+ sequence,
25
+ }),
26
+ });
27
+ await wait({ jobId, algorithm: 'muscle', onProgress });
28
+ return {
29
+ msa: await textfetch(`${base}/muscle/result/${jobId}/fa`),
30
+ tree: await textfetch(`${base}/muscle/result/${jobId}/phylotree`),
31
+ };
32
+ }
33
+ async function runKalign({ sequence, onProgress, }) {
34
+ const jobId = await textfetch(`${base}/kalign/run`, {
35
+ method: 'POST',
36
+ body: new URLSearchParams({
37
+ email: 'colin.diesh@gmail.com',
38
+ stype: 'protein',
39
+ sequence,
40
+ }),
41
+ });
42
+ await wait({ jobId, algorithm: 'kalign', onProgress });
43
+ return {
44
+ msa: await textfetch(`${base}/kalign/result/${jobId}/fa`),
45
+ tree: await textfetch(`${base}/kalign/result/${jobId}/phylotree`),
46
+ };
47
+ }
48
+ async function wait({ onProgress, jobId, algorithm, }) {
49
+ while (true) {
50
+ for (let i = 0; i < 10; i++) {
51
+ await timeout(1000);
52
+ onProgress(`Re-checking MSA status in... ${10 - i}`);
53
+ }
54
+ const result = await textfetch(`${base}/${algorithm}/status/${jobId}`);
55
+ if (result === 'FINISHED') {
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ export async function launchMSA({ algorithm, sequence, onProgress, }) {
61
+ onProgress(`Launching ${algorithm} MSA...`);
62
+ if (algorithm === 'clustalo') {
63
+ return runClustalOmega({ sequence, onProgress });
64
+ }
65
+ else if (algorithm === 'muscle') {
66
+ return runMuscle({ sequence, onProgress });
67
+ }
68
+ else if (algorithm === 'kalign') {
69
+ return runKalign({ sequence, onProgress });
70
+ }
71
+ else {
72
+ throw new Error('unknown algorithm');
73
+ }
74
+ }
75
+ //# sourceMappingURL=msa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"msa.js","sourceRoot":"","sources":["../../src/utils/msa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,IAAI,GAAG,2CAA2C,CAAA;AAExD,KAAK,UAAU,eAAe,CAAC,EAC7B,QAAQ,EACR,UAAU,GAIX;IACC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,GAAG,IAAI,eAAe,EAAE;QACpD,MAAM,EAAE,MAAM;QACd,I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AAA;IAC5C,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
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, }: {
3
+ query: string;
4
+ blastDatabase: string;
5
+ blastProgram: string;
6
+ onProgress: (arg: string) => void;
7
+ onRid: (arg: string) => void;
8
+ }): Promise<{
9
+ rid: string;
10
+ hits: {
11
+ description: {
12
+ accession: string;
13
+ id: string;
14
+ sciname: string;
15
+ }[];
16
+ hsps: {
17
+ hseq: string;
18
+ }[];
19
+ }[];
20
+ }>;
@@ -0,0 +1,66 @@
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, }) {
4
+ onProgress('Submitting to NCBI BLAST...');
5
+ const { rid } = await initialQuery({
6
+ query,
7
+ blastDatabase,
8
+ blastProgram,
9
+ });
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`);
13
+ const hits = ret.BlastOutput2[0].report.results.search.hits;
14
+ return { rid, hits };
15
+ }
16
+ async function initialQuery({ query, blastProgram, blastDatabase, }) {
17
+ const res = await textfetch(BLAST_URL, {
18
+ method: 'POST',
19
+ body: new URLSearchParams({
20
+ CMD: 'Put',
21
+ PROGRAM: blastProgram,
22
+ DATABASE: blastDatabase,
23
+ QUERY: query,
24
+ ...(blastDatabase === 'nr_clustered_seq'
25
+ ? {
26
+ CLUSTERED_DB: 'on',
27
+ DB_TYPE: 'Experimental Databases',
28
+ }
29
+ : {}),
30
+ }),
31
+ });
32
+ // the initial submission/query to the BLAST "REST API" does not return JSON
33
+ // as a response (e.g. FORMAT_TYPE=JSON does not work), so the RID is
34
+ // literally parsed from the text of the HTML that is returned
35
+ const rid = res.match(/^ RID = (.*$)/m)?.[1];
36
+ const rtoe = res.match(/^ RTOE = (.*$)/m)?.[1];
37
+ if (!rid) {
38
+ throw new Error('Failed to get RID from BLAST request');
39
+ }
40
+ return { rid, rtoe };
41
+ }
42
+ async function waitForRid({ rid, onProgress, }) {
43
+ while (true) {
44
+ const iter = 20;
45
+ for (let i = 0; i < iter; i++) {
46
+ await timeout(1000);
47
+ onProgress(`Re-checking BLAST status in... ${iter - i}`);
48
+ }
49
+ const res = await textfetch(`${BLAST_URL}?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=${rid}`);
50
+ if (res.match(/\s+Status=WAITING/m)) {
51
+ continue;
52
+ }
53
+ else if (res.match(/\s+Status=FAILED/m)) {
54
+ throw new Error(`BLAST ${rid} failed; please report to blast-help@ncbi.nlm.nih.gov`);
55
+ }
56
+ else if (res.match(/\s+Status=READY/m)) {
57
+ if (res.match(/\s+ThereAreHits=yes/m)) {
58
+ return true;
59
+ }
60
+ else {
61
+ throw new Error('No hits found');
62
+ }
63
+ }
64
+ }
65
+ }
66
+ //# sourceMappingURL=ncbiBlast.js.map
@@ -0,0 +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,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tB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,EACxB,GAAG,EACH,UAAU,GAIX;IACC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,EAAE,CAAA;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;YACnB,UAAU,CAAC,kCAAkC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAA;QAC1D,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,SAAS,CACzB,GAAG,SAAS,yCAAyC,GAAG,EAAE,CAC3D,CAAA;QACD,IAAI,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;YACpC,SAAQ;QACV,CAAC;aAAM,IAAI,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,SAAS,GAAG,uDAAuD,CACpE,CAAA;QACH,CAAC;aAAM,IAAI,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACzC,IAAI,GAAG,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC;gBACtC,OAAO,IAAI,CAAA;YACb,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,64 +1,75 @@
1
1
  {
2
- "version": "1.0.18",
2
+ "version": "2.0.0",
3
+ "license": "MIT",
3
4
  "name": "jbrowse-plugin-msaview",
4
5
  "keywords": [
5
6
  "jbrowse",
6
7
  "jbrowse2"
7
8
  ],
8
9
  "main": "dist/index.js",
9
- "module": "dist/jbrowse-plugin-msaview.esm.js",
10
- "typings": "dist/index.d.ts",
11
10
  "files": [
12
11
  "dist",
13
12
  "src"
14
13
  ],
14
+ "config": {
15
+ "port": 9000,
16
+ "browse": {
17
+ "port": 8999
18
+ },
19
+ "jbrowse": {
20
+ "plugin": {
21
+ "name": "MsaView"
22
+ }
23
+ }
24
+ },
15
25
  "scripts": {
16
- "setup": "node scripts/setup.js && npm run browse-install",
17
26
  "clean": "rimraf dist",
18
- "start": "tsdx watch --verbose --noClean --format umd --name JBrowsePluginMsaView --onFirstSuccess \"serve --cors --listen 9000 .\"",
27
+ "start": "node esbuild.mjs",
28
+ "build": "tsc && NODE_ENV=production node esbuild.mjs",
19
29
  "prebuild": "npm run clean",
20
- "build": "tsdx build --format cjs,esm,umd --name JBrowsePluginMsaView && cp distconfig.json dist/config.json",
21
- "browse-install": "cd .jbrowse && rm -rf * && jbrowse create .",
22
- "browse": "cd .jbrowse && cp ../jbrowse_config.json . && mv jbrowse_config.json config.json && npx serve .",
23
- "test": "tsdx test",
24
- "lint": "tsdx lint",
25
- "prepublishOnly": "npm test",
26
- "prepare": "npm run build",
27
- "postinstall": "jbrowse-plugin-postinstall",
30
+ "lint": "eslint --report-unused-disable-directives --max-warnings 0 src/",
31
+ "prepack": "npm run build",
28
32
  "postversion": "git push --follow-tags"
29
33
  },
30
34
  "jbrowse-plugin": {
31
35
  "name": "MsaView"
32
36
  },
33
- "prettier": {
34
- "semi": false,
35
- "singleQuote": true,
36
- "trailingComma": "all"
37
- },
38
37
  "dependencies": {
39
- "@material-ui/icons": "^4.11.2",
40
- "react-msaview": "^1.2.11"
41
- },
42
- "peerDependencies": {
43
- "@jbrowse/core": "^1.0.4"
38
+ "g2p_mapper": "^1.0.4",
39
+ "pako": "^2.1.0",
40
+ "react-msaview": "^3.0.3"
44
41
  },
45
42
  "devDependencies": {
46
- "@babel/preset-react": "^7.10.4",
47
- "@jbrowse/core": "^1.0.4",
48
- "@jbrowse/development-tools": "^1.0.3",
49
- "@material-ui/core": "^4.9.13",
50
- "@material-ui/lab": "^4.0.0-alpha.45",
51
- "@types/react": "^17.0.0",
52
- "cypress": "^6.2.1",
53
- "mobx": "^5.0.0",
54
- "mobx-react": "^6.0.0",
55
- "mobx-state-tree": "3.14.1",
56
- "react": "^16.8.0",
57
- "rimraf": "^3.0.2",
58
- "rxjs": "^6.0.0",
59
- "serve": "^11.3.2",
60
- "start-server-and-test": "^1.11.7",
61
- "tslib": "^2.0.3",
62
- "typescript": "^4.1.3"
43
+ "@emotion/react": "^11.10.4",
44
+ "@eslint/compat": "^1.1.0",
45
+ "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
46
+ "@jbrowse/core": "^2.10.1",
47
+ "@jbrowse/plugin-linear-genome-view": "^2.7.0",
48
+ "@mui/icons-material": "^5.15.6",
49
+ "@mui/material": "^5.14.12",
50
+ "@mui/system": "^5.14.12",
51
+ "@mui/x-data-grid": "^7.3.0",
52
+ "@types/node": "^20.8.6",
53
+ "@types/pako": "^2.0.1",
54
+ "@types/react": "^18.2.28",
55
+ "@typescript-eslint/eslint-plugin": "^7.0.1",
56
+ "@typescript-eslint/parser": "^7.0.1",
57
+ "esbuild": "^0.23.0",
58
+ "eslint": "^9.0.0",
59
+ "eslint-config-prettier": "^9.1.0",
60
+ "eslint-plugin-prettier": "^5.1.0",
61
+ "eslint-plugin-react": "^7.20.3",
62
+ "eslint-plugin-react-hooks": "^4.6.0",
63
+ "mobx": "^6.10.2",
64
+ "mobx-react": "^9.0.1",
65
+ "mobx-state-tree": "^5.3.0",
66
+ "prettier": "^3.0.3",
67
+ "pretty-bytes": "^6.1.1",
68
+ "react": "^18.2.0",
69
+ "react-dom": "^18.2.0",
70
+ "rimraf": "^5.0.5",
71
+ "rxjs": "^7.8.1",
72
+ "tss-react": "^4.9.2",
73
+ "typescript": "^5.2.2"
63
74
  }
64
75
  }
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import { observer } from 'mobx-react'
3
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
4
+ import { getSession } from '@jbrowse/core/util'
5
+ import { useStyles } from './util'
6
+
7
+ const GenomeMouseoverHighlight = observer(function GenomeMouseoverHighlight2({
8
+ model,
9
+ }: {
10
+ model: LinearGenomeViewModel
11
+ }) {
12
+ const { hovered } = getSession(model)
13
+ return hovered &&
14
+ typeof hovered === 'object' &&
15
+ 'hoverPosition' in hovered ? (
16
+ <HoverHighlight model={model} />
17
+ ) : null
18
+ })
19
+
20
+ const HoverHighlight = observer(function HoverHighlight2({
21
+ model,
22
+ }: {
23
+ model: LinearGenomeViewModel
24
+ }) {
25
+ const { classes } = useStyles()
26
+ const session = getSession(model)
27
+ if (session.views.some(s => s.type === 'MsaView')) {
28
+ const { hovered } = session
29
+ const { offsetPx } = model
30
+ // @ts-expect-error
31
+ const { coord, refName } = hovered.hoverPosition
32
+
33
+ const s = model.bpToPx({ refName, coord: coord - 1 })
34
+ const e = model.bpToPx({ refName, coord: coord })
35
+ if (s && e) {
36
+ const width = Math.max(Math.abs(e.offsetPx - s.offsetPx), 4)
37
+ const left = Math.min(s.offsetPx, e.offsetPx) - offsetPx
38
+ return <div className={classes.highlight} style={{ left, width }} />
39
+ }
40
+ }
41
+ return null
42
+ })
43
+
44
+ export default GenomeMouseoverHighlight
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import { observer } from 'mobx-react'
3
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
4
+
5
+ // locals
6
+ import MsaToGenomeHighlight from './MsaToGenomeHighlight'
7
+ import GenomeMouseoverHighlight from './GenomeMouseoverHighlight'
8
+
9
+ type LGV = LinearGenomeViewModel
10
+
11
+ const HighlightComponents = observer(function HighlightComponents2({
12
+ model,
13
+ }: {
14
+ model: LGV
15
+ }) {
16
+ return (
17
+ <>
18
+ <MsaToGenomeHighlight model={model} />
19
+ <GenomeMouseoverHighlight model={model} />
20
+ </>
21
+ )
22
+ })
23
+
24
+ export default HighlightComponents
@@ -0,0 +1,50 @@
1
+ import React from 'react'
2
+ import { observer } from 'mobx-react'
3
+ import { getSession } from '@jbrowse/core/util'
4
+
5
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
6
+ import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
7
+
8
+ // locals
9
+ import { JBrowsePluginMsaViewModel } from '../MsaViewPanel/model'
10
+ import { useStyles } from './util'
11
+
12
+ type LGV = LinearGenomeViewModel
13
+
14
+ function getCanonicalName(assembly: Assembly, s: string) {
15
+ return assembly.getCanonicalRefName(s) ?? s
16
+ }
17
+
18
+ const MsaToGenomeHighlight = observer(function MsaToGenomeHighlight2({
19
+ model,
20
+ }: {
21
+ model: LGV
22
+ }) {
23
+ const { classes } = useStyles()
24
+ const { assemblyManager, views } = getSession(model)
25
+ const p = views.find(f => f.type === 'MsaView') as JBrowsePluginMsaViewModel
26
+ const assembly = assemblyManager.get(model.assemblyNames[0])
27
+ return assembly ? (
28
+ <>
29
+ {p?.connectedHighlights.map((r, idx) => {
30
+ const refName = getCanonicalName(assembly, r.refName)
31
+ const s = model.bpToPx({ refName, coord: r.start })
32
+ const e = model.bpToPx({ refName, coord: r.end })
33
+ if (s && e) {
34
+ const width = Math.max(Math.abs(e.offsetPx - s.offsetPx), 4)
35
+ const left = Math.min(s.offsetPx, e.offsetPx) - model.offsetPx
36
+ return (
37
+ <div
38
+ key={`${JSON.stringify(r)}-${idx}`}
39
+ className={classes.highlight}
40
+ style={{ left, width }}
41
+ />
42
+ )
43
+ }
44
+ return null
45
+ })}
46
+ </>
47
+ ) : null
48
+ })
49
+
50
+ export default MsaToGenomeHighlight
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import PluginManager from '@jbrowse/core/PluginManager'
3
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
4
+
5
+ // locals
6
+ import HighlightComponents from './HighlightComponents'
7
+
8
+ export default function AddHighlightComponentsModelF(
9
+ pluginManager: PluginManager,
10
+ ) {
11
+ pluginManager.addToExtensionPoint(
12
+ 'LinearGenomeView-TracksContainerComponent',
13
+ // @ts-expect-error
14
+ (
15
+ rest: React.ReactNode[] = [],
16
+ { model }: { model: LinearGenomeViewModel },
17
+ ) => {
18
+ return [
19
+ ...rest,
20
+ <HighlightComponents
21
+ key="highlight_protein_viewer_msaview"
22
+ model={model}
23
+ />,
24
+ ]
25
+ },
26
+ )
27
+ }
@@ -0,0 +1,14 @@
1
+ import { makeStyles } from 'tss-react/mui'
2
+
3
+ export const useStyles = makeStyles()({
4
+ highlight: {
5
+ height: '100%',
6
+ background: 'rgba(255,255,0,0.2)',
7
+ border: '1px solid rgba(50,50,0,0.2)',
8
+ position: 'absolute',
9
+ zIndex: 1000,
10
+ textAlign: 'center',
11
+ pointerEvents: 'none',
12
+ overflow: 'hidden',
13
+ },
14
+ })
@@ -0,0 +1,52 @@
1
+ import React, { useState } from 'react'
2
+ import { Dialog } from '@jbrowse/core/ui'
3
+ import { Box, Tab, Tabs } from '@mui/material'
4
+ import { AbstractTrackModel, Feature } from '@jbrowse/core/util'
5
+
6
+ // locals
7
+
8
+ import { CustomTabPanel, a11yProps } from './TabUtils'
9
+ import NewNcbiBlastQueryPanel from './NewNCBIBlastQuery'
10
+ import PreLoadedMSA from './PreLoadedMSA/PreLoadedMSADataPanel'
11
+
12
+ export default function LaunchProteinViewDialog({
13
+ handleClose,
14
+ feature,
15
+ model,
16
+ }: {
17
+ handleClose: () => void
18
+ feature: Feature
19
+ model: AbstractTrackModel
20
+ }) {
21
+ const [value, setValue] = useState(0)
22
+
23
+ return (
24
+ <Dialog
25
+ maxWidth="xl"
26
+ title="Launch MSA view"
27
+ onClose={() => handleClose()}
28
+ open
29
+ >
30
+ <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
31
+ <Tabs value={value} onChange={(_, val) => setValue(val)}>
32
+ <Tab label="NCBI BLAST query" {...a11yProps(0)} />
33
+ <Tab label="UCSC 100-way dataset" {...a11yProps(1)} />
34
+ </Tabs>
35
+ </Box>
36
+ <CustomTabPanel value={value} index={0}>
37
+ <NewNcbiBlastQueryPanel
38
+ handleClose={handleClose}
39
+ feature={feature}
40
+ model={model}
41
+ />
42
+ </CustomTabPanel>
43
+ <CustomTabPanel value={value} index={1}>
44
+ <PreLoadedMSA
45
+ model={model}
46
+ feature={feature}
47
+ handleClose={handleClose}
48
+ />
49
+ </CustomTabPanel>
50
+ </Dialog>
51
+ )
52
+ }