@apollo-annotation/jbrowse-plugin-apollo 0.3.5 → 0.3.6

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 (126) hide show
  1. package/dist/index.esm.js +5474 -4937
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/jbrowse-plugin-apollo.cjs.development.js +4609 -4089
  4. package/dist/jbrowse-plugin-apollo.cjs.development.js.map +1 -1
  5. package/dist/jbrowse-plugin-apollo.cjs.production.min.js +1 -1
  6. package/dist/jbrowse-plugin-apollo.cjs.production.min.js.map +1 -1
  7. package/dist/jbrowse-plugin-apollo.umd.development.js +3634 -3500
  8. package/dist/jbrowse-plugin-apollo.umd.development.js.map +1 -1
  9. package/dist/jbrowse-plugin-apollo.umd.production.min.js +1 -1
  10. package/dist/jbrowse-plugin-apollo.umd.production.min.js.map +1 -1
  11. package/package.json +4 -4
  12. package/src/ApolloInternetAccount/addMenuItems.ts +5 -2
  13. package/src/ApolloInternetAccount/components/AuthTypeSelector.tsx +1 -0
  14. package/src/ApolloInternetAccount/components/LoginButtons.tsx +1 -1
  15. package/src/ApolloInternetAccount/components/LoginIcons.tsx +1 -1
  16. package/src/ApolloInternetAccount/configSchema.ts +1 -1
  17. package/src/ApolloInternetAccount/model.ts +11 -10
  18. package/src/ApolloJobModel.ts +1 -1
  19. package/src/ApolloRefNameAliasAdapter/ApolloRefNameAliasAdapter.ts +8 -6
  20. package/src/ApolloRefNameAliasAdapter/index.ts +2 -2
  21. package/src/ApolloSequenceAdapter/ApolloSequenceAdapter.ts +4 -4
  22. package/src/ApolloSequenceAdapter/index.ts +1 -1
  23. package/src/ApolloTextSearchAdapter/ApolloTextSearchAdapter.ts +8 -7
  24. package/src/ApolloTextSearchAdapter/index.ts +1 -1
  25. package/src/BackendDrivers/BackendDriver.ts +7 -7
  26. package/src/BackendDrivers/CollaborationServerDriver.ts +14 -10
  27. package/src/BackendDrivers/DesktopFileDriver.ts +11 -10
  28. package/src/BackendDrivers/InMemoryFileDriver.ts +10 -6
  29. package/src/ChangeManager.ts +5 -5
  30. package/src/FeatureDetailsWidget/ApolloFeatureDetailsWidget.tsx +8 -7
  31. package/src/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.tsx +35 -14
  32. package/src/FeatureDetailsWidget/AttributeKey.tsx +50 -0
  33. package/src/FeatureDetailsWidget/AttributeKeySelector.tsx +104 -0
  34. package/src/FeatureDetailsWidget/Attributes.tsx +210 -367
  35. package/src/FeatureDetailsWidget/BasicInformation.tsx +6 -5
  36. package/src/FeatureDetailsWidget/DefaultAttributeEditor.tsx +104 -0
  37. package/src/FeatureDetailsWidget/DefaultAttributeViewer.tsx +22 -0
  38. package/src/FeatureDetailsWidget/FeatureDetailsNavigation.tsx +4 -4
  39. package/src/FeatureDetailsWidget/NumberTextField.tsx +1 -1
  40. package/src/FeatureDetailsWidget/Sequence.tsx +2 -2
  41. package/src/FeatureDetailsWidget/StringTextField.tsx +1 -1
  42. package/src/FeatureDetailsWidget/TranscriptSequence.tsx +3 -3
  43. package/src/FeatureDetailsWidget/TranscriptWidgetEditLocation.tsx +21 -21
  44. package/src/FeatureDetailsWidget/TranscriptWidgetSummary.tsx +4 -4
  45. package/src/FeatureDetailsWidget/model.ts +8 -3
  46. package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +6 -6
  47. package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +13 -14
  48. package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +9 -9
  49. package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +6 -5
  50. package/src/LinearApolloDisplay/glyphs/Glyph.ts +7 -7
  51. package/src/LinearApolloDisplay/stateModel/base.ts +52 -10
  52. package/src/LinearApolloDisplay/stateModel/index.ts +4 -3
  53. package/src/LinearApolloDisplay/stateModel/layouts.ts +8 -39
  54. package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +13 -12
  55. package/src/LinearApolloDisplay/stateModel/rendering.ts +59 -31
  56. package/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx +221 -0
  57. package/src/LinearApolloSixFrameDisplay/components/TrackLines.tsx +40 -0
  58. package/src/LinearApolloSixFrameDisplay/components/index.ts +2 -0
  59. package/src/LinearApolloSixFrameDisplay/configSchema.ts +7 -0
  60. package/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts +821 -0
  61. package/src/LinearApolloSixFrameDisplay/glyphs/Glyph.ts +63 -0
  62. package/src/LinearApolloSixFrameDisplay/glyphs/index.ts +1 -0
  63. package/src/LinearApolloSixFrameDisplay/index.ts +2 -0
  64. package/src/LinearApolloSixFrameDisplay/stateModel/base.ts +261 -0
  65. package/src/LinearApolloSixFrameDisplay/stateModel/index.ts +27 -0
  66. package/src/LinearApolloSixFrameDisplay/stateModel/layouts.ts +236 -0
  67. package/src/LinearApolloSixFrameDisplay/stateModel/mouseEvents.ts +349 -0
  68. package/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts +199 -0
  69. package/src/LinearApolloSixFrameDisplay/types.ts +1 -0
  70. package/src/OntologyManager/OntologyStore/fulltext.test.ts +1 -1
  71. package/src/OntologyManager/OntologyStore/fulltext.ts +8 -3
  72. package/src/OntologyManager/OntologyStore/index.test.ts +3 -1
  73. package/src/OntologyManager/OntologyStore/index.ts +19 -14
  74. package/src/OntologyManager/OntologyStore/indexeddb-schema.ts +6 -5
  75. package/src/OntologyManager/OntologyStore/indexeddb-storage.ts +11 -5
  76. package/src/OntologyManager/index.ts +8 -6
  77. package/src/OntologyManager/util.ts +3 -2
  78. package/src/TabularEditor/HybridGrid/ChangeHandling.ts +2 -2
  79. package/src/TabularEditor/HybridGrid/Feature.tsx +9 -7
  80. package/src/TabularEditor/HybridGrid/FeatureAttributes.tsx +1 -1
  81. package/src/TabularEditor/HybridGrid/HybridGrid.tsx +3 -2
  82. package/src/TabularEditor/HybridGrid/ToolBar.tsx +1 -1
  83. package/src/TabularEditor/HybridGrid/featureContextMenuItems.ts +6 -6
  84. package/src/TabularEditor/TabularEditorPane.tsx +1 -1
  85. package/src/TabularEditor/model.ts +2 -2
  86. package/src/TabularEditor/types.ts +5 -2
  87. package/src/components/AddAssembly.tsx +182 -179
  88. package/src/components/AddChildFeature.tsx +6 -5
  89. package/src/components/AddFeature.tsx +211 -38
  90. package/src/components/AddRefSeqAliases.tsx +14 -12
  91. package/src/components/CopyFeature.tsx +8 -7
  92. package/src/components/CreateApolloAnnotation.tsx +9 -8
  93. package/src/components/DeleteAssembly.tsx +9 -8
  94. package/src/components/DeleteFeature.tsx +5 -4
  95. package/src/components/Dialog.tsx +1 -1
  96. package/src/components/DownloadGFF3.tsx +11 -10
  97. package/src/components/FilterFeatures.tsx +6 -4
  98. package/src/components/ImportFeatures.tsx +7 -6
  99. package/src/components/LogOut.tsx +5 -4
  100. package/src/components/ManageChecks.tsx +9 -8
  101. package/src/components/ManageUsers.tsx +11 -10
  102. package/src/components/OntologyTermAutocomplete.tsx +5 -5
  103. package/src/components/OntologyTermMultiSelect.tsx +6 -6
  104. package/src/components/OpenLocalFile.tsx +4 -3
  105. package/src/components/ViewChangeLog.tsx +7 -6
  106. package/src/components/ViewCheckResults.tsx +8 -7
  107. package/src/extensions/annotationFromJBrowseFeature.test.ts +1 -0
  108. package/src/extensions/annotationFromJBrowseFeature.ts +11 -10
  109. package/src/extensions/annotationFromPileup.ts +6 -6
  110. package/src/index.ts +33 -50
  111. package/src/makeDisplayComponent.tsx +90 -37
  112. package/src/session/ClientDataStore.ts +21 -17
  113. package/src/session/session.ts +20 -26
  114. package/src/types.ts +4 -4
  115. package/src/util/annotationFeatureUtils.ts +1 -1
  116. package/src/util/index.ts +3 -3
  117. package/src/util/loadAssemblyIntoClient.ts +10 -3
  118. package/src/ApolloSixFrameRenderer/ApolloSixFrameRenderer.tsx +0 -13
  119. package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +0 -707
  120. package/src/ApolloSixFrameRenderer/configSchema.ts +0 -7
  121. package/src/ApolloSixFrameRenderer/index.ts +0 -3
  122. package/src/SixFrameFeatureDisplay/components/TrackLines.tsx +0 -19
  123. package/src/SixFrameFeatureDisplay/components/index.ts +0 -1
  124. package/src/SixFrameFeatureDisplay/configSchema.ts +0 -21
  125. package/src/SixFrameFeatureDisplay/index.ts +0 -2
  126. package/src/SixFrameFeatureDisplay/stateModel.ts +0 -443
@@ -0,0 +1,104 @@
1
+ import AddBoxIcon from '@mui/icons-material/AddBox'
2
+ import DeleteIcon from '@mui/icons-material/Delete'
3
+ import { Button, DialogActions, IconButton } from '@mui/material'
4
+ import { observer } from 'mobx-react'
5
+ import React, { useState } from 'react'
6
+
7
+ import { type ApolloSessionModel } from '../session'
8
+
9
+ import { StringTextField } from './StringTextField'
10
+
11
+ export interface AttributeEditorProps {
12
+ session: ApolloSessionModel
13
+ attributeValues?: string[]
14
+ setAttribute: (newAttribute?: string[]) => void
15
+ isNew?: boolean
16
+ }
17
+
18
+ export const DefaultAttributeEditor = observer(function DefaultAttributeEditor({
19
+ attributeValues,
20
+ setAttribute,
21
+ isNew = false,
22
+ }: AttributeEditorProps) {
23
+ const [newValues, setNewValues] = useState<string[]>(
24
+ attributeValues && attributeValues.length > 0 ? attributeValues : [''],
25
+ )
26
+
27
+ function updateValue(idx: number, newValue: string) {
28
+ setNewValues((oldValues) => {
29
+ const newValues = [...oldValues]
30
+ newValues[idx] = newValue
31
+ return newValues
32
+ })
33
+ }
34
+ function deleteValue(idx: number) {
35
+ setNewValues((oldValues) => {
36
+ const newValues = [...oldValues]
37
+ newValues.splice(idx, 1)
38
+ return newValues
39
+ })
40
+ }
41
+ function addValue() {
42
+ setNewValues((oldValues) => {
43
+ const newValues = [...oldValues]
44
+ newValues.push('')
45
+ return newValues
46
+ })
47
+ }
48
+
49
+ return (
50
+ <>
51
+ {newValues.map((value, idx) => (
52
+ <div key={`${idx}-${value}`} style={{ display: 'flex' }}>
53
+ <StringTextField
54
+ value={value}
55
+ onChangeCommitted={(editedValue) => {
56
+ updateValue(idx, editedValue)
57
+ }}
58
+ variant="outlined"
59
+ fullWidth
60
+ />
61
+ <IconButton
62
+ aria-label="delete"
63
+ size="medium"
64
+ edge="end"
65
+ onClick={() => {
66
+ deleteValue(idx)
67
+ }}
68
+ >
69
+ <DeleteIcon fontSize="inherit" />
70
+ </IconButton>
71
+ </div>
72
+ ))}
73
+ <IconButton
74
+ aria-label="add"
75
+ size="medium"
76
+ color="secondary"
77
+ edge="start"
78
+ onClick={addValue}
79
+ >
80
+ <AddBoxIcon fontSize="inherit" />
81
+ </IconButton>
82
+ <DialogActions>
83
+ <Button
84
+ color="primary"
85
+ variant="contained"
86
+ onClick={() => {
87
+ setAttribute(newValues.filter(Boolean))
88
+ }}
89
+ >
90
+ {isNew ? 'Add' : 'Update'}
91
+ </Button>
92
+ <Button
93
+ variant="outlined"
94
+ type="submit"
95
+ onClick={() => {
96
+ setAttribute()
97
+ }}
98
+ >
99
+ Cancel
100
+ </Button>
101
+ </DialogActions>
102
+ </>
103
+ )
104
+ })
@@ -0,0 +1,22 @@
1
+ import { Typography } from '@mui/material'
2
+ import React from 'react'
3
+
4
+ export interface AttributeViewerProps {
5
+ values: string[] | undefined
6
+ }
7
+
8
+ export function DefaultAttributeViewer({ values }: AttributeViewerProps) {
9
+ return (
10
+ <>
11
+ {values?.map((value, idx) => (
12
+ <Typography
13
+ key={`${idx}.${value}`}
14
+ variant="body2"
15
+ color="textSecondary"
16
+ >
17
+ {value}
18
+ </Typography>
19
+ ))}
20
+ </>
21
+ )
22
+ }
@@ -1,12 +1,12 @@
1
- import React from 'react'
2
-
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
3
2
  import { Button, Typography } from '@mui/material'
4
3
  import { observer } from 'mobx-react'
4
+ import React from 'react'
5
5
 
6
- import { AnnotationFeature } from '@apollo-annotation/mst'
7
- import { ApolloFeatureDetailsWidget as ApolloFeatureDetails } from './model'
8
6
  import { getFeatureNameOrId } from '../util'
9
7
 
8
+ import { type ApolloFeatureDetailsWidget as ApolloFeatureDetails } from './model'
9
+
10
10
  export const FeatureDetailsNavigation = observer(
11
11
  function FeatureDetailsNavigation(props: {
12
12
  model: ApolloFeatureDetails
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/unbound-method */
2
2
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
3
- import { TextField, TextFieldProps } from '@mui/material'
3
+ import { TextField, type TextFieldProps } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
  import React, { useEffect, useState } from 'react'
6
6
 
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
- import { AnnotationFeature } from '@apollo-annotation/mst'
2
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
3
3
  import { splitStringIntoChunks } from '@apollo-annotation/shared'
4
4
  import { observer } from 'mobx-react'
5
5
  import React from 'react'
6
6
  import { makeStyles } from 'tss-react/mui'
7
7
 
8
- import { ApolloSessionModel } from '../session'
8
+ import { type ApolloSessionModel } from '../session'
9
9
 
10
10
  function formatSequence(
11
11
  seq: string,
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/unbound-method */
2
2
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
3
- import { TextField, TextFieldProps } from '@mui/material'
3
+ import { TextField, type TextFieldProps } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
  import React, { useEffect, useState } from 'react'
6
6
 
@@ -1,4 +1,4 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
2
  import { splitStringIntoChunks } from '@apollo-annotation/shared'
3
3
  import { defaultCodonTable, revcom } from '@jbrowse/core/util'
4
4
  import {
@@ -6,13 +6,13 @@ import {
6
6
  MenuItem,
7
7
  Paper,
8
8
  Select,
9
- SelectChangeEvent,
9
+ type SelectChangeEvent,
10
10
  useTheme,
11
11
  } from '@mui/material'
12
12
  import { observer } from 'mobx-react'
13
13
  import React, { useEffect, useRef, useState } from 'react'
14
14
 
15
- import { ApolloSessionModel } from '../session'
15
+ import { type ApolloSessionModel } from '../session'
16
16
 
17
17
  const SEQUENCE_WRAP_LENGTH = 60
18
18
 
@@ -3,11 +3,25 @@
3
3
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
4
4
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
5
  /* eslint-disable @typescript-eslint/no-unsafe-return */
6
- import React, { useRef } from 'react'
7
-
8
- import { observer } from 'mobx-react'
9
-
6
+ import {
7
+ type AnnotationFeature,
8
+ type TranscriptPart,
9
+ } from '@apollo-annotation/mst'
10
+ import {
11
+ LocationEndChange,
12
+ LocationStartChange,
13
+ } from '@apollo-annotation/shared'
10
14
  import styled from '@emotion/styled'
15
+ import {
16
+ type AbstractSessionModel,
17
+ defaultCodonTable,
18
+ revcom,
19
+ } from '@jbrowse/core/util'
20
+ import AddIcon from '@mui/icons-material/Add'
21
+ import ContentCopyIcon from '@mui/icons-material/ContentCopy'
22
+ import ContentCutIcon from '@mui/icons-material/ContentCut'
23
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
24
+ import RemoveIcon from '@mui/icons-material/Remove'
11
25
  import {
12
26
  Accordion,
13
27
  AccordionDetails,
@@ -15,27 +29,13 @@ import {
15
29
  Tooltip,
16
30
  Typography,
17
31
  } from '@mui/material'
32
+ import { observer } from 'mobx-react'
33
+ import React, { useRef } from 'react'
18
34
 
19
- import AddIcon from '@mui/icons-material/Add'
20
- import RemoveIcon from '@mui/icons-material/Remove'
21
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
22
- import ContentCopyIcon from '@mui/icons-material/ContentCopy'
23
- import ContentCutIcon from '@mui/icons-material/ContentCut'
24
-
25
- import { AnnotationFeature, TranscriptPart } from '@apollo-annotation/mst'
35
+ import { type ApolloSessionModel } from '../session'
26
36
 
27
37
  import { StyledAccordionSummary } from './ApolloTranscriptDetailsWidget'
28
38
  import { NumberTextField } from './NumberTextField'
29
- import { ApolloSessionModel } from '../session'
30
- import {
31
- AbstractSessionModel,
32
- defaultCodonTable,
33
- revcom,
34
- } from '@jbrowse/core/util'
35
- import {
36
- LocationEndChange,
37
- LocationStartChange,
38
- } from '@apollo-annotation/shared'
39
39
 
40
40
  const StyledTextField = styled(NumberTextField)(() => ({
41
41
  '&.MuiFormControl-root': {
@@ -1,10 +1,10 @@
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
+ import styled from '@emotion/styled'
3
+ import { Table, TableBody, TableCell, TableRow } from '@mui/material'
4
+ import { observer } from 'mobx-react'
1
5
  import React from 'react'
2
6
 
3
- import { AnnotationFeature } from '@apollo-annotation/mst'
4
- import { observer } from 'mobx-react'
5
7
  import { getFeatureId, getFeatureName, getStrand } from '../util'
6
- import { Table, TableBody, TableCell, TableRow } from '@mui/material'
7
- import styled from '@emotion/styled'
8
8
 
9
9
  const HeaderTableCell = styled(TableCell)(() => ({
10
10
  fontWeight: 'bold',
@@ -1,15 +1,20 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-call */
2
2
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
3
  import {
4
- AnnotationFeature,
4
+ type AnnotationFeature,
5
5
  AnnotationFeatureModel,
6
6
  } from '@apollo-annotation/mst'
7
7
  import { getSession } from '@jbrowse/core/util'
8
8
  import { ElementId } from '@jbrowse/core/util/types/mst'
9
9
  import { autorun } from 'mobx'
10
- import { Instance, SnapshotIn, addDisposer, types } from 'mobx-state-tree'
10
+ import {
11
+ type Instance,
12
+ type SnapshotIn,
13
+ addDisposer,
14
+ types,
15
+ } from 'mobx-state-tree'
11
16
 
12
- import { ApolloSessionModel } from '../session'
17
+ import { type ApolloSessionModel } from '../session'
13
18
 
14
19
  export const ApolloFeatureDetailsWidgetModel = types
15
20
  .model('ApolloFeatureDetailsWidget', {
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable @typescript-eslint/unbound-method */
2
2
  /* eslint-disable @typescript-eslint/no-misused-promises */
3
3
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
4
- import { Menu, MenuItem } from '@jbrowse/core/ui'
4
+ import { Menu, type MenuItem } from '@jbrowse/core/ui'
5
5
  import {
6
- AbstractSessionModel,
6
+ type AbstractSessionModel,
7
7
  doesIntersect2,
8
8
  getContainingView,
9
9
  } from '@jbrowse/core/util'
10
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
10
+ import { type LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
11
11
  import ErrorIcon from '@mui/icons-material/Error'
12
12
  import {
13
13
  Alert,
@@ -20,7 +20,7 @@ import { observer } from 'mobx-react'
20
20
  import React, { useEffect, useState } from 'react'
21
21
  import { makeStyles } from 'tss-react/mui'
22
22
 
23
- import { LinearApolloDisplay as LinearApolloDisplayI } from '../stateModel'
23
+ import { type LinearApolloDisplay as LinearApolloDisplayI } from '../stateModel'
24
24
 
25
25
  interface LinearApolloDisplayProps {
26
26
  model: LinearApolloDisplayI
@@ -95,7 +95,7 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
95
95
  const { assemblyManager } = session as unknown as AbstractSessionModel
96
96
  return (
97
97
  <>
98
- {lgv.bpPerPx <= 3 ? (
98
+ {3 / lgv.bpPerPx >= 1 ? (
99
99
  <div
100
100
  className={classes.canvasContainer}
101
101
  style={{
@@ -238,7 +238,7 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
238
238
  pointerEvents: apolloDragging ? 'none' : 'auto',
239
239
  }}
240
240
  >
241
- <ErrorIcon />
241
+ <ErrorIcon data-testid="ErrorIcon" />
242
242
  </Avatar>
243
243
  </Tooltip>
244
244
  )
@@ -1,25 +1,24 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
2
- import { Theme, alpha } from '@mui/material'
3
- import { MenuItem } from '@jbrowse/core/ui'
4
-
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
+ import { type MenuItem } from '@jbrowse/core/ui'
5
3
  import {
6
- AbstractSessionModel,
4
+ type AbstractSessionModel,
5
+ type SessionWithWidgets,
7
6
  isSessionModelWithWidgets,
8
- SessionWithWidgets,
9
7
  } from '@jbrowse/core/util'
8
+ import { type Theme, alpha } from '@mui/material'
10
9
 
11
10
  import { AddChildFeature, CopyFeature, DeleteFeature } from '../../components'
12
-
13
- import { LinearApolloDisplay } from '../stateModel'
11
+ import { type LinearApolloDisplay } from '../stateModel'
14
12
  import {
13
+ type LinearApolloDisplayMouseEvents,
14
+ type MousePosition,
15
+ type MousePositionWithFeatureAndGlyph,
15
16
  isMousePositionWithFeatureAndGlyph,
16
- LinearApolloDisplayMouseEvents,
17
- MousePosition,
18
- MousePositionWithFeatureAndGlyph,
19
17
  } from '../stateModel/mouseEvents'
20
- import { CanvasMouseEvent } from '../types'
21
- import { Glyph } from './Glyph'
22
- import { LinearApolloDisplayRendering } from '../stateModel/rendering'
18
+ import { type LinearApolloDisplayRendering } from '../stateModel/rendering'
19
+ import { type CanvasMouseEvent } from '../types'
20
+
21
+ import { type Glyph } from './Glyph'
23
22
 
24
23
  function drawBoxOutline(
25
24
  ctx: CanvasRenderingContext2D,
@@ -1,18 +1,19 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
2
  import { getFrame, intersection2 } from '@jbrowse/core/util'
3
3
  import { alpha } from '@mui/material'
4
4
 
5
- import { LinearApolloDisplay } from '../stateModel'
5
+ import { type OntologyRecord } from '../../OntologyManager'
6
+ import { type LinearApolloDisplay } from '../stateModel'
6
7
  import {
8
+ type MousePosition,
9
+ type MousePositionWithFeatureAndGlyph,
7
10
  isMousePositionWithFeatureAndGlyph,
8
- MousePosition,
9
- MousePositionWithFeatureAndGlyph,
10
11
  } from '../stateModel/mouseEvents'
11
- import { CanvasMouseEvent } from '../types'
12
- import { Glyph } from './Glyph'
12
+ import { type LinearApolloDisplayRendering } from '../stateModel/rendering'
13
+ import { type CanvasMouseEvent } from '../types'
14
+
13
15
  import { boxGlyph } from './BoxGlyph'
14
- import { LinearApolloDisplayRendering } from '../stateModel/rendering'
15
- import { OntologyRecord } from '../../OntologyManager'
16
+ import { type Glyph } from './Glyph'
16
17
 
17
18
  let forwardFillLight: CanvasPattern | null = null
18
19
  let backwardFillLight: CanvasPattern | null = null
@@ -225,7 +226,6 @@ function draw(
225
226
  apolloSelectedFeature && _id === apolloSelectedFeature._id
226
227
  ? 'rgb(0,0,0)'
227
228
  : cdsColorCode
228
- ctx.fillStyle = cdsColorCode
229
229
  ctx.fillRect(
230
230
  cdsStartPx + 1,
231
231
  cdsTop + 1,
@@ -1,9 +1,10 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
2
 
3
- import { LinearApolloDisplay } from '../stateModel'
4
- import { boxGlyph, isSelectedFeature, drawBox } from './BoxGlyph'
5
- import { Glyph } from './Glyph'
6
- import { LinearApolloDisplayRendering } from '../stateModel/rendering'
3
+ import { type LinearApolloDisplay } from '../stateModel'
4
+ import { type LinearApolloDisplayRendering } from '../stateModel/rendering'
5
+
6
+ import { boxGlyph, drawBox, isSelectedFeature } from './BoxGlyph'
7
+ import { type Glyph } from './Glyph'
7
8
 
8
9
  function featuresForRow(feature: AnnotationFeature): AnnotationFeature[][] {
9
10
  const features = [[feature]]
@@ -1,13 +1,13 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
2
- import { MenuItem } from '@jbrowse/core/ui'
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
+ import { type MenuItem } from '@jbrowse/core/ui'
3
3
 
4
+ import { type OntologyRecord } from '../../OntologyManager'
4
5
  import {
5
- LinearApolloDisplayMouseEvents,
6
- MousePositionWithFeatureAndGlyph,
6
+ type LinearApolloDisplayMouseEvents,
7
+ type MousePositionWithFeatureAndGlyph,
7
8
  } from '../stateModel/mouseEvents'
8
- import { LinearApolloDisplayRendering } from '../stateModel/rendering'
9
- import { CanvasMouseEvent } from '../types'
10
- import { OntologyRecord } from '../../OntologyManager'
9
+ import { type LinearApolloDisplayRendering } from '../stateModel/rendering'
10
+ import { type CanvasMouseEvent } from '../types'
11
11
 
12
12
  export interface Glyph {
13
13
  /** @returns number of layout rows used by this glyph with this feature and zoom level */
@@ -3,26 +3,26 @@
3
3
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
4
4
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
5
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
6
- import { AnnotationFeature } from '@apollo-annotation/mst'
6
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
7
+ import type PluginManager from '@jbrowse/core/PluginManager'
7
8
  import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'
8
- import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
9
+ import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
9
10
  import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes'
10
- import PluginManager from '@jbrowse/core/PluginManager'
11
11
  import {
12
- AbstractSessionModel,
12
+ type AbstractSessionModel,
13
13
  getContainingView,
14
14
  getSession,
15
15
  } from '@jbrowse/core/util'
16
16
  import { getParentRenderProps } from '@jbrowse/core/util/tracks'
17
17
  // import type LinearGenomeViewPlugin from '@jbrowse/plugin-linear-genome-view'
18
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
18
+ import { type LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
19
19
  import { autorun } from 'mobx'
20
- import { addDisposer, cast, getRoot, types, getSnapshot } from 'mobx-state-tree'
20
+ import { addDisposer, cast, getRoot, getSnapshot, types } from 'mobx-state-tree'
21
21
 
22
- import { ApolloInternetAccountModel } from '../../ApolloInternetAccount/model'
23
- import { ApolloSessionModel } from '../../session'
24
- import { ApolloRootModel } from '../../types'
22
+ import { type ApolloInternetAccountModel } from '../../ApolloInternetAccount/model'
25
23
  import { FilterFeatures } from '../../components/FilterFeatures'
24
+ import { type ApolloSessionModel } from '../../session'
25
+ import { type ApolloRootModel } from '../../types'
26
26
 
27
27
  const minDisplayHeight = 20
28
28
 
@@ -36,6 +36,9 @@ export function baseModelFactory(
36
36
  configuration: ConfigurationReference(configSchema),
37
37
  graphical: true,
38
38
  table: false,
39
+ showStartCodons: false,
40
+ showStopCodons: true,
41
+ highContrast: false,
39
42
  heightPreConfig: types.maybe(
40
43
  types.refinement(
41
44
  'displayHeight',
@@ -168,6 +171,15 @@ export function baseModelFactory(
168
171
  self.graphical = true
169
172
  self.table = true
170
173
  },
174
+ toggleShowStartCodons() {
175
+ self.showStartCodons = !self.showStartCodons
176
+ },
177
+ toggleShowStopCodons() {
178
+ self.showStopCodons = !self.showStopCodons
179
+ },
180
+ toggleHighContrast() {
181
+ self.highContrast = !self.highContrast
182
+ },
171
183
  updateFilteredFeatureTypes(types: string[]) {
172
184
  self.filteredFeatureTypes = cast(types)
173
185
  },
@@ -179,7 +191,13 @@ export function baseModelFactory(
179
191
  const { filteredFeatureTypes, trackMenuItems: superTrackMenuItems } = self
180
192
  return {
181
193
  trackMenuItems() {
182
- const { graphical, table } = self
194
+ const {
195
+ graphical,
196
+ table,
197
+ showStartCodons,
198
+ showStopCodons,
199
+ highContrast,
200
+ } = self
183
201
  return [
184
202
  ...superTrackMenuItems(),
185
203
  {
@@ -210,6 +228,30 @@ export function baseModelFactory(
210
228
  self.showGraphicalAndTable()
211
229
  },
212
230
  },
231
+ {
232
+ label: 'Show start codons',
233
+ type: 'checkbox',
234
+ checked: showStartCodons,
235
+ onClick: () => {
236
+ self.toggleShowStartCodons()
237
+ },
238
+ },
239
+ {
240
+ label: 'Show stop codons',
241
+ type: 'checkbox',
242
+ checked: showStopCodons,
243
+ onClick: () => {
244
+ self.toggleShowStopCodons()
245
+ },
246
+ },
247
+ {
248
+ label: 'Use high contrast colors',
249
+ type: 'checkbox',
250
+ checked: highContrast,
251
+ onClick: () => {
252
+ self.toggleHighContrast()
253
+ },
254
+ },
213
255
  ],
214
256
  },
215
257
  {
@@ -1,8 +1,9 @@
1
- import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
2
- import PluginManager from '@jbrowse/core/PluginManager'
3
- import { Instance, types } from 'mobx-state-tree'
1
+ import type PluginManager from '@jbrowse/core/PluginManager'
2
+ import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
3
+ import { type Instance, types } from 'mobx-state-tree'
4
4
 
5
5
  import { TabularEditorStateModelType } from '../../TabularEditor'
6
+
6
7
  import { mouseEventsModelFactory } from './mouseEvents'
7
8
 
8
9
  export function stateModelFactory(
@@ -1,16 +1,17 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
2
 
3
- import { AnnotationFeature } from '@apollo-annotation/mst'
4
- import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
5
- import PluginManager from '@jbrowse/core/PluginManager'
6
- import { AbstractSessionModel, doesIntersect2 } from '@jbrowse/core/util'
3
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
4
+ import type PluginManager from '@jbrowse/core/PluginManager'
5
+ import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
6
+ import { type AbstractSessionModel, doesIntersect2 } from '@jbrowse/core/util'
7
7
  import { autorun, observable } from 'mobx'
8
8
  import { addDisposer, isAlive } from 'mobx-state-tree'
9
9
 
10
- import { ApolloSessionModel } from '../../session'
11
- import { baseModelFactory } from './base'
10
+ import { type ApolloSessionModel } from '../../session'
12
11
  import { boxGlyph, geneGlyph, genericChildGlyph } from '../glyphs'
13
12
 
13
+ import { baseModelFactory } from './base'
14
+
14
15
  function getRowsForFeature(
15
16
  startingRow: number,
16
17
  rowCount: number,
@@ -62,7 +63,7 @@ export function layoutsModelFactory(
62
63
  return self.seenFeatures.get(id)
63
64
  },
64
65
  getGlyph(feature: AnnotationFeature) {
65
- if (this.looksLikeGene(feature)) {
66
+ if (feature.looksLikeGene) {
66
67
  return geneGlyph
67
68
  }
68
69
  if (feature.children?.size) {
@@ -70,38 +71,6 @@ export function layoutsModelFactory(
70
71
  }
71
72
  return boxGlyph
72
73
  },
73
- looksLikeGene(feature: AnnotationFeature): boolean {
74
- const { featureTypeOntology } =
75
- self.session.apolloDataStore.ontologyManager
76
- if (!featureTypeOntology) {
77
- return false
78
- }
79
- const { children } = feature
80
- if (!children?.size) {
81
- return false
82
- }
83
- const isGene =
84
- featureTypeOntology.isTypeOf(feature.type, 'gene') ||
85
- featureTypeOntology.isTypeOf(feature.type, 'pseudogene')
86
- if (!isGene) {
87
- return false
88
- }
89
- for (const [, child] of children) {
90
- if (
91
- featureTypeOntology.isTypeOf(child.type, 'transcript') ||
92
- featureTypeOntology.isTypeOf(child.type, 'pseudogenic_transcript')
93
- ) {
94
- const { children: grandChildren } = child
95
- if (!grandChildren?.size) {
96
- return false
97
- }
98
- return [...grandChildren.values()].some((grandchild) =>
99
- featureTypeOntology.isTypeOf(grandchild.type, 'exon'),
100
- )
101
- }
102
- }
103
- return false
104
- },
105
74
  }))
106
75
  .actions((self) => ({
107
76
  addSeenFeature(feature: AnnotationFeature) {