@apollo-annotation/jbrowse-plugin-apollo 0.3.7 → 0.3.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.
- package/dist/index.esm.js +2371 -1642
- package/dist/index.esm.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.development.js +2384 -1641
- 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 +4387 -2952
- 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/package.json +15 -15
- package/src/ApolloInternetAccount/model.ts +48 -13
- package/src/BackendDrivers/CollaborationServerDriver.ts +23 -2
- package/src/ChangeManager.ts +33 -13
- package/src/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.tsx +64 -5
- package/src/FeatureDetailsWidget/TranscriptSequence.tsx +70 -73
- package/src/FeatureDetailsWidget/TranscriptWidgetEditLocation.tsx +33 -31
- package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +60 -72
- package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +50 -194
- package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +441 -180
- package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +53 -34
- package/src/LinearApolloDisplay/glyphs/Glyph.ts +7 -9
- package/src/LinearApolloDisplay/stateModel/base.ts +34 -43
- package/src/LinearApolloDisplay/stateModel/layouts.ts +3 -2
- package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +32 -261
- package/src/LinearApolloDisplay/stateModel/rendering.ts +43 -343
- package/src/LinearApolloReferenceSequenceDisplay/components/LinearApolloReferenceSequenceDisplay.tsx +87 -0
- package/src/LinearApolloReferenceSequenceDisplay/components/index.ts +1 -0
- package/src/LinearApolloReferenceSequenceDisplay/configSchema.ts +7 -0
- package/src/LinearApolloReferenceSequenceDisplay/index.ts +3 -0
- package/src/LinearApolloReferenceSequenceDisplay/stateModel/base.ts +227 -0
- package/src/LinearApolloReferenceSequenceDisplay/stateModel/index.ts +25 -0
- package/src/LinearApolloReferenceSequenceDisplay/stateModel/rendering.ts +481 -0
- package/src/LinearApolloSixFrameDisplay/components/LinearApolloSixFrameDisplay.tsx +95 -38
- package/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts +221 -201
- package/src/LinearApolloSixFrameDisplay/glyphs/Glyph.ts +12 -8
- package/src/LinearApolloSixFrameDisplay/stateModel/base.ts +42 -4
- package/src/LinearApolloSixFrameDisplay/stateModel/layouts.ts +4 -8
- package/src/LinearApolloSixFrameDisplay/stateModel/mouseEvents.ts +73 -97
- package/src/LinearApolloSixFrameDisplay/stateModel/rendering.ts +49 -61
- package/src/TabularEditor/HybridGrid/Feature.tsx +16 -14
- package/src/TabularEditor/HybridGrid/HybridGrid.tsx +7 -5
- package/src/components/AddAssembly.tsx +1 -1
- package/src/components/AddAssemblyAliases.tsx +1 -1
- package/src/components/AddChildFeature.tsx +5 -2
- package/src/components/AddFeature.tsx +9 -3
- package/src/components/AddRefSeqAliases.tsx +9 -9
- package/src/components/CopyFeature.tsx +3 -1
- package/src/components/CreateApolloAnnotation.tsx +1 -0
- package/src/components/DeleteAssembly.tsx +1 -1
- package/src/components/EditZoomThresholdDialog.tsx +69 -0
- package/src/components/FilterFeatures.tsx +7 -7
- package/src/components/FilterTranscripts.tsx +6 -6
- package/src/components/ImportFeatures.tsx +1 -1
- package/src/components/ManageChecks.tsx +1 -1
- package/src/components/MergeTranscripts.tsx +12 -15
- package/src/components/OntologyTermMultiSelect.tsx +11 -11
- package/src/components/OpenLocalFile.tsx +11 -7
- package/src/components/ViewCheckResults.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/config.ts +6 -0
- package/src/index.ts +42 -105
- package/src/makeDisplayComponent.tsx +0 -1
- package/src/menus/index.ts +1 -0
- package/src/{ApolloInternetAccount/addMenuItems.ts → menus/topLevelMenu.ts} +56 -47
- package/src/menus/topLevelMenuAdmin.ts +154 -0
- package/src/session/session.ts +162 -116
- package/src/util/annotationFeatureUtils.ts +15 -21
- package/src/util/displayUtils.ts +149 -0
- package/src/util/glyphUtils.ts +152 -0
- package/src/util/mouseEventsUtils.ts +32 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
6
|
+
import { type AnnotationFeature } from '@apollo-annotation/mst'
|
|
7
|
+
import type PluginManager from '@jbrowse/core/PluginManager'
|
|
8
|
+
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'
|
|
9
|
+
import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
|
|
10
|
+
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes'
|
|
11
|
+
import {
|
|
12
|
+
type AbstractSessionModel,
|
|
13
|
+
getContainingView,
|
|
14
|
+
getSession,
|
|
15
|
+
} from '@jbrowse/core/util'
|
|
16
|
+
import { getParentRenderProps } from '@jbrowse/core/util/tracks'
|
|
17
|
+
// import type LinearGenomeViewPlugin from '@jbrowse/plugin-linear-genome-view'
|
|
18
|
+
import { type LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
19
|
+
import { autorun } from 'mobx'
|
|
20
|
+
import { addDisposer, getRoot, types } from 'mobx-state-tree'
|
|
21
|
+
|
|
22
|
+
import { type ApolloInternetAccountModel } from '../../ApolloInternetAccount/model'
|
|
23
|
+
import { type ApolloSessionModel, type HoveredFeature } from '../../session'
|
|
24
|
+
import { type ApolloRootModel } from '../../types'
|
|
25
|
+
|
|
26
|
+
const minDisplayHeight = 20
|
|
27
|
+
|
|
28
|
+
export function baseModelFactory(
|
|
29
|
+
_pluginManager: PluginManager,
|
|
30
|
+
configSchema: AnyConfigurationSchemaType,
|
|
31
|
+
) {
|
|
32
|
+
return BaseDisplay.named('BaseLinearApolloReferenceSequenceDisplay')
|
|
33
|
+
.props({
|
|
34
|
+
type: types.literal('LinearApolloReferenceSequenceDisplay'),
|
|
35
|
+
configuration: ConfigurationReference(configSchema),
|
|
36
|
+
showStartCodons: false,
|
|
37
|
+
showStopCodons: true,
|
|
38
|
+
highContrast: false,
|
|
39
|
+
heightPreConfig: types.maybe(
|
|
40
|
+
types.refinement(
|
|
41
|
+
'displayHeight',
|
|
42
|
+
types.number,
|
|
43
|
+
(n) => n >= minDisplayHeight,
|
|
44
|
+
),
|
|
45
|
+
),
|
|
46
|
+
sequenceRowHeight: 15,
|
|
47
|
+
})
|
|
48
|
+
.views((self) => {
|
|
49
|
+
const { configuration, renderProps: superRenderProps } = self
|
|
50
|
+
return {
|
|
51
|
+
renderProps() {
|
|
52
|
+
return {
|
|
53
|
+
...superRenderProps(),
|
|
54
|
+
...getParentRenderProps(self),
|
|
55
|
+
config: configuration.renderer,
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.views((self) => ({
|
|
61
|
+
get lgv() {
|
|
62
|
+
return getContainingView(self) as unknown as LinearGenomeViewModel
|
|
63
|
+
},
|
|
64
|
+
}))
|
|
65
|
+
.views((self) => ({
|
|
66
|
+
get rendererTypeName() {
|
|
67
|
+
return self.configuration.renderer.type
|
|
68
|
+
},
|
|
69
|
+
get session() {
|
|
70
|
+
return getSession(self) as unknown as ApolloSessionModel
|
|
71
|
+
},
|
|
72
|
+
get regions() {
|
|
73
|
+
const regions = self.lgv.dynamicBlocks.contentBlocks.map(
|
|
74
|
+
({ assemblyName, end, refName, start }) => ({
|
|
75
|
+
assemblyName,
|
|
76
|
+
refName,
|
|
77
|
+
start: Math.round(start),
|
|
78
|
+
end: Math.round(end),
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
81
|
+
return regions
|
|
82
|
+
},
|
|
83
|
+
regionCannotBeRendered(/* region */) {
|
|
84
|
+
if (self.lgv && self.lgv.bpPerPx >= 3) {
|
|
85
|
+
return 'Zoom in to see sequence'
|
|
86
|
+
}
|
|
87
|
+
return
|
|
88
|
+
},
|
|
89
|
+
}))
|
|
90
|
+
.views((self) => ({
|
|
91
|
+
get apolloInternetAccount() {
|
|
92
|
+
const [region] = self.regions
|
|
93
|
+
const { internetAccounts } = getRoot<ApolloRootModel>(self)
|
|
94
|
+
const { assemblyName } = region
|
|
95
|
+
const { assemblyManager } =
|
|
96
|
+
self.session as unknown as AbstractSessionModel
|
|
97
|
+
const assembly = assemblyManager.get(assemblyName)
|
|
98
|
+
if (!assembly) {
|
|
99
|
+
throw new Error(`No assembly found with name ${assemblyName}`)
|
|
100
|
+
}
|
|
101
|
+
const { internetAccountConfigId } = getConf(assembly, [
|
|
102
|
+
'sequence',
|
|
103
|
+
'metadata',
|
|
104
|
+
]) as { internetAccountConfigId: string }
|
|
105
|
+
return internetAccounts.find(
|
|
106
|
+
(ia) => getConf(ia, 'internetAccountId') === internetAccountConfigId,
|
|
107
|
+
) as ApolloInternetAccountModel | undefined
|
|
108
|
+
},
|
|
109
|
+
get changeManager() {
|
|
110
|
+
return (self.session as unknown as ApolloSessionModel).apolloDataStore
|
|
111
|
+
.changeManager
|
|
112
|
+
},
|
|
113
|
+
getAssemblyId(assemblyName: string) {
|
|
114
|
+
const { assemblyManager } =
|
|
115
|
+
self.session as unknown as AbstractSessionModel
|
|
116
|
+
const assembly = assemblyManager.get(assemblyName)
|
|
117
|
+
if (!assembly) {
|
|
118
|
+
throw new Error(`Could not find assembly named ${assemblyName}`)
|
|
119
|
+
}
|
|
120
|
+
return assembly.name
|
|
121
|
+
},
|
|
122
|
+
get selectedFeature(): AnnotationFeature | undefined {
|
|
123
|
+
return (self.session as unknown as ApolloSessionModel)
|
|
124
|
+
.apolloSelectedFeature
|
|
125
|
+
},
|
|
126
|
+
get hoveredFeature(): HoveredFeature | undefined {
|
|
127
|
+
return (self.session as unknown as ApolloSessionModel)
|
|
128
|
+
.apolloHoveredFeature
|
|
129
|
+
},
|
|
130
|
+
get height() {
|
|
131
|
+
const { sequenceRowHeight } = self
|
|
132
|
+
return self.lgv.bpPerPx <= 1
|
|
133
|
+
? sequenceRowHeight * 8
|
|
134
|
+
: sequenceRowHeight * 6
|
|
135
|
+
},
|
|
136
|
+
}))
|
|
137
|
+
.volatile(() => ({
|
|
138
|
+
scrollTop: 0,
|
|
139
|
+
}))
|
|
140
|
+
.actions((self) => ({
|
|
141
|
+
setScrollTop(scrollTop: number) {
|
|
142
|
+
self.scrollTop = scrollTop
|
|
143
|
+
},
|
|
144
|
+
setHeight(displayHeight: number) {
|
|
145
|
+
self.heightPreConfig = Math.max(displayHeight, minDisplayHeight)
|
|
146
|
+
return self.height
|
|
147
|
+
},
|
|
148
|
+
resizeHeight(distance: number) {
|
|
149
|
+
const oldHeight = self.height
|
|
150
|
+
const newHeight = this.setHeight(self.height + distance)
|
|
151
|
+
return newHeight - oldHeight
|
|
152
|
+
},
|
|
153
|
+
toggleShowStartCodons() {
|
|
154
|
+
self.showStartCodons = !self.showStartCodons
|
|
155
|
+
},
|
|
156
|
+
toggleShowStopCodons() {
|
|
157
|
+
self.showStopCodons = !self.showStopCodons
|
|
158
|
+
},
|
|
159
|
+
toggleHighContrast() {
|
|
160
|
+
self.highContrast = !self.highContrast
|
|
161
|
+
},
|
|
162
|
+
}))
|
|
163
|
+
.views((self) => {
|
|
164
|
+
const { trackMenuItems: superTrackMenuItems } = self
|
|
165
|
+
return {
|
|
166
|
+
trackMenuItems() {
|
|
167
|
+
const { showStartCodons, showStopCodons, highContrast } = self
|
|
168
|
+
return [
|
|
169
|
+
...superTrackMenuItems(),
|
|
170
|
+
{
|
|
171
|
+
type: 'subMenu',
|
|
172
|
+
label: 'Appearance',
|
|
173
|
+
subMenu: [
|
|
174
|
+
{
|
|
175
|
+
label: 'Show start codons',
|
|
176
|
+
type: 'checkbox',
|
|
177
|
+
checked: showStartCodons,
|
|
178
|
+
onClick: () => {
|
|
179
|
+
self.toggleShowStartCodons()
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: 'Show stop codons',
|
|
184
|
+
type: 'checkbox',
|
|
185
|
+
checked: showStopCodons,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
self.toggleShowStopCodons()
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: 'Use high contrast colors',
|
|
192
|
+
type: 'checkbox',
|
|
193
|
+
checked: highContrast,
|
|
194
|
+
onClick: () => {
|
|
195
|
+
self.toggleHighContrast()
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
.actions((self) => ({
|
|
205
|
+
afterAttach() {
|
|
206
|
+
addDisposer(
|
|
207
|
+
self,
|
|
208
|
+
autorun(
|
|
209
|
+
() => {
|
|
210
|
+
if (!self.lgv.initialized || self.regionCannotBeRendered()) {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
if (self.lgv.bpPerPx <= 3) {
|
|
214
|
+
void (
|
|
215
|
+
self.session as unknown as ApolloSessionModel
|
|
216
|
+
).apolloDataStore.loadRefSeq(self.regions)
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'LinearApolloReferenceSequenceDisplayLoadFeatures',
|
|
221
|
+
delay: 1000,
|
|
222
|
+
},
|
|
223
|
+
),
|
|
224
|
+
)
|
|
225
|
+
},
|
|
226
|
+
}))
|
|
227
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
+
import { type AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configurationSchema'
|
|
3
|
+
import { type Instance } from 'mobx-state-tree'
|
|
4
|
+
|
|
5
|
+
import { renderingModelFactory } from './rendering'
|
|
6
|
+
|
|
7
|
+
export function stateModelFactory(
|
|
8
|
+
pluginManager: PluginManager,
|
|
9
|
+
configSchema: AnyConfigurationSchemaType,
|
|
10
|
+
) {
|
|
11
|
+
// TODO: this needs to be refactored so that the final composition of the
|
|
12
|
+
// state model mixins happens here in one central place
|
|
13
|
+
return renderingModelFactory(pluginManager, configSchema).named(
|
|
14
|
+
'LinearApolloReferenceSequenceDisplay',
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type LinearApolloReferenceSequenceDisplayStateModel = ReturnType<
|
|
19
|
+
typeof stateModelFactory
|
|
20
|
+
>
|
|
21
|
+
// eslint disable because of
|
|
22
|
+
// https://mobx-state-tree.js.org/tips/typescript#using-a-mst-type-at-design-time
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
24
|
+
export interface LinearApolloReferenceSequenceDisplay
|
|
25
|
+
extends Instance<LinearApolloReferenceSequenceDisplayStateModel> {}
|