@apollo-annotation/jbrowse-plugin-apollo 0.3.12 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApolloRefNameAliasAdapter/ApolloRefNameAliasAdapter.d.ts +1 -1
- package/dist/ApolloRefNameAliasAdapter/ApolloRefNameAliasAdapter.d.ts.map +1 -1
- package/dist/BackendDrivers/BackendDriver.d.ts +29 -4
- package/dist/BackendDrivers/BackendDriver.d.ts.map +1 -1
- package/dist/BackendDrivers/CollaborationServerDriver.d.ts +3 -1
- package/dist/BackendDrivers/CollaborationServerDriver.d.ts.map +1 -1
- package/dist/BackendDrivers/LocalDriver/LocalDriver.d.ts +22 -0
- package/dist/BackendDrivers/LocalDriver/LocalDriver.d.ts.map +1 -0
- package/dist/BackendDrivers/LocalDriver/db.d.ts +4 -0
- package/dist/BackendDrivers/LocalDriver/db.d.ts.map +1 -0
- package/dist/BackendDrivers/index.d.ts +1 -2
- package/dist/BackendDrivers/index.d.ts.map +1 -1
- package/dist/ChangeManager.d.ts +3 -3
- package/dist/ChangeManager.d.ts.map +1 -1
- package/dist/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.d.ts +0 -6
- package/dist/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.d.ts.map +1 -1
- package/dist/FeatureDetailsWidget/TranscriptWidgetEditLocation.d.ts.map +1 -1
- package/dist/FeatureDetailsWidget/model.d.ts +0 -2
- package/dist/FeatureDetailsWidget/model.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/components/CheckResultWarnings.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/components/LinearApolloDisplay.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/components/OverlayCanvas.d.ts +7 -0
- package/dist/LinearApolloDisplay/components/OverlayCanvas.d.ts.map +1 -0
- package/dist/LinearApolloDisplay/components/Tooltip.d.ts +10 -0
- package/dist/LinearApolloDisplay/components/Tooltip.d.ts.map +1 -0
- package/dist/LinearApolloDisplay/glyphs/BoxGlyph.d.ts +0 -1
- package/dist/LinearApolloDisplay/glyphs/BoxGlyph.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/glyphs/CDSGlyph.d.ts +3 -0
- package/dist/LinearApolloDisplay/glyphs/CDSGlyph.d.ts.map +1 -0
- package/dist/LinearApolloDisplay/glyphs/ExonGlyph.d.ts +3 -0
- package/dist/LinearApolloDisplay/glyphs/ExonGlyph.d.ts.map +1 -0
- package/dist/LinearApolloDisplay/glyphs/GeneGlyph.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/glyphs/GenericChildGlyph.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/glyphs/Glyph.d.ts +26 -20
- package/dist/LinearApolloDisplay/glyphs/Glyph.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/glyphs/TranscriptGlyph.d.ts +3 -0
- package/dist/LinearApolloDisplay/glyphs/TranscriptGlyph.d.ts.map +1 -0
- package/dist/LinearApolloDisplay/glyphs/util.d.ts +13 -0
- package/dist/LinearApolloDisplay/glyphs/util.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/stateModel/base.d.ts +17 -0
- package/dist/LinearApolloDisplay/stateModel/base.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/stateModel/index.d.ts +35 -17
- package/dist/LinearApolloDisplay/stateModel/index.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/stateModel/layouts.d.ts +29 -7
- package/dist/LinearApolloDisplay/stateModel/layouts.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/stateModel/mouseEvents.d.ts +69 -23
- package/dist/LinearApolloDisplay/stateModel/mouseEvents.d.ts.map +1 -1
- package/dist/LinearApolloDisplay/stateModel/rendering.d.ts +26 -9
- package/dist/LinearApolloDisplay/stateModel/rendering.d.ts.map +1 -1
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/base.d.ts +6 -0
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/base.d.ts.map +1 -1
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/index.d.ts +6 -0
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/index.d.ts.map +1 -1
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/rendering.d.ts +6 -0
- package/dist/LinearApolloReferenceSequenceDisplay/stateModel/rendering.d.ts.map +1 -1
- package/dist/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.d.ts.map +1 -1
- package/dist/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.d.ts.map +1 -1
- package/dist/LinearApolloSixFrameDisplay/glyphs/Glyph.d.ts +1 -1
- package/dist/LinearApolloSixFrameDisplay/glyphs/Glyph.d.ts.map +1 -1
- package/dist/LinearApolloSixFrameDisplay/stateModel/layouts.d.ts.map +1 -1
- package/dist/LinearApolloSixFrameDisplay/stateModel/rendering.d.ts.map +1 -1
- package/dist/OntologyManager/OntologyStore/fulltext.d.ts +1 -1
- package/dist/OntologyManager/OntologyStore/fulltext.d.ts.map +1 -1
- package/dist/OntologyManager/OntologyStore/index.d.ts +2 -2
- package/dist/OntologyManager/OntologyStore/index.d.ts.map +1 -1
- package/dist/OntologyManager/OntologyStore/indexeddb-storage.d.ts +1 -1
- package/dist/OntologyManager/OntologyStore/indexeddb-storage.d.ts.map +1 -1
- package/dist/OntologyManager/OntologyStore/types.d.ts +18 -0
- package/dist/OntologyManager/OntologyStore/types.d.ts.map +1 -0
- package/dist/TabularEditor/HybridGrid/featureContextMenuItems.d.ts.map +1 -1
- package/dist/components/AddChildFeature.d.ts.map +1 -1
- package/dist/components/ColorFeature.d.ts +13 -0
- package/dist/components/ColorFeature.d.ts.map +1 -0
- package/dist/components/CreateApolloAnnotation.d.ts.map +1 -1
- package/dist/components/DownloadGFF3.d.ts +4 -1
- package/dist/components/DownloadGFF3.d.ts.map +1 -1
- package/dist/components/DuplicateTranscript.d.ts.map +1 -1
- package/dist/components/ViewChangeLog.d.ts +2 -1
- package/dist/components/ViewChangeLog.d.ts.map +1 -1
- package/dist/components/ViewCheckResults.d.ts +2 -1
- package/dist/components/ViewCheckResults.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/extensions/annotationFromJBrowseFeature.d.ts.map +1 -1
- package/dist/extensions/annotationFromPileup.d.ts.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +6325 -5997
- package/dist/index.esm.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.development.js +5869 -5541
- package/dist/jbrowse-plugin-apollo.cjs.development.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.production.min.js +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.production.min.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.umd.development.js +16782 -25897
- package/dist/jbrowse-plugin-apollo.umd.development.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.umd.production.min.js +1 -1
- package/dist/jbrowse-plugin-apollo.umd.production.min.js.map +1 -1
- package/dist/makeDisplayComponent.d.ts.map +1 -1
- package/dist/menus/Icons.d.ts +3 -0
- package/dist/menus/Icons.d.ts.map +1 -0
- package/dist/menus/topLevelMenu.d.ts.map +1 -1
- package/dist/session/changeHandlers.d.ts +9 -0
- package/dist/session/changeHandlers.d.ts.map +1 -0
- package/dist/util/annotationFeatureUtils.d.ts +2 -1
- package/dist/util/annotationFeatureUtils.d.ts.map +1 -1
- package/dist/util/glyphUtils.d.ts +3 -3
- package/dist/util/glyphUtils.d.ts.map +1 -1
- package/dist/util/index.d.ts +0 -1
- package/dist/util/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/ApolloInternetAccount/model.ts +68 -4
- package/src/ApolloRefNameAliasAdapter/ApolloRefNameAliasAdapter.ts +6 -3
- package/src/ApolloTextSearchAdapter/ApolloTextSearchAdapter.ts +1 -1
- package/src/BackendDrivers/BackendDriver.ts +36 -3
- package/src/BackendDrivers/CollaborationServerDriver.ts +78 -23
- package/src/BackendDrivers/LocalDriver/LocalDriver.ts +367 -0
- package/src/BackendDrivers/LocalDriver/db.ts +37 -0
- package/src/BackendDrivers/index.ts +1 -2
- package/src/ChangeManager.ts +27 -25
- package/src/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.tsx +1 -1
- package/src/FeatureDetailsWidget/TranscriptWidgetEditLocation.tsx +69 -53
- package/src/LinearApolloDisplay/components/CheckResultWarnings.tsx +1 -5
- package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +95 -115
- package/src/LinearApolloDisplay/components/OverlayCanvas.tsx +76 -0
- package/src/LinearApolloDisplay/components/Tooltip.tsx +42 -0
- package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +60 -302
- package/src/LinearApolloDisplay/glyphs/CDSGlyph.ts +145 -0
- package/src/LinearApolloDisplay/glyphs/ExonGlyph.ts +212 -0
- package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +65 -999
- package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +71 -181
- package/src/LinearApolloDisplay/glyphs/Glyph.ts +42 -66
- package/src/LinearApolloDisplay/glyphs/TranscriptGlyph.ts +291 -0
- package/src/LinearApolloDisplay/glyphs/util.ts +87 -0
- package/src/LinearApolloDisplay/stateModel/base.ts +83 -0
- package/src/LinearApolloDisplay/stateModel/layouts.ts +198 -138
- package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +252 -158
- package/src/LinearApolloDisplay/stateModel/rendering.ts +103 -21
- package/src/LinearApolloReferenceSequenceDisplay/drawSequenceOverlay.ts +3 -3
- package/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts +20 -2
- package/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx +7 -2
- package/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts +8 -13
- package/src/LinearApolloSixFrameDisplay/glyphs/Glyph.ts +1 -1
- package/src/LinearApolloSixFrameDisplay/stateModel/layouts.ts +4 -3
- package/src/LinearApolloSixFrameDisplay/stateModel/mouseEvents.ts +1 -1
- package/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts +2 -1
- package/src/OntologyManager/OntologyStore/__snapshots__/index.test.ts.snap +18262 -8519
- package/src/OntologyManager/OntologyStore/fulltext.ts +1 -2
- package/src/OntologyManager/OntologyStore/index.test.ts +5 -2
- package/src/OntologyManager/OntologyStore/index.ts +7 -8
- package/src/OntologyManager/OntologyStore/indexeddb-storage.ts +2 -2
- package/src/OntologyManager/OntologyStore/types.ts +27 -0
- package/src/OntologyManager/index.ts +15 -26
- package/src/TabularEditor/HybridGrid/featureContextMenuItems.ts +4 -5
- package/src/components/AddChildFeature.tsx +15 -8
- package/src/components/ColorFeature.tsx +167 -0
- package/src/components/CreateApolloAnnotation.tsx +35 -9
- package/src/components/DownloadGFF3.tsx +92 -121
- package/src/components/DuplicateTranscript.tsx +10 -0
- package/src/components/ViewChangeLog.tsx +123 -83
- package/src/components/ViewCheckResults.tsx +15 -73
- package/src/components/index.ts +1 -1
- package/src/config.ts +37 -19
- package/src/extensions/annotationFromJBrowseFeature.test.ts +1 -1
- package/src/extensions/annotationFromJBrowseFeature.ts +91 -63
- package/src/extensions/annotationFromPileup.ts +40 -40
- package/src/index.ts +45 -1
- package/src/makeDisplayComponent.tsx +10 -3
- package/src/menus/Icons.tsx +49 -0
- package/src/menus/topLevelMenu.ts +24 -96
- package/src/session/ClientDataStore.ts +16 -17
- package/src/session/changeHandlers.ts +261 -0
- package/src/session/session.ts +77 -46
- package/src/util/annotationFeatureUtils.ts +29 -1
- package/src/util/glyphUtils.ts +74 -31
- package/src/util/index.ts +0 -1
- package/dist/BackendDrivers/DesktopFileDriver.d.ts +0 -160
- package/dist/BackendDrivers/DesktopFileDriver.d.ts.map +0 -1
- package/dist/BackendDrivers/InMemoryFileDriver.d.ts +0 -162
- package/dist/BackendDrivers/InMemoryFileDriver.d.ts.map +0 -1
- package/dist/LinearApolloDisplay/glyphs/index.d.ts +0 -4
- package/dist/LinearApolloDisplay/glyphs/index.d.ts.map +0 -1
- package/dist/components/OpenLocalFile.d.ts +0 -15
- package/dist/components/OpenLocalFile.d.ts.map +0 -1
- package/dist/util/loadAssemblyIntoClient.d.ts +0 -5
- package/dist/util/loadAssemblyIntoClient.d.ts.map +0 -1
- package/src/BackendDrivers/DesktopFileDriver.ts +0 -184
- package/src/BackendDrivers/InMemoryFileDriver.ts +0 -107
- package/src/LinearApolloDisplay/glyphs/index.ts +0 -3
- package/src/components/OpenLocalFile.tsx +0 -189
- package/src/util/loadAssemblyIntoClient.ts +0 -94
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SvgIcon, type SvgIconProps } from '@mui/material'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
// Icon source: https://developers.google.com/identity/branding-guidelines
|
|
5
|
+
export function Apollo(props: SvgIconProps) {
|
|
6
|
+
return (
|
|
7
|
+
<SvgIcon
|
|
8
|
+
viewBox="0 0 856 855"
|
|
9
|
+
style={{ fontSize: 18, marginRight: 4 }}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<g>
|
|
13
|
+
<path
|
|
14
|
+
style={{ opacity: 0.68, fill: '#AEAEAE' }}
|
|
15
|
+
d="M276.7,656.9l85-148h102.9c23.1,0,16.1-16,11.1-25l-134-238.5l85-148l185,315.6c0,0-15-26.3,0,0
|
|
16
|
+
c53,92.9-24,243.9-132,243.9c-6,0-4,0-6.4,0H276.7z"
|
|
17
|
+
/>
|
|
18
|
+
<polygon
|
|
19
|
+
style={{ opacity: 0.85, fill: '#717171' }}
|
|
20
|
+
points="49.7,756.9 219.1,756.9 513.7,246.9 425.7,99.9 "
|
|
21
|
+
/>
|
|
22
|
+
<polygon
|
|
23
|
+
style={{ opacity: 0.85, fill: '#717171' }}
|
|
24
|
+
points="630,756.9 806.4,756.9 513.7,246.9 425.1,400.2 "
|
|
25
|
+
/>
|
|
26
|
+
<polygon
|
|
27
|
+
style={{ fill: '#C6C6C6' }}
|
|
28
|
+
points="175.7,657.3 195.6,657.3 277.9,508.9 254.1,508.9 170.6,657.3 "
|
|
29
|
+
/>
|
|
30
|
+
<polygon
|
|
31
|
+
style={{ fill: '#C6C6C6' }}
|
|
32
|
+
points="369.7,657.3 389.6,657.3 471.9,508.9 448.1,508.9 364.6,657.3 "
|
|
33
|
+
/>
|
|
34
|
+
<polygon
|
|
35
|
+
style={{ fill: '#C6C6C6' }}
|
|
36
|
+
points="321.7,657.3 341.6,657.3 423.9,508.9 400.1,508.9 316.6,657.3 "
|
|
37
|
+
/>
|
|
38
|
+
<polygon
|
|
39
|
+
style={{ fill: '#C6C6C6' }}
|
|
40
|
+
points="224.7,657.3 244.6,657.3 326.9,508.9 303.1,508.9 219.6,657.3 "
|
|
41
|
+
/>
|
|
42
|
+
<polygon
|
|
43
|
+
style={{ fill: '#C6C6C6' }}
|
|
44
|
+
points="273.7,657.3 293.6,657.3 375.9,508.9 352.1,508.9 268.6,657.3 "
|
|
45
|
+
/>
|
|
46
|
+
</g>
|
|
47
|
+
</SvgIcon>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -2,22 +2,13 @@ import type {
|
|
|
2
2
|
AbstractMenuManager,
|
|
3
3
|
AbstractSessionModel,
|
|
4
4
|
} from '@jbrowse/core/util'
|
|
5
|
-
import DownloadIcon from '@mui/icons-material/Download'
|
|
6
|
-
import FactCheckIcon from '@mui/icons-material/FactCheck'
|
|
7
|
-
import FileOpenIcon from '@mui/icons-material/FileOpen'
|
|
8
5
|
import LogoutIcon from '@mui/icons-material/Logout'
|
|
9
6
|
import RedoIcon from '@mui/icons-material/Redo'
|
|
10
|
-
import TrackChangesIcon from '@mui/icons-material/TrackChanges'
|
|
11
7
|
import UndoIcon from '@mui/icons-material/Undo'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
DownloadGFF3,
|
|
15
|
-
LogOut,
|
|
16
|
-
OpenLocalFile,
|
|
17
|
-
ViewChangeLog,
|
|
18
|
-
ViewCheckResults,
|
|
19
|
-
} from '../components'
|
|
9
|
+
import { LogOut } from '../components'
|
|
20
10
|
import type { ApolloSessionModel } from '../session'
|
|
11
|
+
import { type ApolloRootModel, isApolloInternetAccount } from '../types'
|
|
21
12
|
|
|
22
13
|
export function addTopLevelMenus(rootModel: AbstractMenuManager) {
|
|
23
14
|
rootModel.insertInMenu(
|
|
@@ -45,96 +36,33 @@ export function addTopLevelMenus(rootModel: AbstractMenuManager) {
|
|
|
45
36
|
0,
|
|
46
37
|
)
|
|
47
38
|
|
|
48
|
-
rootModel.appendToMenu('Apollo', {
|
|
49
|
-
label: 'Download GFF3',
|
|
50
|
-
icon: DownloadIcon,
|
|
51
|
-
onClick: (session: ApolloSessionModel) => {
|
|
52
|
-
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
53
|
-
(doneCallback) => [
|
|
54
|
-
DownloadGFF3,
|
|
55
|
-
{
|
|
56
|
-
session,
|
|
57
|
-
handleClose: () => {
|
|
58
|
-
doneCallback()
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
)
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
rootModel.appendToMenu('Apollo', {
|
|
66
|
-
label: 'View Change Log',
|
|
67
|
-
icon: TrackChangesIcon,
|
|
68
|
-
onClick: (session: ApolloSessionModel) => {
|
|
69
|
-
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
70
|
-
(doneCallback) => [
|
|
71
|
-
ViewChangeLog,
|
|
72
|
-
{
|
|
73
|
-
session,
|
|
74
|
-
handleClose: () => {
|
|
75
|
-
doneCallback()
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
)
|
|
80
|
-
},
|
|
81
|
-
})
|
|
82
|
-
rootModel.appendToMenu('Apollo', {
|
|
83
|
-
label: 'Open local GFF3 file',
|
|
84
|
-
icon: FileOpenIcon,
|
|
85
|
-
onClick: (session: ApolloSessionModel) => {
|
|
86
|
-
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
87
|
-
(doneCallback) => [
|
|
88
|
-
OpenLocalFile,
|
|
89
|
-
{
|
|
90
|
-
session,
|
|
91
|
-
handleClose: () => {
|
|
92
|
-
doneCallback()
|
|
93
|
-
},
|
|
94
|
-
inMemoryFileDriver: session.apolloDataStore.inMemoryFileDriver,
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
)
|
|
98
|
-
},
|
|
99
|
-
})
|
|
100
|
-
rootModel.appendToMenu('Apollo', {
|
|
101
|
-
label: 'View check results',
|
|
102
|
-
icon: FactCheckIcon,
|
|
103
|
-
onClick: (session: ApolloSessionModel) => {
|
|
104
|
-
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
105
|
-
(doneCallback) => [
|
|
106
|
-
ViewCheckResults,
|
|
107
|
-
{
|
|
108
|
-
session,
|
|
109
|
-
handleClose: () => {
|
|
110
|
-
doneCallback()
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
)
|
|
115
|
-
},
|
|
116
|
-
})
|
|
117
39
|
rootModel.appendToMenu('Apollo', {
|
|
118
40
|
label: 'Lock/Unlock session',
|
|
119
41
|
onClick: (session: ApolloSessionModel) => {
|
|
120
42
|
session.toggleLocked()
|
|
121
43
|
},
|
|
122
44
|
})
|
|
123
|
-
rootModel
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
45
|
+
const { internetAccounts } = rootModel as unknown as ApolloRootModel
|
|
46
|
+
const hasApolloInternetAccount = internetAccounts.some((ia) =>
|
|
47
|
+
isApolloInternetAccount(ia),
|
|
48
|
+
)
|
|
49
|
+
if (hasApolloInternetAccount) {
|
|
50
|
+
rootModel.appendToMenu('Apollo', {
|
|
51
|
+
label: 'Log out',
|
|
52
|
+
icon: LogoutIcon,
|
|
53
|
+
onClick: (session: ApolloSessionModel) => {
|
|
54
|
+
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
55
|
+
(doneCallback) => [
|
|
56
|
+
LogOut,
|
|
57
|
+
{
|
|
58
|
+
session,
|
|
59
|
+
handleClose: () => {
|
|
60
|
+
doneCallback()
|
|
61
|
+
},
|
|
134
62
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}
|
|
63
|
+
],
|
|
64
|
+
)
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
}
|
|
140
68
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
5
|
-
import type { ClientDataStore as ClientDataStoreType } from '@apollo-annotation/common'
|
|
6
5
|
import {
|
|
7
6
|
type AnnotationFeatureModel,
|
|
8
7
|
type AnnotationFeatureSnapshot,
|
|
@@ -18,7 +17,7 @@ import {
|
|
|
18
17
|
getConf,
|
|
19
18
|
readConfObject,
|
|
20
19
|
} from '@jbrowse/core/configuration'
|
|
21
|
-
import { type Region, getSession
|
|
20
|
+
import { type Region, getSession } from '@jbrowse/core/util'
|
|
22
21
|
import type {
|
|
23
22
|
LocalPathLocation,
|
|
24
23
|
UriLocation,
|
|
@@ -38,8 +37,7 @@ import {
|
|
|
38
37
|
type ApolloInternetAccount,
|
|
39
38
|
type BackendDriver,
|
|
40
39
|
CollaborationServerDriver,
|
|
41
|
-
|
|
42
|
-
InMemoryFileDriver,
|
|
40
|
+
LocalDriver,
|
|
43
41
|
} from '../BackendDrivers'
|
|
44
42
|
import { ChangeManager } from '../ChangeManager'
|
|
45
43
|
import {
|
|
@@ -158,16 +156,11 @@ export function clientDataStoreFactory(
|
|
|
158
156
|
},
|
|
159
157
|
}))
|
|
160
158
|
.volatile((self) => ({
|
|
161
|
-
changeManager: new ChangeManager(self as
|
|
159
|
+
changeManager: new ChangeManager(self as ClientDataStoreModel),
|
|
162
160
|
collaborationServerDriver: new CollaborationServerDriver(
|
|
163
|
-
self as
|
|
161
|
+
self as ClientDataStoreModel,
|
|
164
162
|
),
|
|
165
|
-
|
|
166
|
-
self as unknown as ClientDataStoreType,
|
|
167
|
-
),
|
|
168
|
-
desktopFileDriver: isElectron
|
|
169
|
-
? new DesktopFileDriver(self as unknown as ClientDataStoreType)
|
|
170
|
-
: undefined,
|
|
163
|
+
localDriver: new LocalDriver(self as ClientDataStoreModel),
|
|
171
164
|
}))
|
|
172
165
|
.actions((self) => ({
|
|
173
166
|
afterCreate() {
|
|
@@ -245,17 +238,14 @@ export function clientDataStoreFactory(
|
|
|
245
238
|
if (!assembly) {
|
|
246
239
|
return
|
|
247
240
|
}
|
|
248
|
-
const {
|
|
241
|
+
const { internetAccountConfigId } = getConf(assembly, [
|
|
249
242
|
'sequence',
|
|
250
243
|
'metadata',
|
|
251
244
|
]) as { internetAccountConfigId?: string; file: string }
|
|
252
|
-
if (isElectron && file) {
|
|
253
|
-
return self.desktopFileDriver
|
|
254
|
-
}
|
|
255
245
|
if (internetAccountConfigId) {
|
|
256
246
|
return self.collaborationServerDriver
|
|
257
247
|
}
|
|
258
|
-
return self.
|
|
248
|
+
return self.localDriver
|
|
259
249
|
},
|
|
260
250
|
getInternetAccount(assemblyName?: string, internetAccountId?: string) {
|
|
261
251
|
if (!(assemblyName ?? internetAccountId)) {
|
|
@@ -347,3 +337,12 @@ export function clientDataStoreFactory(
|
|
|
347
337
|
}),
|
|
348
338
|
}))
|
|
349
339
|
}
|
|
340
|
+
|
|
341
|
+
export type ClientDataStoreStateModel = ReturnType<
|
|
342
|
+
typeof clientDataStoreFactory
|
|
343
|
+
>
|
|
344
|
+
// eslint disable because of
|
|
345
|
+
// https://mobx-state-tree.js.org/tips/typescript#using-a-mst-type-at-design-time
|
|
346
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
347
|
+
export interface ClientDataStoreModel
|
|
348
|
+
extends Instance<ClientDataStoreStateModel> {}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/require-await */
|
|
2
|
+
import {
|
|
3
|
+
attributesToRecords,
|
|
4
|
+
type localChanges,
|
|
5
|
+
stringifyAttributes,
|
|
6
|
+
} from '@apollo-annotation/shared'
|
|
7
|
+
|
|
8
|
+
import type { ClientDataStoreModel } from './ClientDataStore'
|
|
9
|
+
|
|
10
|
+
type ChangeHandlers = {
|
|
11
|
+
[K in keyof typeof localChanges]: (
|
|
12
|
+
dataStore: ClientDataStoreModel,
|
|
13
|
+
change: InstanceType<(typeof localChanges)[K]>,
|
|
14
|
+
) => Promise<void>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isLocalChange(
|
|
18
|
+
changeName: string,
|
|
19
|
+
): changeName is keyof typeof localChanges {
|
|
20
|
+
return changeName in changeHandlers
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const changeHandlers: ChangeHandlers = {
|
|
24
|
+
async AddFeatureChange(dataStore, change) {
|
|
25
|
+
const { assembly, changes } = change
|
|
26
|
+
for (const c of changes) {
|
|
27
|
+
const { addedFeature, parentFeatureId } = c
|
|
28
|
+
if (parentFeatureId) {
|
|
29
|
+
let parentFeature = dataStore.getFeature(parentFeatureId)
|
|
30
|
+
// maybe the parent feature hasn't been loaded yet
|
|
31
|
+
if (!parentFeature) {
|
|
32
|
+
await dataStore.loadFeatures([
|
|
33
|
+
{
|
|
34
|
+
assemblyName: assembly,
|
|
35
|
+
refName: addedFeature.refSeq,
|
|
36
|
+
start: addedFeature.min,
|
|
37
|
+
end: addedFeature.max,
|
|
38
|
+
},
|
|
39
|
+
])
|
|
40
|
+
parentFeature = dataStore.getFeature(parentFeatureId)
|
|
41
|
+
if (!parentFeature) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Could not find parent feature "${parentFeatureId}"`,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// create an ID for the parent feature if it does not have one
|
|
48
|
+
if (!parentFeature.attributes.get('_id')) {
|
|
49
|
+
parentFeature.setAttribute('_id', [parentFeature._id])
|
|
50
|
+
}
|
|
51
|
+
parentFeature.addChild(addedFeature)
|
|
52
|
+
} else {
|
|
53
|
+
dataStore.addFeature(assembly, addedFeature)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async DeleteFeatureChange(dataStore, change) {
|
|
59
|
+
for (const c of change.changes) {
|
|
60
|
+
const { deletedFeature, parentFeatureId } = c
|
|
61
|
+
if (parentFeatureId) {
|
|
62
|
+
const parentFeature = dataStore.getFeature(parentFeatureId)
|
|
63
|
+
if (!parentFeature) {
|
|
64
|
+
throw new Error(`Could not find parent feature "${parentFeatureId}"`)
|
|
65
|
+
}
|
|
66
|
+
parentFeature.deleteChild(deletedFeature._id)
|
|
67
|
+
} else {
|
|
68
|
+
if (dataStore.getFeature(deletedFeature._id)) {
|
|
69
|
+
dataStore.deleteFeature(deletedFeature._id)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
async FeatureAttributeChange(dataStore, change) {
|
|
76
|
+
for (const [idx, changedId] of change.changedIds.entries()) {
|
|
77
|
+
const feature = dataStore.getFeature(changedId)
|
|
78
|
+
if (!feature) {
|
|
79
|
+
throw new Error(`Could not find feature with identifier "${changedId}"`)
|
|
80
|
+
}
|
|
81
|
+
feature.setAttributes(
|
|
82
|
+
new Map(Object.entries(change.changes[idx].newAttributes)),
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
async LocationEndChange(dataStore, change) {
|
|
88
|
+
for (const c of change.changes) {
|
|
89
|
+
const { featureId, newEnd } = c
|
|
90
|
+
const feature = dataStore.getFeature(featureId)
|
|
91
|
+
if (!feature) {
|
|
92
|
+
throw new Error(`Could not find feature with identifier "${featureId}"`)
|
|
93
|
+
}
|
|
94
|
+
feature.setMax(newEnd)
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
async LocationStartChange(dataStore, change) {
|
|
99
|
+
for (const c of change.changes) {
|
|
100
|
+
const { featureId, newStart } = c
|
|
101
|
+
const feature = dataStore.getFeature(featureId)
|
|
102
|
+
if (!feature) {
|
|
103
|
+
throw new Error(`Could not find feature with identifier "${featureId}"`)
|
|
104
|
+
}
|
|
105
|
+
feature.setMin(newStart)
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
async MergeExonsChange(dataStore, change) {
|
|
110
|
+
for (const c of change.changes) {
|
|
111
|
+
const { firstExon, secondExon } = c
|
|
112
|
+
const mergedExon = dataStore.getFeature(firstExon._id)
|
|
113
|
+
if (!mergedExon) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
`Could not find feature with identifier "${firstExon._id}"`,
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
mergedExon.setMin(Math.min(firstExon.min, secondExon.min))
|
|
119
|
+
mergedExon.setMax(Math.max(firstExon.max, secondExon.max))
|
|
120
|
+
|
|
121
|
+
const mrg = mergedExon.attributes.get('merged_with')?.slice() ?? []
|
|
122
|
+
const mergedWith = stringifyAttributes(
|
|
123
|
+
attributesToRecords(secondExon.attributes),
|
|
124
|
+
)
|
|
125
|
+
if (!mrg.includes(mergedWith)) {
|
|
126
|
+
mrg.push(mergedWith)
|
|
127
|
+
}
|
|
128
|
+
mergedExon.setAttribute('merged_with', mrg)
|
|
129
|
+
|
|
130
|
+
mergedExon.parent?.deleteChild(secondExon._id)
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
async SplitExonChange(dataStore, change) {
|
|
135
|
+
for (const [idx] of change.changedIds.entries()) {
|
|
136
|
+
const {
|
|
137
|
+
exonToBeSplit,
|
|
138
|
+
parentFeatureId,
|
|
139
|
+
upstreamCut,
|
|
140
|
+
downstreamCut,
|
|
141
|
+
leftExonId,
|
|
142
|
+
rightExonId,
|
|
143
|
+
} = change.changes[idx]
|
|
144
|
+
if (!parentFeatureId) {
|
|
145
|
+
throw new Error('TODO: Split exon without parent')
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const [leftExon, rightExon] = change.makeSplitExons(
|
|
149
|
+
exonToBeSplit,
|
|
150
|
+
upstreamCut,
|
|
151
|
+
downstreamCut,
|
|
152
|
+
leftExonId,
|
|
153
|
+
rightExonId,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
const parentFeature = dataStore.getFeature(parentFeatureId)
|
|
157
|
+
if (!parentFeature) {
|
|
158
|
+
throw new Error(`Could not find parent feature "${parentFeatureId}"`)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
parentFeature.addChild(leftExon)
|
|
162
|
+
parentFeature.addChild(rightExon)
|
|
163
|
+
if (dataStore.getFeature(exonToBeSplit._id)) {
|
|
164
|
+
dataStore.deleteFeature(exonToBeSplit._id)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
async MergeTranscriptsChange(dataStore, change) {
|
|
170
|
+
for (const [idx, changedId] of change.changedIds.entries()) {
|
|
171
|
+
const { firstTranscript, secondTranscript } = change.changes[idx]
|
|
172
|
+
const mergedTranscript = dataStore.getFeature(firstTranscript._id)
|
|
173
|
+
if (!mergedTranscript) {
|
|
174
|
+
throw new Error(`Could not find feature with identifier "${changedId}"`)
|
|
175
|
+
}
|
|
176
|
+
change.mergeTranscriptsOnClient(mergedTranscript, secondTranscript)
|
|
177
|
+
mergedTranscript.parent?.deleteChild(secondTranscript._id)
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
async UndoMergeExonsChange(dataStore, change) {
|
|
182
|
+
for (const c of change.changes) {
|
|
183
|
+
const { exonsToRestore, parentFeatureId } = c
|
|
184
|
+
if (!parentFeatureId) {
|
|
185
|
+
throw new Error('Parent ID is missing')
|
|
186
|
+
}
|
|
187
|
+
const parentFeature = dataStore.getFeature(parentFeatureId)
|
|
188
|
+
if (!parentFeature) {
|
|
189
|
+
throw new Error(`Could not find parent feature "${parentFeatureId}"`)
|
|
190
|
+
}
|
|
191
|
+
// create an ID for the parent feature if it does not have one
|
|
192
|
+
if (!parentFeature.attributes.get('_id')) {
|
|
193
|
+
parentFeature.setAttribute('_id', [parentFeature._id])
|
|
194
|
+
}
|
|
195
|
+
for (const exon of exonsToRestore) {
|
|
196
|
+
parentFeature.addChild(exon)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
async UndoSplitExonChange(dataStore, change) {
|
|
202
|
+
for (const c of change.changes) {
|
|
203
|
+
const { exonToRestore, parentFeatureId, idsToDelete } = c
|
|
204
|
+
if (!parentFeatureId) {
|
|
205
|
+
throw new Error('Parent ID is missing')
|
|
206
|
+
}
|
|
207
|
+
const parentFeature = dataStore.getFeature(parentFeatureId)
|
|
208
|
+
if (!parentFeature) {
|
|
209
|
+
throw new Error(`Could not find parent feature "${parentFeatureId}"`)
|
|
210
|
+
}
|
|
211
|
+
// create an ID for the parent feature if it does not have one
|
|
212
|
+
if (!parentFeature.attributes.get('_id')) {
|
|
213
|
+
parentFeature.setAttribute('_id', [parentFeature._id])
|
|
214
|
+
}
|
|
215
|
+
parentFeature.addChild(exonToRestore)
|
|
216
|
+
idsToDelete.map((id) => {
|
|
217
|
+
parentFeature.deleteChild(id)
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
async UndoMergeTranscriptsChange(dataStore, change) {
|
|
223
|
+
for (const c of change.changes) {
|
|
224
|
+
const { transcriptsToRestore, parentFeatureId } = c
|
|
225
|
+
if (!parentFeatureId) {
|
|
226
|
+
throw new Error('Parent ID is missing')
|
|
227
|
+
}
|
|
228
|
+
const parentFeature = dataStore.getFeature(parentFeatureId)
|
|
229
|
+
if (!parentFeature) {
|
|
230
|
+
throw new Error(`Could not find parent feature "${parentFeatureId}"`)
|
|
231
|
+
}
|
|
232
|
+
// create an ID for the parent feature if it does not have one
|
|
233
|
+
if (!parentFeature.attributes.get('_id')) {
|
|
234
|
+
parentFeature.setAttribute('_id', [parentFeature._id])
|
|
235
|
+
}
|
|
236
|
+
for (const transcript of transcriptsToRestore) {
|
|
237
|
+
parentFeature.addChild(transcript)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
async StrandChange(dataStore, change) {
|
|
243
|
+
for (const [idx, changedId] of change.changedIds.entries()) {
|
|
244
|
+
const feature = dataStore.getFeature(changedId)
|
|
245
|
+
if (!feature) {
|
|
246
|
+
throw new Error(`Could not find feature with identifier "${changedId}"`)
|
|
247
|
+
}
|
|
248
|
+
feature.setStrand(change.changes[idx].newStrand)
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
async TypeChange(dataStore, change) {
|
|
253
|
+
for (const [idx, changedId] of change.changedIds.entries()) {
|
|
254
|
+
const feature = dataStore.getFeature(changedId)
|
|
255
|
+
if (!feature) {
|
|
256
|
+
throw new Error(`Could not find feature with identifier "${changedId}"`)
|
|
257
|
+
}
|
|
258
|
+
feature.setType(change.changes[idx].newType)
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
}
|