react-msaview 4.0.3 → 4.1.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 (164) hide show
  1. package/bundle/index.js +281 -103
  2. package/dist/colorSchemes.js +1 -1
  3. package/dist/colorSchemes.js.map +1 -1
  4. package/dist/components/Checkbox2.js.map +1 -1
  5. package/dist/components/Loading.js +4 -5
  6. package/dist/components/Loading.js.map +1 -1
  7. package/dist/components/MSAView.js +3 -4
  8. package/dist/components/MSAView.js.map +1 -1
  9. package/dist/components/ResizeHandles.js.map +1 -1
  10. package/dist/components/SequenceTextArea.js +1 -2
  11. package/dist/components/SequenceTextArea.js.map +1 -1
  12. package/dist/components/TextTrack.d.ts +1 -1
  13. package/dist/components/TextTrack.js +1 -1
  14. package/dist/components/TextTrack.js.map +1 -1
  15. package/dist/components/Track.js +4 -5
  16. package/dist/components/Track.js.map +1 -1
  17. package/dist/components/VerticalScrollbar.js +1 -1
  18. package/dist/components/VerticalScrollbar.js.map +1 -1
  19. package/dist/components/dialogs/AboutDialog.js +4 -4
  20. package/dist/components/dialogs/AboutDialog.js.map +1 -1
  21. package/dist/components/dialogs/AddTrackDialog.js +1 -1
  22. package/dist/components/dialogs/AddTrackDialog.js.map +1 -1
  23. package/dist/components/dialogs/DomainDialog.js +1 -2
  24. package/dist/components/dialogs/DomainDialog.js.map +1 -1
  25. package/dist/components/dialogs/ExportSVGDialog.js +1 -1
  26. package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
  27. package/dist/components/dialogs/FeatureDialog.js +1 -1
  28. package/dist/components/dialogs/FeatureDialog.js.map +1 -1
  29. package/dist/components/dialogs/InterProScanDialog.js +3 -3
  30. package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
  31. package/dist/components/dialogs/MetadataDialog.js +3 -3
  32. package/dist/components/dialogs/MetadataDialog.js.map +1 -1
  33. package/dist/components/dialogs/SettingsDialog.js +3 -3
  34. package/dist/components/dialogs/SettingsDialog.js.map +1 -1
  35. package/dist/components/dialogs/TrackInfoDialog.js +2 -2
  36. package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
  37. package/dist/components/dialogs/TracklistDialog.js +1 -1
  38. package/dist/components/dialogs/TracklistDialog.js.map +1 -1
  39. package/dist/components/dialogs/UserProvidedDomainsDialog.js +3 -3
  40. package/dist/components/dialogs/UserProvidedDomainsDialog.js.map +1 -1
  41. package/dist/components/header/Header.js +5 -7
  42. package/dist/components/header/Header.js.map +1 -1
  43. package/dist/components/header/HeaderInfoArea.js.map +1 -1
  44. package/dist/components/header/HeaderMenu.js +3 -4
  45. package/dist/components/header/HeaderMenu.js.map +1 -1
  46. package/dist/components/header/HeaderMenuExtra.js +8 -9
  47. package/dist/components/header/HeaderMenuExtra.js.map +1 -1
  48. package/dist/components/header/HeaderStatusArea.js +1 -1
  49. package/dist/components/header/HeaderStatusArea.js.map +1 -1
  50. package/dist/components/header/MultiAlignmentSelector.js +1 -1
  51. package/dist/components/header/MultiAlignmentSelector.js.map +1 -1
  52. package/dist/components/header/ZoomControls.js +11 -5
  53. package/dist/components/header/ZoomControls.js.map +1 -1
  54. package/dist/components/import/ImportForm.js +19 -15
  55. package/dist/components/import/ImportForm.js.map +1 -1
  56. package/dist/components/import/ImportFormExamples.js +2 -2
  57. package/dist/components/import/ImportFormExamples.js.map +1 -1
  58. package/dist/components/import/util.d.ts +1 -1
  59. package/dist/components/minimap/Minimap.js.map +1 -1
  60. package/dist/components/minimap/MinimapSVG.js.map +1 -1
  61. package/dist/components/msa/Loading.js +1 -1
  62. package/dist/components/msa/Loading.js.map +1 -1
  63. package/dist/components/msa/MSACanvas.js +2 -2
  64. package/dist/components/msa/MSACanvas.js.map +1 -1
  65. package/dist/components/msa/MSACanvasBlock.js +2 -3
  66. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  67. package/dist/components/msa/MSAMouseoverCanvas.js +1 -1
  68. package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
  69. package/dist/components/msa/MSAPanel.js +0 -1
  70. package/dist/components/msa/MSAPanel.js.map +1 -1
  71. package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
  72. package/dist/components/msa/renderMSABlock.d.ts +1 -1
  73. package/dist/components/msa/renderMSABlock.js.map +1 -1
  74. package/dist/components/tree/TreeBranchMenu.js.map +1 -1
  75. package/dist/components/tree/TreeCanvas.js +1 -2
  76. package/dist/components/tree/TreeCanvas.js.map +1 -1
  77. package/dist/components/tree/TreeCanvasBlock.js +4 -5
  78. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  79. package/dist/components/tree/TreeNodeMenu.js.map +1 -1
  80. package/dist/components/tree/TreePanel.js.map +1 -1
  81. package/dist/components/tree/TreeRuler.js.map +1 -1
  82. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -2
  83. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
  84. package/dist/components/tree/renderTreeCanvas.d.ts +2 -2
  85. package/dist/components/tree/renderTreeCanvas.js +5 -5
  86. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  87. package/dist/index.d.ts +1 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/launchInterProScan.js.map +1 -1
  90. package/dist/model/DialogQueue.js.map +1 -1
  91. package/dist/model.d.ts +20 -20
  92. package/dist/model.js +41 -29
  93. package/dist/model.js.map +1 -1
  94. package/dist/parsers/ClustalMSA.js.map +1 -1
  95. package/dist/parsers/EmfMSA.js.map +1 -1
  96. package/dist/parsers/StockholmMSA.js.map +1 -1
  97. package/dist/renderToSvg.d.ts +1 -1
  98. package/dist/renderToSvg.js +5 -6
  99. package/dist/renderToSvg.js.map +1 -1
  100. package/dist/rowCoordinateCalculations.test.js.map +1 -1
  101. package/dist/util.d.ts +1 -1
  102. package/dist/util.js +1 -1
  103. package/dist/util.js.map +1 -1
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +4 -4
  107. package/src/colorSchemes.ts +2 -1
  108. package/src/components/Checkbox2.tsx +1 -0
  109. package/src/components/Loading.tsx +6 -5
  110. package/src/components/MSAView.tsx +6 -5
  111. package/src/components/ResizeHandles.tsx +1 -1
  112. package/src/components/SequenceTextArea.tsx +2 -2
  113. package/src/components/TextTrack.tsx +5 -3
  114. package/src/components/Track.tsx +5 -5
  115. package/src/components/VerticalScrollbar.tsx +5 -2
  116. package/src/components/dialogs/AboutDialog.tsx +6 -7
  117. package/src/components/dialogs/AddTrackDialog.tsx +7 -5
  118. package/src/components/dialogs/DomainDialog.tsx +3 -2
  119. package/src/components/dialogs/ExportSVGDialog.tsx +7 -5
  120. package/src/components/dialogs/FeatureDialog.tsx +4 -3
  121. package/src/components/dialogs/InterProScanDialog.tsx +6 -5
  122. package/src/components/dialogs/MetadataDialog.tsx +5 -5
  123. package/src/components/dialogs/SettingsDialog.tsx +10 -10
  124. package/src/components/dialogs/TrackInfoDialog.tsx +3 -2
  125. package/src/components/dialogs/TracklistDialog.tsx +4 -4
  126. package/src/components/dialogs/UserProvidedDomainsDialog.tsx +7 -6
  127. package/src/components/header/Header.tsx +8 -11
  128. package/src/components/header/HeaderInfoArea.tsx +1 -1
  129. package/src/components/header/HeaderMenu.tsx +4 -6
  130. package/src/components/header/HeaderMenuExtra.tsx +9 -11
  131. package/src/components/header/HeaderStatusArea.tsx +2 -2
  132. package/src/components/header/MultiAlignmentSelector.tsx +2 -2
  133. package/src/components/header/ZoomControls.tsx +13 -6
  134. package/src/components/import/ImportForm.tsx +31 -24
  135. package/src/components/import/ImportFormExamples.tsx +5 -4
  136. package/src/components/import/util.ts +1 -1
  137. package/src/components/minimap/Minimap.tsx +2 -0
  138. package/src/components/minimap/MinimapSVG.tsx +2 -0
  139. package/src/components/msa/Loading.tsx +2 -1
  140. package/src/components/msa/MSACanvas.tsx +5 -4
  141. package/src/components/msa/MSACanvasBlock.tsx +5 -4
  142. package/src/components/msa/MSAMouseoverCanvas.tsx +4 -3
  143. package/src/components/msa/MSAPanel.tsx +2 -1
  144. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +1 -3
  145. package/src/components/msa/renderMSABlock.ts +3 -4
  146. package/src/components/tree/TreeBranchMenu.tsx +1 -1
  147. package/src/components/tree/TreeCanvas.tsx +4 -4
  148. package/src/components/tree/TreeCanvasBlock.tsx +7 -7
  149. package/src/components/tree/TreeNodeMenu.tsx +1 -1
  150. package/src/components/tree/TreePanel.tsx +3 -1
  151. package/src/components/tree/TreeRuler.tsx +1 -1
  152. package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +5 -4
  153. package/src/components/tree/renderTreeCanvas.ts +7 -9
  154. package/src/index.ts +1 -1
  155. package/src/launchInterProScan.ts +2 -0
  156. package/src/model/DialogQueue.ts +2 -1
  157. package/src/model.ts +59 -47
  158. package/src/parsers/ClustalMSA.ts +1 -0
  159. package/src/parsers/EmfMSA.ts +1 -0
  160. package/src/parsers/StockholmMSA.ts +1 -1
  161. package/src/renderToSvg.tsx +7 -9
  162. package/src/rowCoordinateCalculations.test.ts +1 -0
  163. package/src/util.ts +4 -3
  164. package/src/version.ts +1 -1
@@ -1,13 +1,14 @@
1
1
  import React, { useState } from 'react'
2
+
3
+ import { ErrorMessage, FileSelector } from '@jbrowse/core/ui'
4
+ import { Button, Container, Typography } from '@mui/material'
2
5
  import { observer } from 'mobx-react'
3
- import { Button, Container, Grid, Typography } from '@mui/material'
4
- import { FileSelector } from '@jbrowse/core/ui'
5
- import type { FileLocation } from '@jbrowse/core/util/types'
6
6
 
7
- // locals
8
- import type { MsaViewModel } from '../../model'
9
- import { load } from './util'
10
7
  import ImportFormExamples from './ImportFormExamples'
8
+ import { load } from './util'
9
+
10
+ import type { MsaViewModel } from '../../model'
11
+ import type { FileLocation } from '@jbrowse/core/util/types'
11
12
 
12
13
  const ImportForm = observer(function ({ model }: { model: MsaViewModel }) {
13
14
  const [msaFile, setMsaFile] = useState<FileLocation>()
@@ -17,11 +18,7 @@ const ImportForm = observer(function ({ model }: { model: MsaViewModel }) {
17
18
  return (
18
19
  <Container>
19
20
  <div style={{ width: '50%' }}>
20
- {error ? (
21
- <div style={{ padding: 20 }}>
22
- <Typography color="error">Error: {`${error}`}</Typography>
23
- </div>
24
- ) : null}
21
+ {error ? <ErrorMessage error={error} /> : null}
25
22
  <Typography>
26
23
  Open an MSA file (stockholm or clustal format) and/or a tree file
27
24
  (newick format).
@@ -34,15 +31,25 @@ const ImportForm = observer(function ({ model }: { model: MsaViewModel }) {
34
31
  </Typography>
35
32
  </div>
36
33
 
37
- <Grid container spacing={10} justifyContent="center" alignItems="center">
38
- <Grid item>
39
- <Typography>MSA file or URL</Typography>
40
- <FileSelector location={msaFile} setLocation={setMsaFile} />
41
- <Typography>Tree file or URL</Typography>
42
- <FileSelector location={treeFile} setLocation={setTreeFile} />
43
- </Grid>
44
-
45
- <Grid item>
34
+ <div
35
+ style={{
36
+ display: 'flex',
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ gap: 40,
40
+ }}
41
+ >
42
+ <div>
43
+ <div>
44
+ <Typography>MSA file or URL</Typography>
45
+ <FileSelector location={msaFile} setLocation={setMsaFile} />
46
+ </div>
47
+ <div>
48
+ <Typography>Tree file or URL</Typography>
49
+ <FileSelector location={treeFile} setLocation={setTreeFile} />
50
+ </div>
51
+ </div>
52
+ <div>
46
53
  <Button
47
54
  onClick={() => {
48
55
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -61,13 +68,13 @@ const ImportForm = observer(function ({ model }: { model: MsaViewModel }) {
61
68
  >
62
69
  Open
63
70
  </Button>
64
- </Grid>
71
+ </div>
65
72
 
66
- <Grid item>
73
+ <div>
67
74
  <Typography>Examples</Typography>
68
75
  <ImportFormExamples model={model} />
69
- </Grid>
70
- </Grid>
76
+ </div>
77
+ </div>
71
78
  </Container>
72
79
  )
73
80
  })
@@ -1,12 +1,13 @@
1
1
  import React from 'react'
2
- import { Typography, Link } from '@mui/material'
2
+
3
+ import { Link, Typography } from '@mui/material'
3
4
  import { observer } from 'mobx-react'
4
5
 
5
- // locals
6
- import type { MsaViewModel } from '../../model'
7
- import { smallTree, smallMSA, smallMSAOnly } from './data/seq2'
6
+ import { smallMSA, smallMSAOnly, smallTree } from './data/seq2'
8
7
  import { load } from './util'
9
8
 
9
+ import type { MsaViewModel } from '../../model'
10
+
10
11
  function ListItem({
11
12
  onClick,
12
13
  model,
@@ -1,5 +1,5 @@
1
- import type { FileLocation } from '@jbrowse/core/util'
2
1
  import type { MsaViewModel } from '../../model'
2
+ import type { FileLocation } from '@jbrowse/core/util'
3
3
 
4
4
  export async function load(
5
5
  model: MsaViewModel,
@@ -1,5 +1,7 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
4
+
3
5
  import type { MsaViewModel } from '../../model'
4
6
 
5
7
  interface ClickCoord {
@@ -1,5 +1,7 @@
1
1
  import React from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
4
+
3
5
  import type { MsaViewModel } from '../../model'
4
6
 
5
7
  const MinimapSVG = observer(({ model }: { model: MsaViewModel }) => {
@@ -1,5 +1,6 @@
1
- import { CircularProgress, Typography } from '@mui/material'
2
1
  import React from 'react'
2
+
3
+ import { CircularProgress, Typography } from '@mui/material'
3
4
  export default function Loading() {
4
5
  return (
5
6
  <div
@@ -1,10 +1,11 @@
1
- import React, { useEffect, useState, useRef } from 'react'
1
+ import React, { useEffect, useRef, useState } from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
3
4
 
4
- // locals
5
- import type { MsaViewModel } from '../../model'
6
- import MSACanvasBlock from './MSACanvasBlock'
7
5
  import Loading from './Loading'
6
+ import MSACanvasBlock from './MSACanvasBlock'
7
+
8
+ import type { MsaViewModel } from '../../model'
8
9
 
9
10
  const MSACanvas = observer(function ({ model }: { model: MsaViewModel }) {
10
11
  const {
@@ -1,13 +1,14 @@
1
- import React, { useEffect, useRef, useMemo } from 'react'
1
+ import React, { useEffect, useMemo, useRef } from 'react'
2
+
2
3
  import { useTheme } from '@mui/material'
3
4
  import { autorun } from 'mobx'
4
5
  import { observer } from 'mobx-react'
5
6
 
6
- // locals
7
+ import { renderBoxFeatureCanvasBlock } from './renderBoxFeatureCanvasBlock'
7
8
  import { renderMSABlock } from './renderMSABlock'
8
- import type { MsaViewModel } from '../../model'
9
9
  import { colorContrast } from '../../util'
10
- import { renderBoxFeatureCanvasBlock } from './renderBoxFeatureCanvasBlock'
10
+
11
+ import type { MsaViewModel } from '../../model'
11
12
 
12
13
  const MSACanvasBlock = observer(function ({
13
14
  model,
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useRef } from 'react'
2
- import { observer } from 'mobx-react'
2
+
3
3
  import { autorun } from 'mobx'
4
+ import { observer } from 'mobx-react'
4
5
 
5
- // locals
6
- import type { MsaViewModel } from '../../model'
7
6
  import { renderMouseover } from './renderMSAMouseover'
8
7
 
8
+ import type { MsaViewModel } from '../../model'
9
+
9
10
  const MSAMouseoverCanvas = observer(function ({
10
11
  model,
11
12
  }: {
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
3
4
 
4
- // locals
5
5
  import MSACanvas from './MSACanvas'
6
6
  import MSAMouseoverCanvas from './MSAMouseoverCanvas'
7
+
7
8
  // types
8
9
  import type { MsaViewModel } from '../../model'
9
10
 
@@ -1,8 +1,6 @@
1
- import type { HierarchyNode } from 'd3-hierarchy'
2
-
3
- // locals
4
1
  import type { MsaViewModel } from '../../model'
5
2
  import type { NodeWithIdsAndLength } from '../../util'
3
+ import type { HierarchyNode } from 'd3-hierarchy'
6
4
 
7
5
  export function renderBoxFeatureCanvasBlock({
8
6
  model,
@@ -1,10 +1,9 @@
1
- import type { HierarchyNode } from 'd3-hierarchy'
2
- import type { Theme } from '@mui/material'
1
+ import { getClustalXColor, getPercentIdentityColor } from '../../colorSchemes'
3
2
 
4
- // locals
5
3
  import type { MsaViewModel } from '../../model'
6
- import { getClustalXColor, getPercentIdentityColor } from '../../colorSchemes'
7
4
  import type { NodeWithIdsAndLength } from '../../util'
5
+ import type { Theme } from '@mui/material'
6
+ import type { HierarchyNode } from 'd3-hierarchy'
8
7
 
9
8
  export function renderMSABlock({
10
9
  model,
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
+
2
3
  import { Menu, MenuItem } from '@mui/material'
3
4
  import { observer } from 'mobx-react'
4
5
 
5
- // locals
6
6
  import type { MsaViewModel } from '../../model'
7
7
 
8
8
  interface Node {
@@ -1,12 +1,12 @@
1
- import React from 'react'
2
- import { useEffect, useRef, useState } from 'react'
1
+ import React, { useEffect, useRef, useState } from 'react'
2
+
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- // locals
6
- import type { MsaViewModel } from '../../model'
7
5
  import TreeCanvasBlock from './TreeCanvasBlock'
8
6
  import { padding } from './renderTreeCanvas'
9
7
 
8
+ import type { MsaViewModel } from '../../model'
9
+
10
10
  const TreeCanvas = observer(function ({ model }: { model: MsaViewModel }) {
11
11
  const ref = useRef<HTMLDivElement>(null)
12
12
  const scheduled = useRef(false)
@@ -1,16 +1,16 @@
1
- import React from 'react'
2
- import { useCallback, useEffect, useRef, useState } from 'react'
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
2
+
3
+ import { useTheme } from '@mui/material'
3
4
  import { autorun } from 'mobx'
4
5
  import { observer } from 'mobx-react'
5
- import { useTheme } from '@mui/material'
6
6
  import RBush from 'rbush'
7
7
 
8
- // locals
9
- import type { MsaViewModel } from '../../model'
10
- import TreeNodeMenu from './TreeNodeMenu'
11
8
  import TreeBranchMenu from './TreeBranchMenu'
9
+ import TreeNodeMenu from './TreeNodeMenu'
12
10
  import { padding, renderTreeCanvas } from './renderTreeCanvas'
13
11
 
12
+ import type { MsaViewModel } from '../../model'
13
+
14
14
  interface TooltipData {
15
15
  name: string
16
16
  id: string
@@ -36,7 +36,7 @@ const TreeCanvasBlock = observer(function ({
36
36
  offsetY: number
37
37
  }) {
38
38
  const theme = useTheme()
39
- const ref = useRef<HTMLCanvasElement>()
39
+ const ref = useRef<HTMLCanvasElement>(null)
40
40
  const clickMap = useRef(new RBush<ClickEntry>())
41
41
  const mouseoverRef = useRef<HTMLCanvasElement>(null)
42
42
  const [branchMenu, setBranchMenu] = useState<TooltipData>()
@@ -1,8 +1,8 @@
1
1
  import React, { lazy } from 'react'
2
+
2
3
  import { Menu, MenuItem } from '@mui/material'
3
4
  import { observer } from 'mobx-react'
4
5
 
5
- // locals
6
6
  import type { MsaViewModel } from '../../model'
7
7
 
8
8
  // lazies
@@ -1,9 +1,11 @@
1
1
  import React from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
3
4
 
4
- import type { MsaViewModel } from '../../model'
5
5
  import TreeCanvas from './TreeCanvas'
6
6
 
7
+ import type { MsaViewModel } from '../../model'
8
+
7
9
  const TreePanel = observer(function ({ model }: { model: MsaViewModel }) {
8
10
  const { treeAreaWidth } = model
9
11
  return (
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
+
2
3
  import { observer } from 'mobx-react'
3
4
 
4
- // locals
5
5
  import type { MsaViewModel } from '../../model'
6
6
 
7
7
  const TreeRuler = observer(({ model }: { model: MsaViewModel }) => {
@@ -1,14 +1,15 @@
1
1
  import React from 'react'
2
+
3
+ import Attributes from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/Attributes'
4
+ import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard'
2
5
  import { Dialog } from '@jbrowse/core/ui'
3
6
  import { DialogContent } from '@mui/material'
4
7
  import { observer } from 'mobx-react'
5
- import Attributes from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/Attributes'
6
- import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard'
7
8
 
8
- // locals
9
- import type { MsaViewModel } from '../../../model'
10
9
  import SequenceTextArea from '../../SequenceTextArea'
11
10
 
11
+ import type { MsaViewModel } from '../../../model'
12
+
12
13
  const TreeNodeInfoDialog = observer(function ({
13
14
  info,
14
15
  model,
@@ -1,8 +1,6 @@
1
- import type RBush from 'rbush'
2
- import type { Theme } from '@mui/material'
3
-
4
- // locals
5
1
  import type { MsaViewModel } from '../../model'
2
+ import type { Theme } from '@mui/material'
3
+ import type RBush from 'rbush'
6
4
 
7
5
  export const padding = 600
8
6
 
@@ -255,11 +253,11 @@ export function renderTreeCanvas({
255
253
 
256
254
  ctx.resetTransform()
257
255
 
258
- // this is a bogus use of nref, it is never less than 0. we just are using it
259
- // in this statement because otherwise it would be an unused variable, we
260
- // just need to use nref to indicate a redraw in an autorun when canvas ref
261
- // is updated and in order to convince bundlers like not to delete unused
262
- // usage with propertyReadSideEffects
256
+ // this is a bogus use of nref, it is never less than 0. we just are using
257
+ // it in this statement because otherwise it would be an unused variable,
258
+ // we just need to use nref to indicate a redraw in an autorun when canvas
259
+ // ref is updated and in order to convince bundlers like not to delete
260
+ // unused usage with propertyReadSideEffects
263
261
  const k =
264
262
  nref < 0
265
263
  ? Number.NEGATIVE_INFINITY
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as MSAView } from './components/Loading'
2
- export { default as MSAModelF, type MsaViewModel } from './model'
2
+ export { type MsaViewModel, default as MSAModelF } from './model'
@@ -1,5 +1,7 @@
1
1
  import { getSession } from '@jbrowse/core/util'
2
+
2
3
  import { jsonfetch, textfetch, timeout } from './fetchUtils'
4
+
3
5
  import type { MsaViewModel } from './model'
4
6
 
5
7
  const base = 'https://www.ebi.ac.uk/Tools/services/rest'
@@ -1,6 +1,7 @@
1
- import type { DialogComponentType } from '@jbrowse/core/util'
2
1
  import { types } from 'mobx-state-tree'
3
2
 
3
+ import type { DialogComponentType } from '@jbrowse/core/util'
4
+
4
5
  /**
5
6
  * #stateModel DialogQueueSessionMixin
6
7
  */
package/src/model.ts CHANGED
@@ -1,64 +1,53 @@
1
1
  import React from 'react'
2
- import type { Buffer } from 'buffer'
3
- import { autorun, transaction } from 'mobx'
4
- import { type Instance, cast, types, addDisposer } from 'mobx-state-tree'
5
- import { hierarchy, cluster, type HierarchyNode } from 'd3-hierarchy'
2
+
3
+ import { groupBy, notEmpty, sum } from '@jbrowse/core/util'
4
+ import { openLocation } from '@jbrowse/core/util/io'
5
+ import { ElementId, FileLocation } from '@jbrowse/core/util/types/mst'
6
+ import { colord } from 'colord'
6
7
  import { ascending } from 'd3-array'
7
- import Stockholm from 'stockholm-js'
8
+ import { cluster, hierarchy } from 'd3-hierarchy'
8
9
  import { saveAs } from 'file-saver'
9
- import type { Theme } from '@mui/material'
10
+ import { autorun, transaction } from 'mobx'
11
+ import { addDisposer, cast, types } from 'mobx-state-tree'
10
12
  import { ungzip } from 'pako'
13
+ import Stockholm from 'stockholm-js'
11
14
 
12
- // jbrowse
13
- import { FileLocation, ElementId } from '@jbrowse/core/util/types/mst'
14
- import type { FileLocation as FileLocationType } from '@jbrowse/core/util/types'
15
- import { openLocation } from '@jbrowse/core/util/io'
16
- import { groupBy, notEmpty, sum } from '@jbrowse/core/util'
17
-
18
- export function isGzip(buf: Buffer) {
19
- return buf[0] === 31 && buf[1] === 139 && buf[2] === 8
20
- }
21
-
22
- // locals
15
+ import { blocksX, blocksY } from './calculateBlocks'
16
+ import colorSchemes from './colorSchemes'
17
+ import TextTrack from './components/TextTrack'
18
+ import palettes from './ggplotPalettes'
19
+ import { measureTextCanvas } from './measureTextCanvas'
20
+ import { DataModelF } from './model/DataModel'
21
+ import { DialogQueueSessionMixin } from './model/DialogQueue'
22
+ import { MSAModelF } from './model/msaModel'
23
+ import { TreeModelF } from './model/treeModel'
24
+ import parseNewick from './parseNewick'
25
+ import ClustalMSA from './parsers/ClustalMSA'
26
+ import EmfMSA from './parsers/EmfMSA'
27
+ import EmfTree from './parsers/EmfTree'
28
+ import FastaMSA from './parsers/FastaMSA'
29
+ import StockholmMSA from './parsers/StockholmMSA'
30
+ import { reparseTree } from './reparseTree'
31
+ import {
32
+ globalCoordToRowSpecificCoord,
33
+ mouseOverCoordToGlobalCoord,
34
+ } from './rowCoordinateCalculations'
23
35
  import {
24
36
  clamp,
25
37
  collapse,
26
38
  generateNodeIds,
39
+ len,
27
40
  maxLength,
28
41
  setBrLength,
29
42
  skipBlanks,
30
- type NodeWithIds,
31
- type NodeWithIdsAndLength,
32
- len,
33
43
  } from './util'
34
- import { colord } from 'colord'
35
- import { reparseTree } from './reparseTree'
36
- import { blocksX, blocksY } from './calculateBlocks'
37
- import { measureTextCanvas } from './measureTextCanvas'
38
- import palettes from './ggplotPalettes'
39
44
 
40
- // components
41
- import TextTrack from './components/TextTrack'
42
-
43
- // parsers
44
- import ClustalMSA from './parsers/ClustalMSA'
45
- import EmfMSA from './parsers/EmfMSA'
46
- import StockholmMSA from './parsers/StockholmMSA'
47
- import FastaMSA from './parsers/FastaMSA'
48
- import parseNewick from './parseNewick'
49
- import colorSchemes from './colorSchemes'
50
-
51
- // models
52
- import { DataModelF } from './model/DataModel'
53
- import { DialogQueueSessionMixin } from './model/DialogQueue'
54
- import { TreeModelF } from './model/treeModel'
55
- import { MSAModelF } from './model/msaModel'
56
45
  import type { InterProScanResults } from './launchInterProScan'
57
- import {
58
- mouseOverCoordToGlobalCoord,
59
- globalCoordToRowSpecificCoord,
60
- } from './rowCoordinateCalculations'
61
- import EmfTree from './parsers/EmfTree'
46
+ import type { NodeWithIds, NodeWithIdsAndLength } from './util'
47
+ import type { FileLocation as FileLocationType } from '@jbrowse/core/util/types'
48
+ import type { Theme } from '@mui/material'
49
+ import type { HierarchyNode } from 'd3-hierarchy'
50
+ import type { Instance } from 'mobx-state-tree'
62
51
 
63
52
  export interface Accession {
64
53
  accession: string
@@ -84,6 +73,10 @@ export interface ITextTrack {
84
73
 
85
74
  export type BasicTrack = ITextTrack
86
75
 
76
+ export function isGzip(buf: Uint8Array) {
77
+ return buf[0] === 31 && buf[1] === 139 && buf[2] === 8
78
+ }
79
+
87
80
  /**
88
81
  * #stateModel MsaView
89
82
  * extends
@@ -758,6 +751,12 @@ function stateModelFactory() {
758
751
  .map(leaf => [leaf.data.name, MSA?.getRow(leaf.data.name)] as const)
759
752
  .filter((f): f is [string, string] => !!f[1])
760
753
  },
754
+ /**
755
+ * #getter
756
+ */
757
+ get numRows() {
758
+ return this.rows.length
759
+ },
761
760
 
762
761
  /**
763
762
  * #getter
@@ -917,7 +916,11 @@ function stateModelFactory() {
917
916
  * #getter
918
917
  */
919
918
  get showMsaLetters() {
920
- return self.drawMsaLetters && self.rowHeight >= 5
919
+ return (
920
+ self.drawMsaLetters &&
921
+ self.rowHeight >= 5 &&
922
+ self.colWidth > self.rowHeight / 2
923
+ )
921
924
  },
922
925
  /**
923
926
  * #getter
@@ -1356,6 +1359,15 @@ function stateModelFactory() {
1356
1359
  setFilter(arg: string, flag: boolean) {
1357
1360
  self.featureFilters.set(arg, flag)
1358
1361
  },
1362
+ /**
1363
+ * #action
1364
+ */
1365
+ showEntire() {
1366
+ self.rowHeight = self.msaAreaHeight / self.numRows
1367
+ self.colWidth = self.msaAreaWidth / self.numColumns
1368
+ self.scrollX = 0
1369
+ self.scrollY = 0
1370
+ },
1359
1371
 
1360
1372
  afterCreate() {
1361
1373
  addDisposer(
@@ -1,4 +1,5 @@
1
1
  import { parse } from 'clustal-js'
2
+
2
3
  import type { NodeWithIds } from '../util'
3
4
  export default class ClustalMSA {
4
5
  private MSA: ReturnType<typeof parse>
@@ -1,4 +1,5 @@
1
1
  import { parseEmfAln } from 'emf-js'
2
+
2
3
  import type { NodeWithIds } from '../util'
3
4
 
4
5
  export default class EmfMSA {
@@ -1,6 +1,6 @@
1
1
  import Stockholm from 'stockholm-js'
2
- import parseNewick from '../parseNewick'
3
2
 
3
+ import parseNewick from '../parseNewick'
4
4
  import { type NodeWithIds, generateNodeIds } from '../util'
5
5
  interface StockholmEntry {
6
6
  gf: {
@@ -1,18 +1,17 @@
1
1
  /* eslint-disable react-refresh/only-export-components */
2
2
  import React from 'react'
3
- import { createRoot } from 'react-dom/client'
4
- import { when } from 'mobx'
3
+
5
4
  import { renderToStaticMarkup } from '@jbrowse/core/util'
6
- import type { Theme } from '@mui/material'
5
+ import { when } from 'mobx'
7
6
 
8
- // locals
9
- import type { MsaViewModel } from './model'
10
- import { renderTreeCanvas } from './components/tree/renderTreeCanvas'
7
+ import MinimapSVG from './components/minimap/MinimapSVG'
8
+ import { renderBoxFeatureCanvasBlock } from './components/msa/renderBoxFeatureCanvasBlock'
11
9
  import { renderMSABlock } from './components/msa/renderMSABlock'
10
+ import { renderTreeCanvas } from './components/tree/renderTreeCanvas'
12
11
  import { colorContrast } from './util'
13
12
 
14
- import MinimapSVG from './components/minimap/MinimapSVG'
15
- import { renderBoxFeatureCanvasBlock } from './components/msa/renderBoxFeatureCanvasBlock'
13
+ import type { MsaViewModel } from './model'
14
+ import type { Theme } from '@mui/material'
16
15
 
17
16
  export async function renderToSvg(
18
17
  model: MsaViewModel,
@@ -81,7 +80,6 @@ async function render({
81
80
  />
82
81
  </Wrapper>
83
82
  </SvgWrapper>,
84
- createRoot,
85
83
  )
86
84
  }
87
85
 
@@ -1,4 +1,5 @@
1
1
  import { expect, test } from 'vitest'
2
+
2
3
  import { mouseOverCoordToGlobalCoord } from './rowCoordinateCalculations'
3
4
  test('blanks3', () => {
4
5
  const blanks = [2, 5, 8]
package/src/util.ts CHANGED
@@ -1,8 +1,9 @@
1
- import type { HierarchyNode } from 'd3-hierarchy'
2
- import { max } from 'd3-array'
3
- import type { Theme } from '@mui/material'
4
1
  import { colord, extend } from 'colord'
5
2
  import namesPlugin from 'colord/plugins/names'
3
+ import { max } from 'd3-array'
4
+
5
+ import type { Theme } from '@mui/material'
6
+ import type { HierarchyNode } from 'd3-hierarchy'
6
7
 
7
8
  extend([namesPlugin])
8
9
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '4.0.3'
1
+ export const version = '4.1.0'