@apollo-annotation/jbrowse-plugin-apollo 0.1.6 → 0.1.8

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 (76) hide show
  1. package/dist/index.esm.js +206 -115
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/jbrowse-plugin-apollo.cjs.development.js +206 -115
  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 +257 -117
  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 +6 -6
  12. package/src/ApolloInternetAccount/addMenuItems.ts +2 -4
  13. package/src/ApolloInternetAccount/components/AuthTypeSelector.tsx +14 -6
  14. package/src/ApolloInternetAccount/model.ts +24 -16
  15. package/src/ApolloJobModel.ts +2 -0
  16. package/src/ApolloSequenceAdapter/ApolloSequenceAdapter.ts +4 -0
  17. package/src/ApolloSixFrameRenderer/ApolloSixFrameRenderer.tsx +1 -0
  18. package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +16 -3
  19. package/src/ApolloTextSearchAdapter/ApolloTextSearchAdapter.ts +5 -0
  20. package/src/BackendDrivers/CollaborationServerDriver.ts +10 -4
  21. package/src/BackendDrivers/DesktopFileDriver.ts +1 -0
  22. package/src/BackendDrivers/InMemoryFileDriver.ts +1 -0
  23. package/src/ChangeManager.ts +3 -0
  24. package/src/FeatureDetailsWidget/Attributes.tsx +4 -1
  25. package/src/FeatureDetailsWidget/BasicInformation.tsx +4 -2
  26. package/src/FeatureDetailsWidget/NumberTextField.tsx +4 -1
  27. package/src/FeatureDetailsWidget/RelatedFeature.tsx +16 -3
  28. package/src/FeatureDetailsWidget/Sequence.tsx +1 -0
  29. package/src/FeatureDetailsWidget/StringTextField.tsx +4 -1
  30. package/src/FeatureDetailsWidget/model.ts +2 -0
  31. package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +9 -2
  32. package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +2 -0
  33. package/src/LinearApolloDisplay/glyphs/CanonicalGeneGlyph.ts +9 -4
  34. package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +4 -1
  35. package/src/LinearApolloDisplay/glyphs/Glyph.ts +5 -1
  36. package/src/LinearApolloDisplay/glyphs/ImplicitExonGeneGlyph.ts +8 -2
  37. package/src/LinearApolloDisplay/stateModel/base.ts +7 -2
  38. package/src/LinearApolloDisplay/stateModel/getGlyph.ts +1 -0
  39. package/src/LinearApolloDisplay/stateModel/glyphs.ts +2 -0
  40. package/src/LinearApolloDisplay/stateModel/layouts.ts +3 -0
  41. package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +3 -1
  42. package/src/LinearApolloDisplay/stateModel/rendering.ts +3 -2
  43. package/src/LinearApolloDisplay/types.ts +1 -1
  44. package/src/OntologyManager/OntologyStore/fulltext.ts +1 -0
  45. package/src/OntologyManager/OntologyStore/index.test.ts +3 -1
  46. package/src/OntologyManager/OntologyStore/index.ts +4 -5
  47. package/src/OntologyManager/OntologyStore/indexeddb-storage.ts +3 -2
  48. package/src/SixFrameFeatureDisplay/stateModel.ts +17 -5
  49. package/src/TabularEditor/HybridGrid/Feature.tsx +7 -2
  50. package/src/TabularEditor/HybridGrid/FeatureAttributes.tsx +1 -0
  51. package/src/TabularEditor/HybridGrid/HybridGrid.tsx +2 -2
  52. package/src/TabularEditor/HybridGrid/NumberCell.tsx +3 -1
  53. package/src/TabularEditor/HybridGrid/ToolBar.tsx +9 -2
  54. package/src/components/AddAssembly.tsx +16 -8
  55. package/src/components/AddChildFeature.tsx +9 -4
  56. package/src/components/AddFeature.tsx +11 -5
  57. package/src/components/CopyFeature.tsx +11 -6
  58. package/src/components/DeleteAssembly.tsx +7 -4
  59. package/src/components/DeleteFeature.tsx +4 -1
  60. package/src/components/Dialog.tsx +1 -0
  61. package/src/components/DownloadGFF3.tsx +7 -2
  62. package/src/components/ImportFeatures.tsx +9 -3
  63. package/src/components/ManageChecks.tsx +10 -4
  64. package/src/components/ManageUsers.tsx +13 -4
  65. package/src/components/ModifyFeatureAttribute.tsx +4 -1
  66. package/src/components/OntologyTermAutocomplete.tsx +7 -4
  67. package/src/components/OntologyTermMultiSelect.tsx +2 -2
  68. package/src/components/OpenLocalFile.tsx +6 -3
  69. package/src/components/ViewChangeLog.tsx +13 -4
  70. package/src/components/ViewCheckResults.tsx +8 -2
  71. package/src/extensions/annotationFromPileup.ts +7 -2
  72. package/src/index.ts +4 -0
  73. package/src/makeDisplayComponent.tsx +4 -4
  74. package/src/session/ClientDataStore.ts +5 -0
  75. package/src/session/session.ts +9 -17
  76. package/src/util/loadAssemblyIntoClient.ts +4 -3
@@ -1,3 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
+ /* eslint-disable @typescript-eslint/no-misused-promises */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
1
6
  import { DeleteUserChange, UserChange } from '@apollo-annotation/apollo-shared'
2
7
  import { AbstractRootModel } from '@jbrowse/core/util'
3
8
  import DeleteIcon from '@mui/icons-material/Delete'
@@ -67,7 +72,7 @@ export function ManageUsers({
67
72
  const getUsers = useCallback(async () => {
68
73
  const { baseURL } = selectedInternetAccount
69
74
  const uri = new URL('/users', baseURL).href
70
- const apolloFetch = selectedInternetAccount?.getFetcher({
75
+ const apolloFetch = selectedInternetAccount.getFetcher({
71
76
  locationType: 'UriLocation',
72
77
  uri,
73
78
  })
@@ -87,7 +92,9 @@ export function ManageUsers({
87
92
  }, [selectedInternetAccount])
88
93
 
89
94
  useEffect(() => {
90
- getUsers().catch((error) => setErrorMessage(String(error)))
95
+ getUsers().catch((error) => {
96
+ setErrorMessage(String(error))
97
+ })
91
98
  }, [getUsers])
92
99
 
93
100
  async function deleteUser(id: GridRowId) {
@@ -138,7 +145,7 @@ export function ManageUsers({
138
145
  },
139
146
  ]
140
147
 
141
- function handleChangeInternetAccount(e: SelectChangeEvent<string>) {
148
+ function handleChangeInternetAccount(e: SelectChangeEvent) {
142
149
  const newlySelectedInternetAccount = apolloInternetAccounts.find(
143
150
  (ia) => ia.internetAccountId === e.target.value,
144
151
  )
@@ -199,7 +206,9 @@ export function ManageUsers({
199
206
  !isCurrentUser(params.id)
200
207
  }
201
208
  processRowUpdate={processRowUpdate}
202
- onProcessRowUpdateError={(error) => setErrorMessage(String(error))}
209
+ onProcessRowUpdateError={(error) => {
210
+ setErrorMessage(String(error))
211
+ }}
203
212
  />
204
213
  </div>
205
214
  </DialogContent>
@@ -1,3 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/unbound-method */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+ /* eslint-disable @typescript-eslint/no-misused-promises */
1
4
  import { AnnotationFeatureI } from '@apollo-annotation/apollo-mst'
2
5
  import { FeatureAttributeChange } from '@apollo-annotation/apollo-shared'
3
6
  import { AbstractSessionModel } from '@jbrowse/core/util'
@@ -219,7 +222,7 @@ export function ModifyFeatureAttribute({
219
222
  featureId: sourceFeature._id,
220
223
  attributes: attrs,
221
224
  })
222
- await changeManager.submit?.(change)
225
+ await changeManager.submit(change)
223
226
  notify('Feature attributes modified successfully', 'success')
224
227
  handleClose()
225
228
  event.preventDefault()
@@ -1,3 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
1
5
  import { AbstractSessionModel, isAbortException } from '@jbrowse/core/util'
2
6
  import {
3
7
  Autocomplete,
@@ -54,8 +58,7 @@ export function OntologyTermAutocomplete({
54
58
  OntologyTerm | undefined
55
59
  >()
56
60
 
57
- const ontologyManager = session.apolloDataStore
58
- .ontologyManager as OntologyManager
61
+ const { ontologyManager } = session.apolloDataStore
59
62
  const ontologyStore = ontologyManager.findOntology(
60
63
  ontologyName,
61
64
  ontologyVersion,
@@ -136,8 +139,8 @@ export function OntologyTermAutocomplete({
136
139
  fetchValidTerms,
137
140
  ])
138
141
 
139
- const handleChange = async (
140
- event: React.SyntheticEvent<Element, Event>,
142
+ const handleChange = (
143
+ event: React.SyntheticEvent,
141
144
  newValue?: OntologyTerm | string | null,
142
145
  ) => {
143
146
  if (!newValue) {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
1
2
  import { isAbortException } from '@jbrowse/core/util'
2
3
  import {
3
4
  Autocomplete,
@@ -120,8 +121,7 @@ export function OntologyTermMultiSelect({
120
121
  includeDeprecated?: boolean
121
122
  onChange(newValue: string[]): void
122
123
  }) {
123
- const ontologyManager = session.apolloDataStore
124
- .ontologyManager as OntologyManager
124
+ const { ontologyManager } = session.apolloDataStore
125
125
  const ontology = ontologyManager.findOntology(ontologyName, ontologyVersion)
126
126
 
127
127
  const [value, setValue] = React.useState<TermValue[]>(
@@ -1,3 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/unbound-method */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+ /* eslint-disable @typescript-eslint/no-misused-promises */
1
4
  import { AbstractSessionModel, isElectron } from '@jbrowse/core/util'
2
5
  import {
3
6
  Button,
@@ -43,7 +46,7 @@ export function OpenLocalFile({ handleClose, session }: OpenLocalFileProps) {
43
46
  const [submitted, setSubmitted] = useState(false)
44
47
  const theme = useTheme()
45
48
 
46
- async function handleChangeFile(e: React.ChangeEvent<HTMLInputElement>) {
49
+ function handleChangeFile(e: React.ChangeEvent<HTMLInputElement>) {
47
50
  const selectedFile = e.target.files?.item(0)
48
51
  if (!selectedFile) {
49
52
  return
@@ -103,9 +106,9 @@ export function OpenLocalFile({ handleClose, session }: OpenLocalFileProps) {
103
106
  if (a) {
104
107
  // @ts-expect-error MST type coercion problem?
105
108
  addApolloTrackConfig(a)
106
- notify(`Loaded GFF3 ${file?.name}`, 'success')
109
+ notify(`Loaded GFF3 ${file.name}`, 'success')
107
110
  } else {
108
- notify(`Error loading GFF3 ${file?.name}`, 'error')
111
+ notify(`Error loading GFF3 ${file.name}`, 'error')
109
112
  }
110
113
  handleClose()
111
114
  }
@@ -1,3 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
1
6
  import { changeRegistry } from '@apollo-annotation/apollo-common'
2
7
  import {
3
8
  Button,
@@ -115,7 +120,9 @@ export function ViewChangeLog({ handleClose, session }: ViewChangeLogProps) {
115
120
  setAssemblyCollection(data)
116
121
  }
117
122
  }
118
- getAssemblies().catch((error) => setErrorMessage(String(error)))
123
+ getAssemblies().catch((error) => {
124
+ setErrorMessage(String(error))
125
+ })
119
126
  }, [apolloInternetAccount, baseURL])
120
127
 
121
128
  useEffect(() => {
@@ -155,11 +162,13 @@ export function ViewChangeLog({ handleClose, session }: ViewChangeLogProps) {
155
162
  setDisplayGridData(data)
156
163
  }
157
164
  }
158
- getGridData().catch((error) => setErrorMessage(String(error)))
165
+ getGridData().catch((error) => {
166
+ setErrorMessage(String(error))
167
+ })
159
168
  }, [assemblyId, apolloInternetAccount, baseURL])
160
169
 
161
- async function handleChangeAssembly(e: SelectChangeEvent<string>) {
162
- setAssemblyId(e.target.value as string)
170
+ function handleChangeAssembly(e: SelectChangeEvent) {
171
+ setAssemblyId(e.target.value)
163
172
  }
164
173
 
165
174
  return (
@@ -1,3 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
1
5
  import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
2
6
  import {
3
7
  Button,
@@ -94,10 +98,12 @@ export function ViewCheckResults({
94
98
  setDisplayGridData(data)
95
99
  }
96
100
  }
97
- getGridData().catch((error) => setErrorMessage(String(error)))
101
+ getGridData().catch((error) => {
102
+ setErrorMessage(String(error))
103
+ })
98
104
  }, [selectedAssembly, apolloInternetAccount, baseURL])
99
105
 
100
- function handleChangeAssembly(e: SelectChangeEvent<string>) {
106
+ function handleChangeAssembly(e: SelectChangeEvent) {
101
107
  const newAssembly = assemblies.find((asm) => asm.name === e.target.value)
102
108
  setSelectedAssembly(newAssembly)
103
109
  }
@@ -1,3 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
1
6
  import { AnnotationFeatureSnapshot } from '@apollo-annotation/apollo-mst'
2
7
  import { AddFeatureChange } from '@apollo-annotation/apollo-shared'
3
8
  import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
@@ -150,7 +155,7 @@ export function annotationFromPileup(pluggableElement: PluggableElementBase) {
150
155
  cdsFeature.start = Math.min(cdsFeature.start, exon.start)
151
156
  cdsFeature.end = Math.max(cdsFeature.end, exon.end)
152
157
  const { end, start } = exon
153
- discontinuousLocations?.push({ start, end, phase })
158
+ discontinuousLocations.push({ start, end, phase })
154
159
  const localPhase = (end - start) % 3
155
160
  phase = ((phase + localPhase) % 3) as 0 | 1 | 2
156
161
  const newExon: AnnotationFeatureSnapshot = {
@@ -180,7 +185,7 @@ export function annotationFromPileup(pluggableElement: PluggableElementBase) {
180
185
  const session = getSession(self)
181
186
  await (
182
187
  session as unknown as ApolloSessionModel
183
- ).apolloDataStore.changeManager.submit?.(change)
188
+ ).apolloDataStore.changeManager.submit(change)
184
189
  session.notify('Annotation added successfully', 'success')
185
190
  },
186
191
  }))
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
+ /* eslint-disable @typescript-eslint/unbound-method */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
4
+ /* eslint-disable @typescript-eslint/no-misused-promises */
1
5
  import { changeRegistry, checkRegistry } from '@apollo-annotation/apollo-common'
2
6
  import {
3
7
  CDSCheck,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/unbound-method */
1
2
  import PluginManager from '@jbrowse/core/PluginManager'
2
3
  import type LinearGenomeViewPlugin from '@jbrowse/plugin-linear-genome-view'
3
4
  import ExpandLessIcon from '@mui/icons-material/ExpandLess'
@@ -173,10 +174,9 @@ export const DisplayComponent = observer(function DisplayComponent({
173
174
  }
174
175
 
175
176
  const canvasScrollContainerRef = useRef<HTMLDivElement>(null)
176
- useEffect(
177
- () => scrollSelectedFeatureIntoView(model, canvasScrollContainerRef),
178
- [model, selectedFeature],
179
- )
177
+ useEffect(() => {
178
+ scrollSelectedFeatureIntoView(model, canvasScrollContainerRef)
179
+ }, [model, selectedFeature])
180
180
  return (
181
181
  <div className={classes.details} style={{ height: overallHeight }}>
182
182
  <AccordionControl
@@ -1,3 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
4
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
1
6
  import { ClientDataStore as ClientDataStoreType } from '@apollo-annotation/apollo-common'
2
7
  import {
3
8
  AnnotationFeature,
@@ -1,3 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
1
5
  import { ClientDataStore as ClientDataStoreType } from '@apollo-annotation/apollo-common'
2
6
  import {
3
7
  AnnotationFeature,
@@ -158,10 +162,7 @@ export function extendSession(
158
162
  }
159
163
  }
160
164
  if (locations.length === 0) {
161
- for (const internetAccount of internetAccounts as (
162
- | BaseInternetAccountModel
163
- | ApolloInternetAccountModel
164
- )[]) {
165
+ for (const internetAccount of internetAccounts) {
165
166
  if ('baseURL' in internetAccount) {
166
167
  internetAccount.postUserLocation([])
167
168
  }
@@ -170,10 +171,7 @@ export function extendSession(
170
171
  }
171
172
 
172
173
  const allLocations: UserLocation[] = []
173
- for (const internetAccount of internetAccounts as (
174
- | BaseInternetAccountModel
175
- | ApolloInternetAccountModel
176
- )[]) {
174
+ for (const internetAccount of internetAccounts) {
177
175
  if ('baseURL' in internetAccount) {
178
176
  for (const location of locations) {
179
177
  const tmpLoc: UserLocation = {
@@ -208,7 +206,7 @@ export function extendSession(
208
206
  }
209
207
  const lgv = view as unknown as LinearGenomeViewModel
210
208
  if (lgv.initialized) {
211
- const { dynamicBlocks } = lgv as LinearGenomeViewModel
209
+ const { dynamicBlocks } = lgv
212
210
  // eslint-disable-next-line unicorn/no-array-for-each
213
211
  dynamicBlocks.forEach((block) => {
214
212
  if (block.regionNumber !== undefined) {
@@ -219,10 +217,7 @@ export function extendSession(
219
217
  }
220
218
  }
221
219
  if (locations.length === 0) {
222
- for (const internetAccount of internetAccounts as (
223
- | BaseInternetAccountModel
224
- | ApolloInternetAccountModel
225
- )[]) {
220
+ for (const internetAccount of internetAccounts) {
226
221
  if ('baseURL' in internetAccount) {
227
222
  internetAccount.postUserLocation([])
228
223
  }
@@ -231,10 +226,7 @@ export function extendSession(
231
226
  }
232
227
 
233
228
  const allLocations: UserLocation[] = []
234
- for (const internetAccount of internetAccounts as (
235
- | BaseInternetAccountModel
236
- | ApolloInternetAccountModel
237
- )[]) {
229
+ for (const internetAccount of internetAccounts) {
238
230
  if ('baseURL' in internetAccount) {
239
231
  for (const location of locations) {
240
232
  const tmpLoc: UserLocation = {
@@ -82,7 +82,8 @@ export async function checkFeatures(
82
82
  for (const check of checkRegistry.getChecks().values()) {
83
83
  const result: CheckResultSnapshot[] = await check.checkFeature(
84
84
  getSnapshot(feature),
85
- async (start: number, stop: number) => ref.getSequence(start, stop),
85
+ (start: number, stop: number) =>
86
+ Promise.resolve(ref.getSequence(start, stop)),
86
87
  )
87
88
  checkResults.push(...result)
88
89
  }
@@ -202,14 +203,14 @@ function createFeature(gff3Feature: GFF3Feature): AnnotationFeatureSnapshot {
202
203
  }
203
204
  }
204
205
 
205
- if (childFeatures?.length) {
206
+ if (childFeatures.length > 0) {
206
207
  const children: Record<string, AnnotationFeatureSnapshot> = {}
207
208
  for (const childFeature of childFeatures) {
208
209
  const child = createFeature(childFeature)
209
210
  children[child._id] = child
210
211
  // Add value to gffId
211
212
  child.attributes?._id
212
- ? (child.gffId = child.attributes?._id.toString())
213
+ ? (child.gffId = child.attributes._id.toString())
213
214
  : (child.gffId = child._id)
214
215
  }
215
216
  feature.children = children