jbrowse-plugin-msaview 2.3.8 → 2.4.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 (120) hide show
  1. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +4 -15
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  3. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +5 -8
  4. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -1
  5. package/dist/AddHighlightModel/util.d.ts +3 -0
  6. package/dist/AddHighlightModel/util.js +3 -0
  7. package/dist/AddHighlightModel/util.js.map +1 -1
  8. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +3 -8
  9. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  10. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +7 -10
  11. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  12. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +2 -5
  13. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  14. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +0 -3
  15. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -1
  16. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.d.ts +4 -4
  17. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js +2 -2
  18. package/dist/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.js.map +1 -1
  19. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.d.ts +4 -0
  20. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js +2 -0
  21. package/dist/LaunchMsaView/components/NCBIBlastQuery/consts.js.map +1 -1
  22. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +10 -21
  23. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  24. package/dist/LaunchMsaView/components/PreLoadedMSA/types.d.ts +1 -0
  25. package/dist/LaunchMsaView/components/PreLoadedMSA/types.js +4 -1
  26. package/dist/LaunchMsaView/components/PreLoadedMSA/types.js.map +1 -1
  27. package/dist/LaunchMsaView/components/types.d.ts +0 -3
  28. package/dist/LaunchMsaView/components/useFeatureSequence.d.ts +4 -4
  29. package/dist/LaunchMsaView/components/useFeatureSequence.js +2 -4
  30. package/dist/LaunchMsaView/components/useFeatureSequence.js.map +1 -1
  31. package/dist/LaunchMsaView/components/useSWRFeatureSequence.d.ts +4 -5
  32. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js +11 -30
  33. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js.map +1 -1
  34. package/dist/MsaViewPanel/afterCreateAutoruns.js +4 -13
  35. package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -1
  36. package/dist/MsaViewPanel/components/ConnectStructureDialog.js +2 -2
  37. package/dist/MsaViewPanel/components/ConnectStructureDialog.js.map +1 -1
  38. package/dist/MsaViewPanel/components/LoadingBLAST.js +2 -3
  39. package/dist/MsaViewPanel/components/LoadingBLAST.js.map +1 -1
  40. package/dist/MsaViewPanel/model.d.ts +4 -11
  41. package/dist/MsaViewPanel/model.js +6 -20
  42. package/dist/MsaViewPanel/model.js.map +1 -1
  43. package/dist/MsaViewPanel/msaDataStore.d.ts +0 -1
  44. package/dist/MsaViewPanel/msaDataStore.js +0 -9
  45. package/dist/MsaViewPanel/msaDataStore.js.map +1 -1
  46. package/dist/MsaViewPanel/structureConnection.d.ts +6 -4
  47. package/dist/MsaViewPanel/structureConnection.js +6 -6
  48. package/dist/MsaViewPanel/structureConnection.js.map +1 -1
  49. package/dist/MsaViewPanel/structureConnection.test.js +1 -19
  50. package/dist/MsaViewPanel/structureConnection.test.js.map +1 -1
  51. package/dist/jbrowse-plugin-msaview.umd.production.min.js +25 -27
  52. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  53. package/dist/utils/blastCache.d.ts +7 -13
  54. package/dist/utils/blastCache.js +0 -12
  55. package/dist/utils/blastCache.js.map +1 -1
  56. package/dist/utils/msa.d.ts +2 -1
  57. package/dist/utils/msa.js +0 -3
  58. package/dist/utils/msa.js.map +1 -1
  59. package/dist/utils/ncbiBlast.d.ts +3 -2
  60. package/dist/utils/ncbiBlast.js +1 -1
  61. package/dist/utils/ncbiBlast.js.map +1 -1
  62. package/dist/utils/taxonomyNames.js +9 -4
  63. package/dist/utils/taxonomyNames.js.map +1 -1
  64. package/dist/version.d.ts +1 -1
  65. package/dist/version.js +1 -1
  66. package/package.json +22 -20
  67. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +7 -21
  68. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +10 -10
  69. package/src/AddHighlightModel/util.ts +6 -0
  70. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +3 -16
  71. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +8 -12
  72. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +6 -15
  73. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +0 -9
  74. package/src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts +6 -6
  75. package/src/LaunchMsaView/components/NCBIBlastQuery/consts.ts +7 -0
  76. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +12 -27
  77. package/src/LaunchMsaView/components/PreLoadedMSA/types.ts +6 -0
  78. package/src/LaunchMsaView/components/types.ts +0 -3
  79. package/src/LaunchMsaView/components/useFeatureSequence.ts +1 -7
  80. package/src/LaunchMsaView/components/useSWRFeatureSequence.ts +10 -37
  81. package/src/MsaViewPanel/afterCreateAutoruns.ts +7 -15
  82. package/src/MsaViewPanel/components/ConnectStructureDialog.tsx +2 -2
  83. package/src/MsaViewPanel/components/LoadingBLAST.tsx +4 -3
  84. package/src/MsaViewPanel/model.ts +16 -29
  85. package/src/MsaViewPanel/msaDataStore.ts +0 -9
  86. package/src/MsaViewPanel/structureConnection.test.ts +0 -21
  87. package/src/MsaViewPanel/structureConnection.ts +7 -7
  88. package/src/utils/blastCache.ts +14 -37
  89. package/src/utils/msa.ts +5 -6
  90. package/src/utils/ncbiBlast.ts +9 -5
  91. package/src/utils/taxonomyNames.ts +13 -4
  92. package/src/version.ts +1 -1
  93. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.d.ts +0 -8
  94. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js +0 -70
  95. package/dist/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.js.map +0 -1
  96. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.d.ts +0 -13
  97. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js +0 -12
  98. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.js.map +0 -1
  99. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.d.ts +0 -6
  100. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js +0 -25
  101. package/dist/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.js.map +0 -1
  102. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.d.ts +0 -2
  103. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js +0 -20
  104. package/dist/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.js.map +0 -1
  105. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.d.ts +0 -24
  106. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js +0 -2
  107. package/dist/LaunchMsaView/components/EnsemblGeneTree/types.js.map +0 -1
  108. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.d.ts +0 -10
  109. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js +0 -11
  110. package/dist/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.js.map +0 -1
  111. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.d.ts +0 -1
  112. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js +0 -2
  113. package/dist/LaunchMsaView/components/EnsemblGeneTree/util.js.map +0 -1
  114. package/src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx +0 -123
  115. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.ts +0 -30
  116. package/src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts +0 -47
  117. package/src/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.ts +0 -22
  118. package/src/LaunchMsaView/components/EnsemblGeneTree/types.ts +0 -28
  119. package/src/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.ts +0 -17
  120. package/src/LaunchMsaView/components/EnsemblGeneTree/util.ts +0 -6
@@ -21,9 +21,16 @@ async function getDB() {
21
21
  })
22
22
  }
23
23
 
24
- async function getCachedCommonName(taxid: number) {
24
+ async function getCachedTaxonomies(taxids: number[]) {
25
25
  const db = await getDB()
26
- return db.get(STORE_NAME, taxid) as Promise<CachedTaxonomy | undefined>
26
+ const tx = db.transaction(STORE_NAME, 'readonly')
27
+ const results = await Promise.all(
28
+ taxids.map(
29
+ taxid => tx.store.get(taxid) as Promise<CachedTaxonomy | undefined>,
30
+ ),
31
+ )
32
+ await tx.done
33
+ return results
27
34
  }
28
35
 
29
36
  async function saveTaxonomyCache(entries: CachedTaxonomy[]) {
@@ -45,9 +52,11 @@ export async function fetchTaxonomyInfo(
45
52
  ): Promise<Map<number, TaxonomyInfo>> {
46
53
  const result = new Map<number, TaxonomyInfo>()
47
54
  const uncachedTaxids: number[] = []
55
+ const cachedResults = await getCachedTaxonomies(taxids)
48
56
 
49
- for (const taxid of taxids) {
50
- const cached = await getCachedCommonName(taxid)
57
+ for (let i = 0; i < taxids.length; i++) {
58
+ const taxid = taxids[i]!
59
+ const cached = cachedResults[i]
51
60
  if (cached) {
52
61
  result.set(taxid, {
53
62
  sciname: cached.sciname,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.3.8'
1
+ export const version = '2.4.0'
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { AbstractTrackModel, Feature } from '@jbrowse/core/util';
3
- declare const EnsemblGeneTree: ({ model, feature, handleClose, }: {
4
- model: AbstractTrackModel;
5
- feature: Feature;
6
- handleClose: () => void;
7
- }) => React.JSX.Element;
8
- export default EnsemblGeneTree;
@@ -1,70 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
3
- import { getContainingView, getSession } from '@jbrowse/core/util';
4
- import { Button, DialogActions, DialogContent, Link } from '@mui/material';
5
- import { observer } from 'mobx-react';
6
- import { makeStyles } from 'tss-react/mui';
7
- import { ensemblGeneTreeLaunchView } from './ensemblGeneTreeLaunchView';
8
- import { useGeneTree } from './useGeneTree';
9
- import { getGeneDisplayName } from '../../util';
10
- import TranscriptSelector from '../TranscriptSelector';
11
- import { useTranscriptSelection } from '../useTranscriptSelection';
12
- const useStyles = makeStyles()({
13
- dialogContent: {
14
- width: '80em',
15
- display: 'flex',
16
- flexDirection: 'column',
17
- gap: 16,
18
- },
19
- });
20
- const EnsemblGeneTree = observer(function ({ model, feature, handleClose, }) {
21
- const session = getSession(model);
22
- const view = getContainingView(model);
23
- const { classes } = useStyles();
24
- const [launchViewError, setLaunchViewError] = useState();
25
- const { options, selectedId, setSelectedId, selectedTranscript, proteinSequence, error: featureSequenceError, } = useTranscriptSelection({ feature, view });
26
- const { treeData, isTreeLoading, treeError } = useGeneTree(selectedId);
27
- const loadingMessage = isTreeLoading
28
- ? 'Loading tree data from Ensembl GeneTree'
29
- : undefined;
30
- const e = treeError ?? launchViewError ?? featureSequenceError;
31
- return (React.createElement(React.Fragment, null,
32
- React.createElement(DialogContent, { className: classes.dialogContent },
33
- e ? React.createElement(ErrorMessage, { error: e }) : null,
34
- loadingMessage ? React.createElement(LoadingEllipses, { message: loadingMessage }) : null,
35
- treeData ? (React.createElement("div", null,
36
- React.createElement("div", null,
37
- "Found Ensembl Compara GeneTree: ",
38
- treeData.geneTreeId),
39
- React.createElement(Link, { target: "_blank", href: `https://useast.ensembl.org/Multi/GeneTree/Image?gt=${treeData.geneTreeId}` },
40
- "See ",
41
- treeData.geneTreeId,
42
- " at Ensembl"))) : null,
43
- React.createElement(TranscriptSelector, { feature: feature, options: options, selectedId: selectedId, selectedTranscript: selectedTranscript, onTranscriptChange: setSelectedId, proteinSequence: proteinSequence })),
44
- React.createElement(DialogActions, null,
45
- React.createElement(Button, { color: "primary", variant: "contained", onClick: () => {
46
- try {
47
- if (!treeData) {
48
- return;
49
- }
50
- setLaunchViewError(undefined);
51
- ensemblGeneTreeLaunchView({
52
- feature,
53
- view,
54
- session,
55
- newViewTitle: getGeneDisplayName(feature),
56
- data: treeData,
57
- });
58
- handleClose();
59
- }
60
- catch (e) {
61
- console.error(e);
62
- setLaunchViewError(e);
63
- }
64
- } }, "Submit"),
65
- React.createElement(Button, { color: "secondary", variant: "contained", onClick: () => {
66
- handleClose();
67
- } }, "Cancel"))));
68
- });
69
- export default EnsemblGeneTree;
70
- //# sourceMappingURL=EnsemblGeneTree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnsemblGeneTree.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/EnsemblGeneTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,M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ACf,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;wBAChB,kBAAkB,CAAC,CAAC,CAAC,CAAA;oBACvB,CAAC;gBACH,CAAC,aAGM;YACT,oBAAC,MAAM,IACL,KAAK,EAAC,WAAW,EACjB,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,EAAE,CAAA;gBACf,CAAC,aAGM,CACK,CACf,CACJ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,eAAe,CAAA"}
@@ -1,13 +0,0 @@
1
- import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
2
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
- export declare function ensemblGeneTreeLaunchView({ session, newViewTitle, view, feature, data, }: {
4
- session: AbstractSessionModel;
5
- newViewTitle: string;
6
- view: LinearGenomeViewModel;
7
- feature: Feature;
8
- data: {
9
- tree: string;
10
- msa: string;
11
- treeMetadata: string;
12
- };
13
- }): void;
@@ -1,12 +0,0 @@
1
- export function ensemblGeneTreeLaunchView({ session, newViewTitle, view, feature, data, }) {
2
- session.addView('MsaView', {
3
- type: 'MsaView',
4
- displayName: newViewTitle,
5
- colWidth: 10,
6
- rowHeight: 12,
7
- data,
8
- connectedViewId: view.id,
9
- connectedFeature: feature.toJSON(),
10
- });
11
- }
12
- //# sourceMappingURL=ensemblGeneTreeLaunchView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensemblGeneTreeLaunchView.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeLaunchView.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,yBAAyB,CAAC,EACxC,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,IAAI,GAWL;IACC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE;QACzB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,IAAI;QACJ,eAAe,EAAE,IAAI,CAAC,EAAE;QACxB,gBAAgB,EAAE,OAAO,CAAC,MAAM,EAAE;KACnC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare function geneTreeFetcher(id2: string): Promise<{
2
- geneTreeId: string;
3
- tree: string;
4
- msa: string;
5
- treeMetadata: string;
6
- }>;
@@ -1,25 +0,0 @@
1
- import { gatherSequencesFromTree } from './gatherSequencesFromTree';
2
- import { fetchWithLocalStorageCache, jsonfetch, textfetch } from './util';
3
- const base = 'https://rest.ensembl.org';
4
- export async function geneTreeFetcher(id2) {
5
- const id = id2.replace(/\..*/, '');
6
- const { species } = await fetchWithLocalStorageCache(`${id}-ensembl`, () => jsonfetch(`${base}/lookup/id/${id}?content-type=application/json`));
7
- const treeBase = `${base}/genetree/member/id/${species}/${id}`;
8
- const geneTreeResult = await fetchWithLocalStorageCache(`${id}-msa`, () => jsonfetch(`${treeBase}?content-type=application/json;aligned=1;sequence=pep`));
9
- // we query again to get newick format tree. could probably extract from json
10
- // as alternative
11
- const tree = await fetchWithLocalStorageCache(`${id}-tree`, () => textfetch(`${treeBase}?nh_format=simple;content-type=text/x-nh`));
12
- const res = gatherSequencesFromTree(geneTreeResult.tree);
13
- return {
14
- geneTreeId: geneTreeResult.id,
15
- tree,
16
- msa: res.map(r => `>${r.id}\n${r.seq}`).join('\n'),
17
- treeMetadata: JSON.stringify(Object.fromEntries(res.map(r => [
18
- r.id,
19
- {
20
- genome: r.species,
21
- },
22
- ]))),
23
- };
24
- }
25
- //# sourceMappingURL=ensemblGeneTreeUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensemblGeneTreeUtils.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/ensemblGeneTreeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MA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MAAM,EAAE,CAAC,CAAC,OAAO;aAClB;SACO,CACb,CACF,CACF;KACF,CAAA;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { TreeNode, TreeRow } from './types';
2
- export declare function gatherSequencesFromTree(tree: TreeNode, arr?: TreeRow[]): TreeRow[];
@@ -1,20 +0,0 @@
1
- export function gatherSequencesFromTree(tree, arr = []) {
2
- if (tree.children) {
3
- for (const child of tree.children) {
4
- if (child.sequence) {
5
- const id = child.sequence.id[0]?.accession;
6
- if (id) {
7
- arr.push({
8
- id,
9
- seq: child.sequence.mol_seq.seq,
10
- species: child.taxonomy.common_name || child.taxonomy.scientific_name,
11
- genomicLocString: child.sequence.mol_seq.location,
12
- });
13
- }
14
- }
15
- gatherSequencesFromTree(child, arr);
16
- }
17
- }
18
- return arr;
19
- }
20
- //# sourceMappingURL=gatherSequencesFromTree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gatherSequencesFromTree.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/gatherSequencesFromTree.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAAC,IAAc,EAAE,MAAiB,EAAE;IACzE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAA;gBAC1C,IAAI,EAAE,EAAE,CAAC;oBACP,GAAG,CAAC,IAAI,CAAC;wBACP,EAAE;wBACF,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG;wBAC/B,OAAO,EACL,KAAK,CAAC,QAAQ,CAAC,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe;wBAC9D,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ;qBAClD,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;YACD,uBAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,24 +0,0 @@
1
- export interface TreeNodeSequence {
2
- mol_seq: {
3
- seq: string;
4
- location?: string;
5
- };
6
- id: {
7
- accession: string;
8
- }[];
9
- }
10
- export interface TreeNodeTaxonomy {
11
- common_name: string;
12
- scientific_name: string;
13
- }
14
- export interface TreeNode {
15
- children?: TreeNode[];
16
- sequence?: TreeNodeSequence;
17
- taxonomy: TreeNodeTaxonomy;
18
- }
19
- export interface TreeRow {
20
- id: string;
21
- seq: string;
22
- species: string;
23
- genomicLocString?: string;
24
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/types.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- export declare function useGeneTree(geneId: string): {
2
- treeData: {
3
- geneTreeId: string;
4
- tree: string;
5
- msa: string;
6
- treeMetadata: string;
7
- } | undefined;
8
- isTreeLoading: boolean;
9
- treeError: any;
10
- };
@@ -1,11 +0,0 @@
1
- import useSWR from 'swr';
2
- import { geneTreeFetcher } from './ensemblGeneTreeUtils';
3
- export function useGeneTree(geneId) {
4
- const { data, error, isLoading } = useSWR(() => (geneId ? ['geneTree', geneId] : null), ([, geneId]) => geneTreeFetcher(geneId), {
5
- revalidateOnFocus: false,
6
- revalidateOnReconnect: false,
7
- revalidateIfStale: false,
8
- });
9
- return { treeData: data, isTreeLoading: isLoading, treeError: error };
10
- }
11
- //# sourceMappingURL=useGeneTree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGeneTree.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/useGeneTree.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,KAAK,CAAA;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CACvC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAC5C,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,EACvC;QACE,iBAAiB,EAAE,KAAK;QACxB,qBAAqB,EAAE,KAAK;QAC5B,iBAAiB,EAAE,KAAK;KACzB,CACF,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;AACvE,CAAC"}
@@ -1 +0,0 @@
1
- export { fetchWithLocalStorageCache, jsonfetch, textfetch, unzipfetch, } from '../../../utils/fetch';
@@ -1,2 +0,0 @@
1
- export { fetchWithLocalStorageCache, jsonfetch, textfetch, unzipfetch, } from '../../../utils/fetch';
2
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/EnsemblGeneTree/util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,sBAAsB,CAAA"}
@@ -1,123 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui'
4
- import { getContainingView, getSession } from '@jbrowse/core/util'
5
- import { Button, DialogActions, DialogContent, Link } from '@mui/material'
6
- import { observer } from 'mobx-react'
7
- import { makeStyles } from 'tss-react/mui'
8
-
9
- import { ensemblGeneTreeLaunchView } from './ensemblGeneTreeLaunchView'
10
- import { useGeneTree } from './useGeneTree'
11
- import { getGeneDisplayName } from '../../util'
12
- import TranscriptSelector from '../TranscriptSelector'
13
- import { useTranscriptSelection } from '../useTranscriptSelection'
14
-
15
- import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
16
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
17
-
18
- const useStyles = makeStyles()({
19
- dialogContent: {
20
- width: '80em',
21
- display: 'flex',
22
- flexDirection: 'column',
23
- gap: 16,
24
- },
25
- })
26
-
27
- const EnsemblGeneTree = observer(function ({
28
- model,
29
- feature,
30
- handleClose,
31
- }: {
32
- model: AbstractTrackModel
33
- feature: Feature
34
- handleClose: () => void
35
- }) {
36
- const session = getSession(model)
37
- const view = getContainingView(model) as LinearGenomeViewModel
38
- const { classes } = useStyles()
39
- const [launchViewError, setLaunchViewError] = useState<unknown>()
40
- const {
41
- options,
42
- selectedId,
43
- setSelectedId,
44
- selectedTranscript,
45
- proteinSequence,
46
- error: featureSequenceError,
47
- } = useTranscriptSelection({ feature, view })
48
- const { treeData, isTreeLoading, treeError } = useGeneTree(selectedId)
49
-
50
- const loadingMessage = isTreeLoading
51
- ? 'Loading tree data from Ensembl GeneTree'
52
- : undefined
53
- const e = treeError ?? launchViewError ?? featureSequenceError
54
-
55
- return (
56
- <>
57
- <DialogContent className={classes.dialogContent}>
58
- {e ? <ErrorMessage error={e} /> : null}
59
- {loadingMessage ? <LoadingEllipses message={loadingMessage} /> : null}
60
- {treeData ? (
61
- <div>
62
- <div>Found Ensembl Compara GeneTree: {treeData.geneTreeId}</div>
63
- <Link
64
- target="_blank"
65
- href={`https://useast.ensembl.org/Multi/GeneTree/Image?gt=${treeData.geneTreeId}`}
66
- >
67
- See {treeData.geneTreeId} at Ensembl
68
- </Link>
69
- </div>
70
- ) : null}
71
-
72
- <TranscriptSelector
73
- feature={feature}
74
- options={options}
75
- selectedId={selectedId}
76
- selectedTranscript={selectedTranscript}
77
- onTranscriptChange={setSelectedId}
78
- proteinSequence={proteinSequence}
79
- />
80
- </DialogContent>
81
-
82
- <DialogActions>
83
- <Button
84
- color="primary"
85
- variant="contained"
86
- onClick={() => {
87
- try {
88
- if (!treeData) {
89
- return
90
- }
91
- setLaunchViewError(undefined)
92
-
93
- ensemblGeneTreeLaunchView({
94
- feature,
95
- view,
96
- session,
97
- newViewTitle: getGeneDisplayName(feature),
98
- data: treeData,
99
- })
100
- handleClose()
101
- } catch (e) {
102
- console.error(e)
103
- setLaunchViewError(e)
104
- }
105
- }}
106
- >
107
- Submit
108
- </Button>
109
- <Button
110
- color="secondary"
111
- variant="contained"
112
- onClick={() => {
113
- handleClose()
114
- }}
115
- >
116
- Cancel
117
- </Button>
118
- </DialogActions>
119
- </>
120
- )
121
- })
122
-
123
- export default EnsemblGeneTree
@@ -1,30 +0,0 @@
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
- }
@@ -1,47 +0,0 @@
1
- import { gatherSequencesFromTree } from './gatherSequencesFromTree'
2
- import { fetchWithLocalStorageCache, jsonfetch, textfetch } from './util'
3
-
4
- import type { TreeNode } from './types'
5
-
6
- const base = 'https://rest.ensembl.org'
7
-
8
- export async function geneTreeFetcher(id2: string) {
9
- const id = id2.replace(/\..*/, '')
10
- const { species } = await fetchWithLocalStorageCache(`${id}-ensembl`, () =>
11
- jsonfetch<{ species: string }>(
12
- `${base}/lookup/id/${id}?content-type=application/json`,
13
- ),
14
- )
15
- const treeBase = `${base}/genetree/member/id/${species}/${id}`
16
- const geneTreeResult = await fetchWithLocalStorageCache(`${id}-msa`, () =>
17
- jsonfetch<{ tree: TreeNode; id: string }>(
18
- `${treeBase}?content-type=application/json;aligned=1;sequence=pep`,
19
- ),
20
- )
21
-
22
- // we query again to get newick format tree. could probably extract from json
23
- // as alternative
24
- const tree = await fetchWithLocalStorageCache<string>(`${id}-tree`, () =>
25
- textfetch(`${treeBase}?nh_format=simple;content-type=text/x-nh`),
26
- )
27
-
28
- const res = gatherSequencesFromTree(geneTreeResult.tree)
29
- return {
30
- geneTreeId: geneTreeResult.id,
31
- tree,
32
- msa: res.map(r => `>${r.id}\n${r.seq}`).join('\n'),
33
- treeMetadata: JSON.stringify(
34
- Object.fromEntries(
35
- res.map(
36
- r =>
37
- [
38
- r.id,
39
- {
40
- genome: r.species,
41
- },
42
- ] as const,
43
- ),
44
- ),
45
- ),
46
- }
47
- }
@@ -1,22 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
1
- import useSWR from 'swr'
2
-
3
- import { geneTreeFetcher } from './ensemblGeneTreeUtils'
4
-
5
- export function useGeneTree(geneId: string) {
6
- const { data, error, isLoading } = useSWR(
7
- () => (geneId ? ['geneTree', geneId] : null),
8
- ([, geneId]) => geneTreeFetcher(geneId),
9
- {
10
- revalidateOnFocus: false,
11
- revalidateOnReconnect: false,
12
- revalidateIfStale: false,
13
- },
14
- )
15
-
16
- return { treeData: data, isTreeLoading: isLoading, treeError: error }
17
- }
@@ -1,6 +0,0 @@
1
- export {
2
- fetchWithLocalStorageCache,
3
- jsonfetch,
4
- textfetch,
5
- unzipfetch,
6
- } from '../../../utils/fetch'