@apollo-annotation/jbrowse-plugin-apollo 0.1.18 → 0.1.20
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 +3189 -3575
- package/dist/index.esm.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.development.js +3185 -3570
- 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 +14884 -15905
- 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 +33 -33
- package/src/ApolloInternetAccount/addMenuItems.ts +18 -0
- package/src/ApolloInternetAccount/components/AuthTypeSelector.tsx +1 -0
- package/src/ApolloInternetAccount/configSchema.ts +5 -2
- package/src/ApolloInternetAccount/model.ts +14 -5
- package/src/ApolloRefNameAliasAdapter/ApolloRefNameAliasAdapter.ts +94 -0
- package/src/ApolloRefNameAliasAdapter/configSchema.ts +12 -0
- package/src/ApolloRefNameAliasAdapter/index.ts +21 -0
- package/src/ApolloSequenceAdapter/ApolloSequenceAdapter.ts +1 -0
- package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +10 -10
- package/src/ApolloTextSearchAdapter/ApolloTextSearchAdapter.ts +35 -32
- package/src/BackendDrivers/BackendDriver.ts +8 -0
- package/src/BackendDrivers/CollaborationServerDriver.ts +49 -1
- package/src/BackendDrivers/DesktopFileDriver.ts +14 -1
- package/src/BackendDrivers/InMemoryFileDriver.ts +17 -1
- package/src/ChangeManager.ts +1 -1
- package/src/FeatureDetailsWidget/ApolloFeatureDetailsWidget.tsx +5 -25
- package/src/FeatureDetailsWidget/ApolloTranscriptDetailsWidget.tsx +82 -0
- package/src/FeatureDetailsWidget/Attributes.tsx +11 -3
- package/src/FeatureDetailsWidget/BasicInformation.tsx +38 -30
- package/src/FeatureDetailsWidget/Sequence.tsx +7 -7
- package/src/FeatureDetailsWidget/TranscriptBasic.tsx +446 -0
- package/src/FeatureDetailsWidget/TranscriptSequence.tsx +365 -0
- package/src/FeatureDetailsWidget/index.ts +2 -0
- package/src/FeatureDetailsWidget/model.ts +77 -9
- package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +0 -2
- package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +453 -380
- package/src/LinearApolloDisplay/glyphs/GeneGlyph.ts +520 -0
- package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +138 -134
- package/src/LinearApolloDisplay/glyphs/Glyph.ts +38 -370
- package/src/LinearApolloDisplay/glyphs/index.ts +1 -2
- package/src/LinearApolloDisplay/stateModel/base.ts +3 -6
- package/src/LinearApolloDisplay/stateModel/getGlyph.ts +30 -30
- package/src/LinearApolloDisplay/stateModel/index.ts +5 -1
- package/src/LinearApolloDisplay/stateModel/layouts.ts +32 -24
- package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +206 -217
- package/src/LinearApolloDisplay/stateModel/rendering.ts +43 -67
- package/src/OntologyManager/OntologyStore/fulltext.ts +1 -1
- package/src/OntologyManager/OntologyStore/index.ts +2 -1
- package/src/OntologyManager/index.ts +6 -2
- package/src/OntologyManager/util.ts +2 -2
- package/src/SixFrameFeatureDisplay/stateModel.ts +15 -10
- package/src/TabularEditor/HybridGrid/ChangeHandling.ts +21 -46
- package/src/TabularEditor/HybridGrid/Feature.tsx +31 -82
- package/src/TabularEditor/HybridGrid/FeatureAttributes.tsx +3 -2
- package/src/TabularEditor/HybridGrid/HybridGrid.tsx +2 -3
- package/src/TabularEditor/HybridGrid/NumberCell.tsx +1 -0
- package/src/TabularEditor/HybridGrid/featureContextMenuItems.ts +46 -5
- package/src/TabularEditor/model.ts +5 -3
- package/src/components/AddAssembly.tsx +15 -9
- package/src/components/AddChildFeature.tsx +7 -73
- package/src/components/AddFeature.tsx +2 -57
- package/src/components/AddRefSeqAliases.tsx +285 -0
- package/src/components/CopyFeature.tsx +16 -33
- package/src/components/DeleteFeature.tsx +4 -6
- package/src/components/ImportFeatures.tsx +6 -3
- package/src/components/LogOut.tsx +105 -0
- package/src/components/ManageChecks.tsx +1 -0
- package/src/components/ManageUsers.tsx +21 -1
- package/src/components/ModifyFeatureAttribute.tsx +2 -2
- package/src/components/OntologyTermAutocomplete.tsx +0 -2
- package/src/components/OntologyTermMultiSelect.tsx +1 -0
- package/src/components/OpenLocalFile.tsx +6 -5
- package/src/components/ViewChangeLog.tsx +1 -0
- package/src/components/ViewCheckResults.tsx +1 -0
- package/src/components/index.ts +4 -0
- package/src/extensions/annotationFromPileup.ts +10 -16
- package/src/index.ts +57 -3
- package/src/session/ClientDataStore.ts +49 -46
- package/src/session/session.ts +186 -114
- package/src/util/loadAssemblyIntoClient.ts +4 -210
- package/src/FeatureDetailsWidget/RelatedFeature.tsx +0 -97
- package/src/LinearApolloDisplay/glyphs/CanonicalGeneGlyph.ts +0 -1204
- package/src/LinearApolloDisplay/glyphs/ImplicitExonGeneGlyph.ts +0 -716
- package/src/LinearApolloDisplay/stateModel/glyphs.ts +0 -47
|
@@ -1,154 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
-
/* eslint-disable @typescript-eslint/unbound-method */
|
|
4
|
-
import { AnnotationFeatureI } from '@apollo-annotation/mst'
|
|
1
|
+
import { AnnotationFeature } from '@apollo-annotation/mst'
|
|
5
2
|
|
|
6
3
|
import { LinearApolloDisplay } from '../stateModel'
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { boxGlyph, isSelectedFeature, drawBox } from './BoxGlyph'
|
|
5
|
+
import { Glyph } from './Glyph'
|
|
6
|
+
import { LinearApolloDisplayRendering } from '../stateModel/rendering'
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
features.push(...this.featuresForRow(child))
|
|
17
|
-
}
|
|
8
|
+
function featuresForRow(feature: AnnotationFeature): AnnotationFeature[][] {
|
|
9
|
+
const features = [[feature]]
|
|
10
|
+
if (feature.children) {
|
|
11
|
+
for (const [, child] of feature.children) {
|
|
12
|
+
features.push(...featuresForRow(child))
|
|
18
13
|
}
|
|
19
|
-
return features
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getRowCount(feature: AnnotationFeatureI) {
|
|
23
|
-
return this.featuresForRow(feature).length
|
|
24
14
|
}
|
|
15
|
+
return features
|
|
16
|
+
}
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
feature: AnnotationFeatureI,
|
|
30
|
-
xOffset: number,
|
|
31
|
-
row: number,
|
|
32
|
-
reversed: boolean,
|
|
33
|
-
) {
|
|
34
|
-
for (let i = 0; i < this.getRowCount(feature); i++) {
|
|
35
|
-
this.drawRow(stateModel, ctx, feature, xOffset, row + i, row, reversed)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
18
|
+
function getRowCount(feature: AnnotationFeature) {
|
|
19
|
+
return featuresForRow(feature).length
|
|
20
|
+
}
|
|
38
21
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const features = this.featuresForRow(topLevelFeature)[row - topRow]
|
|
49
|
-
for (const feature of features) {
|
|
50
|
-
this.drawFeature(
|
|
51
|
-
stateModel,
|
|
52
|
-
ctx,
|
|
53
|
-
topLevelFeature,
|
|
54
|
-
feature,
|
|
55
|
-
xOffset,
|
|
56
|
-
row,
|
|
57
|
-
reversed,
|
|
58
|
-
)
|
|
59
|
-
}
|
|
22
|
+
function draw(
|
|
23
|
+
ctx: CanvasRenderingContext2D,
|
|
24
|
+
feature: AnnotationFeature,
|
|
25
|
+
row: number,
|
|
26
|
+
stateModel: LinearApolloDisplayRendering,
|
|
27
|
+
displayedRegionIndex: number,
|
|
28
|
+
) {
|
|
29
|
+
for (let i = 0; i < getRowCount(feature); i++) {
|
|
30
|
+
drawRow(ctx, feature, row + i, row, stateModel, displayedRegionIndex)
|
|
60
31
|
}
|
|
32
|
+
}
|
|
61
33
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const { apolloSelectedFeature } = session
|
|
74
|
-
const offsetPx = (feature.start - topLevelFeature.min) / bpPerPx
|
|
75
|
-
const widthPx = feature.length / bpPerPx
|
|
76
|
-
const startPx = reversed ? xOffset - offsetPx - widthPx : xOffset + offsetPx
|
|
77
|
-
const top = row * heightPx
|
|
78
|
-
const rowCount = this.getRowCount(feature)
|
|
79
|
-
const isSelected = this.getIsSelectedFeature(feature, apolloSelectedFeature)
|
|
80
|
-
const groupingColor = isSelected
|
|
81
|
-
? 'rgba(130,0,0,0.45)'
|
|
82
|
-
: 'rgba(255,0,0,0.25)'
|
|
83
|
-
if (rowCount > 1) {
|
|
84
|
-
// draw background that encapsulates all child features
|
|
85
|
-
const featureHeight = rowCount * heightPx
|
|
86
|
-
this.drawBox(ctx, startPx, top, widthPx, featureHeight, groupingColor)
|
|
87
|
-
}
|
|
88
|
-
super.draw(stateModel, ctx, feature, startPx, row, reversed)
|
|
34
|
+
function drawRow(
|
|
35
|
+
ctx: CanvasRenderingContext2D,
|
|
36
|
+
topLevelFeature: AnnotationFeature,
|
|
37
|
+
row: number,
|
|
38
|
+
topRow: number,
|
|
39
|
+
stateModel: LinearApolloDisplayRendering,
|
|
40
|
+
displayedRegionIndex: number,
|
|
41
|
+
) {
|
|
42
|
+
const features = featuresForRow(topLevelFeature)[row - topRow]
|
|
43
|
+
for (const feature of features) {
|
|
44
|
+
drawFeature(ctx, feature, row, stateModel, displayedRegionIndex)
|
|
89
45
|
}
|
|
46
|
+
}
|
|
90
47
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
48
|
+
function drawFeature(
|
|
49
|
+
ctx: CanvasRenderingContext2D,
|
|
50
|
+
feature: AnnotationFeature,
|
|
51
|
+
row: number,
|
|
52
|
+
stateModel: LinearApolloDisplayRendering,
|
|
53
|
+
displayedRegionIndex: number,
|
|
54
|
+
) {
|
|
55
|
+
const { apolloRowHeight: heightPx, lgv, session } = stateModel
|
|
56
|
+
const { bpPerPx, displayedRegions, offsetPx } = lgv
|
|
57
|
+
const displayedRegion = displayedRegions[displayedRegionIndex]
|
|
58
|
+
const minX =
|
|
59
|
+
(lgv.bpToPx({
|
|
60
|
+
refName: displayedRegion.refName,
|
|
61
|
+
coord: feature.min,
|
|
62
|
+
regionNumber: displayedRegionIndex,
|
|
63
|
+
})?.offsetPx ?? 0) - offsetPx
|
|
64
|
+
const { reversed } = displayedRegion
|
|
65
|
+
const { apolloSelectedFeature } = session
|
|
66
|
+
const widthPx = feature.length / bpPerPx
|
|
67
|
+
const startPx = reversed ? minX - widthPx : minX
|
|
68
|
+
const top = row * heightPx
|
|
69
|
+
const rowCount = getRowCount(feature)
|
|
70
|
+
const isSelected = isSelectedFeature(feature, apolloSelectedFeature)
|
|
71
|
+
const groupingColor = isSelected ? 'rgba(130,0,0,0.45)' : 'rgba(255,0,0,0.25)'
|
|
72
|
+
if (rowCount > 1) {
|
|
73
|
+
// draw background that encapsulates all child features
|
|
74
|
+
const featureHeight = rowCount * heightPx
|
|
75
|
+
drawBox(ctx, startPx, top, widthPx, featureHeight, groupingColor)
|
|
118
76
|
}
|
|
77
|
+
boxGlyph.draw(ctx, feature, row, stateModel, displayedRegionIndex)
|
|
78
|
+
}
|
|
119
79
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
80
|
+
function drawHover(
|
|
81
|
+
stateModel: LinearApolloDisplay,
|
|
82
|
+
ctx: CanvasRenderingContext2D,
|
|
83
|
+
) {
|
|
84
|
+
const { apolloHover, apolloRowHeight, lgv } = stateModel
|
|
85
|
+
if (!apolloHover) {
|
|
86
|
+
return
|
|
128
87
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
): void {
|
|
134
|
-
// pass
|
|
88
|
+
const { feature } = apolloHover
|
|
89
|
+
const position = stateModel.getFeatureLayoutPosition(feature)
|
|
90
|
+
if (!position) {
|
|
91
|
+
return
|
|
135
92
|
}
|
|
93
|
+
const { featureRow, layoutIndex, layoutRow } = position
|
|
94
|
+
const { bpPerPx, displayedRegions, offsetPx } = lgv
|
|
95
|
+
const displayedRegion = displayedRegions[layoutIndex]
|
|
96
|
+
const { refName, reversed } = displayedRegion
|
|
97
|
+
const { length, max, min } = feature
|
|
98
|
+
const startPx =
|
|
99
|
+
(lgv.bpToPx({
|
|
100
|
+
refName,
|
|
101
|
+
coord: reversed ? max : min,
|
|
102
|
+
regionNumber: layoutIndex,
|
|
103
|
+
})?.offsetPx ?? 0) - offsetPx
|
|
104
|
+
const top = (layoutRow + featureRow) * apolloRowHeight
|
|
105
|
+
const widthPx = length / bpPerPx
|
|
106
|
+
ctx.fillStyle = 'rgba(0,0,0,0.2)'
|
|
107
|
+
ctx.fillRect(startPx, top, widthPx, apolloRowHeight * getRowCount(feature))
|
|
108
|
+
}
|
|
136
109
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
110
|
+
function getFeatureFromLayout(
|
|
111
|
+
feature: AnnotationFeature,
|
|
112
|
+
bp: number,
|
|
113
|
+
row: number,
|
|
114
|
+
) {
|
|
115
|
+
const layoutRow = featuresForRow(feature)[row]
|
|
116
|
+
return layoutRow.find((f) => bp >= f.min && bp <= f.max)
|
|
117
|
+
}
|
|
141
118
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
119
|
+
function getRowForFeature(
|
|
120
|
+
feature: AnnotationFeature,
|
|
121
|
+
childFeature: AnnotationFeature,
|
|
122
|
+
) {
|
|
123
|
+
const rows = featuresForRow(feature)
|
|
124
|
+
for (const [idx, row] of rows.entries()) {
|
|
125
|
+
if (row.some((feature) => feature._id === childFeature._id)) {
|
|
126
|
+
return idx
|
|
151
127
|
}
|
|
152
|
-
return
|
|
153
128
|
}
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// False positive here, none of these functions use "this"
|
|
133
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
134
|
+
const {
|
|
135
|
+
drawDragPreview,
|
|
136
|
+
drawTooltip,
|
|
137
|
+
getContextMenuItems,
|
|
138
|
+
onMouseDown,
|
|
139
|
+
onMouseLeave,
|
|
140
|
+
onMouseMove,
|
|
141
|
+
onMouseUp,
|
|
142
|
+
} = boxGlyph
|
|
143
|
+
/* eslint-enable @typescript-eslint/unbound-method */
|
|
144
|
+
|
|
145
|
+
export const genericChildGlyph: Glyph = {
|
|
146
|
+
draw,
|
|
147
|
+
drawDragPreview,
|
|
148
|
+
drawHover,
|
|
149
|
+
drawTooltip,
|
|
150
|
+
getContextMenuItems,
|
|
151
|
+
getFeatureFromLayout,
|
|
152
|
+
getRowCount,
|
|
153
|
+
getRowForFeature,
|
|
154
|
+
onMouseDown,
|
|
155
|
+
onMouseLeave,
|
|
156
|
+
onMouseMove,
|
|
157
|
+
onMouseUp,
|
|
154
158
|
}
|