@apollo-annotation/jbrowse-plugin-apollo 0.3.4 → 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 (131) hide show
  1. package/dist/index.esm.js +5466 -4490
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/jbrowse-plugin-apollo.cjs.development.js +5283 -4318
  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 +6806 -4088
  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 +17 -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 +92 -20
  31. package/src/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.tsx +170 -27
  32. package/src/FeatureDetailsWidget/AttributeKey.tsx +50 -0
  33. package/src/FeatureDetailsWidget/AttributeKeySelector.tsx +104 -0
  34. package/src/FeatureDetailsWidget/Attributes.tsx +213 -320
  35. package/src/FeatureDetailsWidget/BasicInformation.tsx +8 -9
  36. package/src/FeatureDetailsWidget/DefaultAttributeEditor.tsx +104 -0
  37. package/src/FeatureDetailsWidget/DefaultAttributeViewer.tsx +22 -0
  38. package/src/FeatureDetailsWidget/FeatureDetailsNavigation.tsx +10 -8
  39. package/src/FeatureDetailsWidget/NumberTextField.tsx +1 -1
  40. package/src/FeatureDetailsWidget/Sequence.tsx +18 -35
  41. package/src/FeatureDetailsWidget/StringTextField.tsx +1 -1
  42. package/src/FeatureDetailsWidget/TranscriptSequence.tsx +140 -95
  43. package/src/FeatureDetailsWidget/TranscriptWidgetEditLocation.tsx +600 -0
  44. package/src/FeatureDetailsWidget/TranscriptWidgetSummary.tsx +54 -0
  45. package/src/FeatureDetailsWidget/model.ts +8 -3
  46. package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +19 -12
  47. package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +19 -41
  48. package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +44 -22
  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 -34
  54. package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +13 -12
  55. package/src/LinearApolloDisplay/stateModel/rendering.ts +63 -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-stopwords.ts +10 -1
  71. package/src/OntologyManager/OntologyStore/fulltext.test.ts +1 -1
  72. package/src/OntologyManager/OntologyStore/fulltext.ts +8 -3
  73. package/src/OntologyManager/OntologyStore/index.test.ts +4 -1
  74. package/src/OntologyManager/OntologyStore/index.ts +19 -14
  75. package/src/OntologyManager/OntologyStore/indexeddb-schema.ts +6 -5
  76. package/src/OntologyManager/OntologyStore/indexeddb-storage.ts +11 -5
  77. package/src/OntologyManager/index.ts +10 -6
  78. package/src/OntologyManager/util.ts +3 -2
  79. package/src/TabularEditor/HybridGrid/ChangeHandling.ts +2 -2
  80. package/src/TabularEditor/HybridGrid/Feature.tsx +9 -8
  81. package/src/TabularEditor/HybridGrid/FeatureAttributes.tsx +1 -1
  82. package/src/TabularEditor/HybridGrid/HybridGrid.tsx +3 -2
  83. package/src/TabularEditor/HybridGrid/NumberCell.tsx +8 -1
  84. package/src/TabularEditor/HybridGrid/ToolBar.tsx +15 -13
  85. package/src/TabularEditor/HybridGrid/featureContextMenuItems.ts +9 -33
  86. package/src/TabularEditor/TabularEditorPane.tsx +1 -1
  87. package/src/TabularEditor/model.ts +2 -2
  88. package/src/TabularEditor/types.ts +5 -2
  89. package/src/components/AddAssembly.tsx +611 -291
  90. package/src/components/AddChildFeature.tsx +6 -5
  91. package/src/components/AddFeature.tsx +211 -38
  92. package/src/components/AddRefSeqAliases.tsx +14 -12
  93. package/src/components/CopyFeature.tsx +8 -7
  94. package/src/components/CreateApolloAnnotation.tsx +154 -46
  95. package/src/components/DeleteAssembly.tsx +9 -8
  96. package/src/components/DeleteFeature.tsx +5 -4
  97. package/src/components/Dialog.tsx +1 -1
  98. package/src/components/DownloadGFF3.tsx +11 -10
  99. package/src/components/FilterFeatures.tsx +6 -4
  100. package/src/components/ImportFeatures.tsx +7 -6
  101. package/src/components/LogOut.tsx +5 -4
  102. package/src/components/ManageChecks.tsx +9 -8
  103. package/src/components/ManageUsers.tsx +11 -10
  104. package/src/components/OntologyTermAutocomplete.tsx +5 -5
  105. package/src/components/OntologyTermMultiSelect.tsx +9 -6
  106. package/src/components/OpenLocalFile.tsx +4 -3
  107. package/src/components/ViewChangeLog.tsx +7 -6
  108. package/src/components/ViewCheckResults.tsx +8 -7
  109. package/src/components/index.ts +0 -1
  110. package/src/extensions/annotationFromJBrowseFeature.test.ts +1 -0
  111. package/src/extensions/annotationFromJBrowseFeature.ts +14 -12
  112. package/src/extensions/annotationFromPileup.ts +6 -6
  113. package/src/index.ts +33 -50
  114. package/src/makeDisplayComponent.tsx +93 -41
  115. package/src/session/ClientDataStore.ts +21 -17
  116. package/src/session/session.ts +20 -26
  117. package/src/types.ts +4 -4
  118. package/src/util/annotationFeatureUtils.ts +53 -0
  119. package/src/util/index.ts +4 -3
  120. package/src/util/loadAssemblyIntoClient.ts +10 -3
  121. package/src/ApolloSixFrameRenderer/ApolloSixFrameRenderer.tsx +0 -13
  122. package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +0 -707
  123. package/src/ApolloSixFrameRenderer/configSchema.ts +0 -7
  124. package/src/ApolloSixFrameRenderer/index.ts +0 -3
  125. package/src/FeatureDetailsWidget/TranscriptBasic.tsx +0 -200
  126. package/src/SixFrameFeatureDisplay/components/TrackLines.tsx +0 -19
  127. package/src/SixFrameFeatureDisplay/components/index.ts +0 -1
  128. package/src/SixFrameFeatureDisplay/configSchema.ts +0 -21
  129. package/src/SixFrameFeatureDisplay/index.ts +0 -2
  130. package/src/SixFrameFeatureDisplay/stateModel.ts +0 -439
  131. package/src/components/ModifyFeatureAttribute.tsx +0 -460
@@ -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
@@ -61,6 +61,7 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
61
61
  const { model } = props
62
62
  const {
63
63
  loading,
64
+ apolloDragging,
64
65
  apolloRowHeight,
65
66
  contextMenuItems: getContextMenuItems,
66
67
  cursor,
@@ -94,7 +95,7 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
94
95
  const { assemblyManager } = session as unknown as AbstractSessionModel
95
96
  return (
96
97
  <>
97
- {lgv.bpPerPx <= 3 ? (
98
+ {3 / lgv.bpPerPx >= 1 ? (
98
99
  <div
99
100
  className={classes.canvasContainer}
100
101
  style={{
@@ -218,20 +219,26 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
218
219
  if (!feature) {
219
220
  return null
220
221
  }
221
- const { topLevelFeature } = feature
222
- const row = parent
223
- ? model.getFeatureLayoutPosition(topLevelFeature)
224
- ?.layoutRow ?? 0
225
- : 0
222
+ let row = 0
223
+ const featureLayout = model.getFeatureLayoutPosition(feature)
224
+ if (featureLayout) {
225
+ row = featureLayout.layoutRow + featureLayout.featureRow
226
+ }
226
227
  const top = row * apolloRowHeight
227
228
  const height = apolloRowHeight
228
229
  return (
229
230
  <Tooltip key={checkResult._id} title={checkResult.message}>
230
231
  <Avatar
231
232
  className={classes.avatar}
232
- style={{ top, left, height, width: height }}
233
+ style={{
234
+ top,
235
+ left,
236
+ height,
237
+ width: height,
238
+ pointerEvents: apolloDragging ? 'none' : 'auto',
239
+ }}
233
240
  >
234
- <ErrorIcon />
241
+ <ErrorIcon data-testid="ErrorIcon" />
235
242
  </Avatar>
236
243
  </Tooltip>
237
244
  )
@@ -1,30 +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
 
10
+ import { AddChildFeature, CopyFeature, DeleteFeature } from '../../components'
11
+ import { type LinearApolloDisplay } from '../stateModel'
11
12
  import {
12
- AddChildFeature,
13
- CopyFeature,
14
- DeleteFeature,
15
- ModifyFeatureAttribute,
16
- } from '../../components'
17
-
18
- import { LinearApolloDisplay } from '../stateModel'
19
- import {
13
+ type LinearApolloDisplayMouseEvents,
14
+ type MousePosition,
15
+ type MousePositionWithFeatureAndGlyph,
20
16
  isMousePositionWithFeatureAndGlyph,
21
- LinearApolloDisplayMouseEvents,
22
- MousePosition,
23
- MousePositionWithFeatureAndGlyph,
24
17
  } from '../stateModel/mouseEvents'
25
- import { CanvasMouseEvent } from '../types'
26
- import { Glyph } from './Glyph'
27
- 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'
28
22
 
29
23
  function drawBoxOutline(
30
24
  ctx: CanvasRenderingContext2D,
@@ -349,26 +343,6 @@ function getContextMenuItems(
349
343
  )
350
344
  },
351
345
  },
352
- {
353
- label: 'Modify feature attribute',
354
- disabled: readOnly,
355
- onClick: () => {
356
- ;(session as unknown as AbstractSessionModel).queueDialog(
357
- (doneCallback) => [
358
- ModifyFeatureAttribute,
359
- {
360
- session,
361
- handleClose: () => {
362
- doneCallback()
363
- },
364
- changeManager,
365
- sourceFeature,
366
- sourceAssemblyId: currentAssemblyId,
367
- },
368
- ],
369
- )
370
- },
371
- },
372
346
  {
373
347
  label: 'Edit feature details',
374
348
  onClick: () => {
@@ -394,7 +368,11 @@ function getContextMenuItems(
394
368
  throw new Error('featureTypeOntology is undefined')
395
369
  }
396
370
  if (
397
- featureTypeOntology.isTypeOf(sourceFeature.type, 'transcript') &&
371
+ (featureTypeOntology.isTypeOf(sourceFeature.type, 'transcript') ||
372
+ featureTypeOntology.isTypeOf(
373
+ sourceFeature.type,
374
+ 'pseudogenic_transcript',
375
+ )) &&
398
376
  isSessionModelWithWidgets(session)
399
377
  ) {
400
378
  menuItems.push({
@@ -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
@@ -112,10 +113,9 @@ function draw(
112
113
  // Draw lines on different rows for each transcript
113
114
  let currentRow = 0
114
115
  for (const [, transcript] of children) {
115
- const isTranscript = featureTypeOntology.isTypeOf(
116
- transcript.type,
117
- 'transcript',
118
- )
116
+ const isTranscript =
117
+ featureTypeOntology.isTypeOf(transcript.type, 'transcript') ||
118
+ featureTypeOntology.isTypeOf(transcript.type, 'pseudogenic_transcript')
119
119
  if (!isTranscript) {
120
120
  currentRow += 1
121
121
  continue
@@ -161,7 +161,12 @@ function draw(
161
161
  // Draw exon and CDS for each transcript
162
162
  currentRow = 0
163
163
  for (const [, child] of children) {
164
- if (!featureTypeOntology.isTypeOf(child.type, 'transcript')) {
164
+ if (
165
+ !(
166
+ featureTypeOntology.isTypeOf(child.type, 'transcript') ||
167
+ featureTypeOntology.isTypeOf(child.type, 'pseudogenic_transcript')
168
+ )
169
+ ) {
165
170
  boxGlyph.draw(ctx, child, row, stateModel, displayedRegionIndex)
166
171
  currentRow += 1
167
172
  continue
@@ -221,7 +226,6 @@ function draw(
221
226
  apolloSelectedFeature && _id === apolloSelectedFeature._id
222
227
  ? 'rgb(0,0,0)'
223
228
  : cdsColorCode
224
- ctx.fillStyle = cdsColorCode
225
229
  ctx.fillRect(
226
230
  cdsStartPx + 1,
227
231
  cdsTop + 1,
@@ -455,7 +459,11 @@ function getFeatureFromLayout(
455
459
  if (
456
460
  featureTypeOntology.isTypeOf(featureObj.type, 'CDS') &&
457
461
  featureObj.parent &&
458
- featureTypeOntology.isTypeOf(featureObj.parent.type, 'transcript')
462
+ (featureTypeOntology.isTypeOf(featureObj.parent.type, 'transcript') ||
463
+ featureTypeOntology.isTypeOf(
464
+ featureObj.parent.type,
465
+ 'pseudogenic_transcript',
466
+ ))
459
467
  ) {
460
468
  const { cdsLocations } = featureObj.parent
461
469
  for (const cdsLoc of cdsLocations) {
@@ -483,7 +491,7 @@ function getCDSCount(
483
491
  if (!children) {
484
492
  return 0
485
493
  }
486
- const isMrna = featureTypeOntology.isTypeOf(type, 'mRNA')
494
+ const isMrna = featureTypeOntology.isTypeOf(type, 'transcript')
487
495
  let cdsCount = 0
488
496
  if (isMrna) {
489
497
  for (const [, child] of children) {
@@ -504,7 +512,9 @@ function getRowCount(
504
512
  if (!children) {
505
513
  return 1
506
514
  }
507
- const isTranscript = featureTypeOntology.isTypeOf(type, 'transcript')
515
+ const isTranscript =
516
+ featureTypeOntology.isTypeOf(type, 'transcript') ||
517
+ featureTypeOntology.isTypeOf(type, 'pseudogenic_transcript')
508
518
  let rowCount = 0
509
519
  if (isTranscript) {
510
520
  for (const [, child] of children) {
@@ -532,7 +542,9 @@ function featuresForRow(
532
542
  feature: AnnotationFeature,
533
543
  featureTypeOntology: OntologyRecord,
534
544
  ): AnnotationFeature[][] {
535
- const isGene = featureTypeOntology.isTypeOf(feature.type, 'gene')
545
+ const isGene =
546
+ featureTypeOntology.isTypeOf(feature.type, 'gene') ||
547
+ featureTypeOntology.isTypeOf(feature.type, 'pseudogene')
536
548
  if (!isGene) {
537
549
  throw new Error('Top level feature for GeneGlyph must have type "gene"')
538
550
  }
@@ -542,7 +554,12 @@ function featuresForRow(
542
554
  }
543
555
  const features: AnnotationFeature[][] = []
544
556
  for (const [, child] of children) {
545
- if (!featureTypeOntology.isTypeOf(child.type, 'transcript')) {
557
+ if (
558
+ !(
559
+ featureTypeOntology.isTypeOf(child.type, 'transcript') ||
560
+ featureTypeOntology.isTypeOf(child.type, 'pseudogenic_transcript')
561
+ )
562
+ ) {
546
563
  features.push([child, feature])
547
564
  continue
548
565
  }
@@ -651,8 +668,12 @@ function getDraggableFeatureInfo(
651
668
  if (!featureTypeOntology) {
652
669
  throw new Error('featureTypeOntology is undefined')
653
670
  }
654
- const isGene = featureTypeOntology.isTypeOf(feature.type, 'gene')
655
- const isTranscript = featureTypeOntology.isTypeOf(feature.type, 'transcript')
671
+ const isGene =
672
+ featureTypeOntology.isTypeOf(feature.type, 'gene') ||
673
+ featureTypeOntology.isTypeOf(feature.type, 'pseudogene')
674
+ const isTranscript =
675
+ featureTypeOntology.isTypeOf(feature.type, 'transcript') ||
676
+ featureTypeOntology.isTypeOf(feature.type, 'pseudogenic_transcript')
656
677
  const isCds = featureTypeOntology.isTypeOf(feature.type, 'CDS')
657
678
  if (isGene || isTranscript) {
658
679
  return
@@ -691,9 +712,10 @@ function getDraggableFeatureInfo(
691
712
  }
692
713
 
693
714
  const overlappingExon = exonChildren.find((child) => {
694
- const [start, end] = intersection2(bp, bp + 1, child.min, child.max)
715
+ const [start, end] = intersection2(bp - 1, bp, child.min, child.max)
695
716
  return start !== undefined && end !== undefined
696
717
  })
718
+
697
719
  if (!overlappingExon) {
698
720
  return
699
721
  }
@@ -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,33 +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 = featureTypeOntology.isTypeOf(feature.type, 'gene')
84
- if (!isGene) {
85
- return false
86
- }
87
- for (const [, child] of children) {
88
- if (featureTypeOntology.isTypeOf(child.type, 'transcript')) {
89
- const { children: grandChildren } = child
90
- if (!grandChildren?.size) {
91
- return false
92
- }
93
- return [...grandChildren.values()].some((grandchild) =>
94
- featureTypeOntology.isTypeOf(grandchild.type, 'exon'),
95
- )
96
- }
97
- }
98
- return false
99
- },
100
74
  }))
101
75
  .actions((self) => ({
102
76
  addSeenFeature(feature: AnnotationFeature) {
@@ -1,22 +1,23 @@
1
- import { AnnotationFeature } from '@apollo-annotation/mst'
1
+ import { type AnnotationFeature } from '@apollo-annotation/mst'
2
2
  import {
3
3
  LocationEndChange,
4
4
  LocationStartChange,
5
5
  } from '@apollo-annotation/shared'
6
- import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
7
- import PluginManager from '@jbrowse/core/PluginManager'
8
- import { MenuItem } from '@jbrowse/core/ui'
9
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
10
- import { Theme } from '@mui/material'
6
+ import type PluginManager from '@jbrowse/core/PluginManager'
7
+ import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
8
+ import { type MenuItem } from '@jbrowse/core/ui'
9
+ import { type Frame, getFrame } from '@jbrowse/core/util'
10
+ import { type LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
11
+ import { type Theme } from '@mui/material'
11
12
  import { autorun } from 'mobx'
12
- import { Instance, addDisposer } from 'mobx-state-tree'
13
- import type { CSSProperties } from 'react'
13
+ import { type Instance, addDisposer } from 'mobx-state-tree'
14
+ import { type CSSProperties } from 'react'
15
+
16
+ import { type Coord } from '../components'
17
+ import { type Glyph } from '../glyphs/Glyph'
18
+ import { type CanvasMouseEvent } from '../types'
14
19
 
15
- import { Coord } from '../components'
16
- import { Glyph } from '../glyphs/Glyph'
17
- import { CanvasMouseEvent } from '../types'
18
20
  import { renderingModelFactory } from './rendering'
19
- import { Frame, getFrame } from '@jbrowse/core/util'
20
21
 
21
22
  export interface FeatureAndGlyphUnderMouse {
22
23
  feature: AnnotationFeature