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

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 (136) hide show
  1. package/dist/index.esm.js +6964 -4598
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/jbrowse-plugin-apollo.cjs.development.js +6610 -4261
  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 +11563 -7493
  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 +23 -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 +15 -11
  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 +215 -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 +15 -23
  43. package/src/FeatureDetailsWidget/TranscriptWidgetEditLocation.tsx +950 -196
  44. package/src/FeatureDetailsWidget/TranscriptWidgetSummary.tsx +8 -4
  45. package/src/FeatureDetailsWidget/model.ts +8 -3
  46. package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +7 -7
  47. package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +59 -72
  48. package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +253 -60
  49. package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +52 -6
  50. package/src/LinearApolloDisplay/glyphs/Glyph.ts +16 -8
  51. package/src/LinearApolloDisplay/stateModel/base.ts +81 -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 +63 -46
  55. package/src/LinearApolloDisplay/stateModel/rendering.ts +60 -31
  56. package/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx +226 -0
  57. package/src/LinearApolloSixFrameDisplay/components/TrackLines.tsx +32 -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 +940 -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 +302 -0
  65. package/src/LinearApolloSixFrameDisplay/stateModel/index.ts +27 -0
  66. package/src/LinearApolloSixFrameDisplay/stateModel/layouts.ts +252 -0
  67. package/src/LinearApolloSixFrameDisplay/stateModel/mouseEvents.ts +368 -0
  68. package/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts +201 -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 +12 -7
  77. package/src/OntologyManager/util.ts +3 -2
  78. package/src/TabularEditor/HybridGrid/ChangeHandling.ts +2 -2
  79. package/src/TabularEditor/HybridGrid/Feature.tsx +13 -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 +114 -22
  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/AddAssemblyAliases.tsx +114 -0
  89. package/src/components/AddChildFeature.tsx +8 -10
  90. package/src/components/AddFeature.tsx +216 -44
  91. package/src/components/AddRefSeqAliases.tsx +14 -12
  92. package/src/components/CopyFeature.tsx +10 -11
  93. package/src/components/CreateApolloAnnotation.tsx +342 -158
  94. package/src/components/DeleteAssembly.tsx +9 -8
  95. package/src/components/DeleteFeature.tsx +362 -14
  96. package/src/components/Dialog.tsx +1 -1
  97. package/src/components/DownloadGFF3.tsx +31 -11
  98. package/src/components/FilterFeatures.tsx +6 -4
  99. package/src/components/FilterTranscripts.tsx +86 -0
  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/MergeExons.tsx +193 -0
  105. package/src/components/MergeTranscripts.tsx +185 -0
  106. package/src/components/OntologyTermAutocomplete.tsx +5 -5
  107. package/src/components/OntologyTermMultiSelect.tsx +6 -6
  108. package/src/components/OpenLocalFile.tsx +4 -3
  109. package/src/components/SplitExon.tsx +134 -0
  110. package/src/components/ViewChangeLog.tsx +7 -6
  111. package/src/components/ViewCheckResults.tsx +8 -7
  112. package/src/components/index.ts +3 -0
  113. package/src/config.ts +5 -0
  114. package/src/extensions/annotationFromJBrowseFeature.test.ts +1 -0
  115. package/src/extensions/annotationFromJBrowseFeature.ts +13 -10
  116. package/src/extensions/annotationFromPileup.ts +104 -94
  117. package/src/index.ts +33 -50
  118. package/src/makeDisplayComponent.tsx +90 -37
  119. package/src/session/ClientDataStore.ts +21 -17
  120. package/src/session/session.ts +46 -39
  121. package/src/types.ts +4 -4
  122. package/src/util/annotationFeatureUtils.ts +66 -1
  123. package/src/util/copyToClipboard.ts +21 -0
  124. package/src/util/glyphUtils.ts +49 -0
  125. package/src/util/index.ts +5 -3
  126. package/src/util/loadAssemblyIntoClient.ts +10 -3
  127. package/src/util/mouseEventsUtils.ts +113 -0
  128. package/src/ApolloSixFrameRenderer/ApolloSixFrameRenderer.tsx +0 -13
  129. package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +0 -707
  130. package/src/ApolloSixFrameRenderer/configSchema.ts +0 -7
  131. package/src/ApolloSixFrameRenderer/index.ts +0 -3
  132. package/src/SixFrameFeatureDisplay/components/TrackLines.tsx +0 -19
  133. package/src/SixFrameFeatureDisplay/components/index.ts +0 -1
  134. package/src/SixFrameFeatureDisplay/configSchema.ts +0 -21
  135. package/src/SixFrameFeatureDisplay/index.ts +0 -2
  136. 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,14 @@ 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
+ import { copyToClipboard } from '../util/copyToClipboard'
16
17
 
17
18
  const SEQUENCE_WRAP_LENGTH = 60
18
19
 
@@ -112,13 +113,12 @@ function getSequenceSegments(
112
113
  const [firstLocation] = cdsLocations
113
114
  const locs: { min: number; max: number }[] = []
114
115
  for (const loc of firstLocation) {
115
- let sequence = getSequence(loc.min, loc.max)
116
- if (strand === -1) {
117
- sequence = revcom(sequence)
118
- }
119
- wholeSequence += sequence
116
+ wholeSequence += getSequence(loc.min, loc.max)
120
117
  locs.push({ min: loc.min, max: loc.max })
121
118
  }
119
+ if (strand === -1) {
120
+ wholeSequence = revcom(wholeSequence)
121
+ }
122
122
  const sequenceLines = splitStringIntoChunks(
123
123
  wholeSequence,
124
124
  SEQUENCE_WRAP_LENGTH,
@@ -131,13 +131,12 @@ function getSequenceSegments(
131
131
  const [firstLocation] = cdsLocations
132
132
  const locs: { min: number; max: number }[] = []
133
133
  for (const loc of firstLocation) {
134
- let sequence = getSequence(loc.min, loc.max)
135
- if (strand === -1) {
136
- sequence = revcom(sequence)
137
- }
138
- wholeSequence += sequence
134
+ wholeSequence += getSequence(loc.min, loc.max)
139
135
  locs.push({ min: loc.min, max: loc.max })
140
136
  }
137
+ if (strand === -1) {
138
+ wholeSequence = revcom(wholeSequence)
139
+ }
141
140
  let protein = ''
142
141
  for (let i = 0; i < wholeSequence.length; i += 3) {
143
142
  const codonSeq: string = wholeSequence.slice(i, i + 3).toUpperCase()
@@ -275,19 +274,12 @@ export const TranscriptSequence = observer(function TranscriptSequence({
275
274
  setLocationIntervals(locIntervals)
276
275
  }
277
276
 
278
- // Function to copy text to clipboard
279
- const copyToClipboard = () => {
277
+ const onCopyClick = () => {
280
278
  const seqDiv = seqRef.current
281
279
  if (!seqDiv) {
282
280
  return
283
281
  }
284
- const textBlob = new Blob([seqDiv.outerText], { type: 'text/plain' })
285
- const htmlBlob = new Blob([seqDiv.outerHTML], { type: 'text/html' })
286
- const clipboardItem = new ClipboardItem({
287
- [textBlob.type]: textBlob,
288
- [htmlBlob.type]: htmlBlob,
289
- })
290
- void navigator.clipboard.write([clipboardItem])
282
+ void copyToClipboard(seqDiv)
291
283
  }
292
284
 
293
285
  return (
@@ -306,7 +298,7 @@ export const TranscriptSequence = observer(function TranscriptSequence({
306
298
  </Select>
307
299
  <Button
308
300
  variant="contained"
309
- onClick={copyToClipboard}
301
+ onClick={onCopyClick}
310
302
  style={{ marginLeft: 10 }}
311
303
  size="medium"
312
304
  >