@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,12 +1,8 @@
|
|
|
1
1
|
import { ClientDataStore, checkRegistry } from '@apollo-annotation/common'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ApolloAssemblyI,
|
|
5
|
-
CheckResultSnapshot,
|
|
6
|
-
} from '@apollo-annotation/mst'
|
|
2
|
+
import { ApolloAssemblyI, CheckResultSnapshot } from '@apollo-annotation/mst'
|
|
3
|
+
import { gff3ToAnnotationFeature } from '@apollo-annotation/shared'
|
|
7
4
|
import gff, { GFF3Comment, GFF3Feature, GFF3Sequence } from '@gmod/gff'
|
|
8
5
|
import { getSnapshot } from 'mobx-state-tree'
|
|
9
|
-
import { nanoid } from 'nanoid'
|
|
10
6
|
|
|
11
7
|
export async function loadAssemblyIntoClient(
|
|
12
8
|
assemblyId: string,
|
|
@@ -27,13 +23,13 @@ export async function loadAssemblyIntoClient(
|
|
|
27
23
|
let sequenceFeatureCount = 0
|
|
28
24
|
let assembly = apolloDataStore.assemblies.get(assemblyId)
|
|
29
25
|
if (!assembly) {
|
|
30
|
-
assembly = apolloDataStore.addAssembly(assemblyId)
|
|
26
|
+
assembly = apolloDataStore.addAssembly(assemblyId, 'InMemoryFileDriver')
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
for (const seqLine of featuresAndSequences) {
|
|
34
30
|
if (Array.isArray(seqLine)) {
|
|
35
31
|
// regular feature
|
|
36
|
-
const feature =
|
|
32
|
+
const feature = gff3ToAnnotationFeature(seqLine)
|
|
37
33
|
|
|
38
34
|
const ref =
|
|
39
35
|
assembly.refSeqs.get(feature.refSeq) ??
|
|
@@ -88,205 +84,3 @@ export async function checkFeatures(
|
|
|
88
84
|
}
|
|
89
85
|
return checkResults
|
|
90
86
|
}
|
|
91
|
-
|
|
92
|
-
function createFeature(gff3Feature: GFF3Feature): AnnotationFeatureSnapshot {
|
|
93
|
-
const [firstFeature] = gff3Feature
|
|
94
|
-
const {
|
|
95
|
-
attributes,
|
|
96
|
-
child_features: childFeatures,
|
|
97
|
-
end,
|
|
98
|
-
phase,
|
|
99
|
-
score,
|
|
100
|
-
seq_id: refName,
|
|
101
|
-
source,
|
|
102
|
-
start,
|
|
103
|
-
strand,
|
|
104
|
-
type,
|
|
105
|
-
} = firstFeature
|
|
106
|
-
if (!refName) {
|
|
107
|
-
throw new Error(
|
|
108
|
-
`feature does not have seq_id: ${JSON.stringify(firstFeature)}`,
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
if (!type) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
`feature does not have type: ${JSON.stringify(firstFeature)}`,
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
if (start === null) {
|
|
117
|
-
throw new Error(
|
|
118
|
-
`feature does not have start: ${JSON.stringify(firstFeature)}`,
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
if (end === null) {
|
|
122
|
-
throw new Error(
|
|
123
|
-
`feature does not have end: ${JSON.stringify(firstFeature)}`,
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
const feature: AnnotationFeatureSnapshot = {
|
|
127
|
-
_id: nanoid(),
|
|
128
|
-
gffId: '',
|
|
129
|
-
refSeq: refName,
|
|
130
|
-
type,
|
|
131
|
-
start: start - 1,
|
|
132
|
-
end,
|
|
133
|
-
}
|
|
134
|
-
if (gff3Feature.length > 1) {
|
|
135
|
-
feature.discontinuousLocations = gff3Feature.map((f) => {
|
|
136
|
-
const { end: subEnd, phase: locationPhase, start: subStart } = f
|
|
137
|
-
if (subStart === null || subEnd === null) {
|
|
138
|
-
throw new Error(
|
|
139
|
-
`feature does not have start and/or end: ${JSON.stringify(f)}`,
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
|
-
let parsedPhase: 0 | 1 | 2 | undefined
|
|
143
|
-
if (locationPhase) {
|
|
144
|
-
switch (locationPhase) {
|
|
145
|
-
case '0': {
|
|
146
|
-
parsedPhase = 0
|
|
147
|
-
|
|
148
|
-
break
|
|
149
|
-
}
|
|
150
|
-
case '1': {
|
|
151
|
-
parsedPhase = 1
|
|
152
|
-
|
|
153
|
-
break
|
|
154
|
-
}
|
|
155
|
-
case '2': {
|
|
156
|
-
parsedPhase = 2
|
|
157
|
-
|
|
158
|
-
break
|
|
159
|
-
}
|
|
160
|
-
default: {
|
|
161
|
-
throw new Error(`Unknown phase: "${locationPhase}"`)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return { start: subStart - 1, end: subEnd, phase: parsedPhase }
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
if (strand) {
|
|
169
|
-
if (strand === '+') {
|
|
170
|
-
feature.strand = 1
|
|
171
|
-
} else if (strand === '-') {
|
|
172
|
-
feature.strand = -1
|
|
173
|
-
} else {
|
|
174
|
-
throw new Error(`Unknown strand: "${strand}"`)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (score !== null) {
|
|
178
|
-
feature.score = score
|
|
179
|
-
}
|
|
180
|
-
if (phase) {
|
|
181
|
-
switch (phase) {
|
|
182
|
-
case '0': {
|
|
183
|
-
feature.phase = 0
|
|
184
|
-
|
|
185
|
-
break
|
|
186
|
-
}
|
|
187
|
-
case '1': {
|
|
188
|
-
feature.phase = 1
|
|
189
|
-
|
|
190
|
-
break
|
|
191
|
-
}
|
|
192
|
-
case '2': {
|
|
193
|
-
feature.phase = 2
|
|
194
|
-
|
|
195
|
-
break
|
|
196
|
-
}
|
|
197
|
-
default: {
|
|
198
|
-
throw new Error(`Unknown phase: "${phase}"`)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (childFeatures.length > 0) {
|
|
204
|
-
const children: Record<string, AnnotationFeatureSnapshot> = {}
|
|
205
|
-
for (const childFeature of childFeatures) {
|
|
206
|
-
const child = createFeature(childFeature)
|
|
207
|
-
children[child._id] = child
|
|
208
|
-
// Add value to gffId
|
|
209
|
-
child.attributes?._id
|
|
210
|
-
? (child.gffId = child.attributes._id.toString())
|
|
211
|
-
: (child.gffId = child._id)
|
|
212
|
-
}
|
|
213
|
-
feature.children = children
|
|
214
|
-
}
|
|
215
|
-
if (source ?? attributes) {
|
|
216
|
-
const attrs: Record<string, string[]> = {}
|
|
217
|
-
if (source) {
|
|
218
|
-
attrs.source = [source]
|
|
219
|
-
}
|
|
220
|
-
if (attributes) {
|
|
221
|
-
for (const [key, val] of Object.entries(attributes)) {
|
|
222
|
-
if (val) {
|
|
223
|
-
const newKey = key.toLowerCase()
|
|
224
|
-
if (newKey !== 'parent') {
|
|
225
|
-
// attrs[key.toLowerCase()] = val
|
|
226
|
-
switch (key) {
|
|
227
|
-
case 'ID': {
|
|
228
|
-
attrs._id = val
|
|
229
|
-
break
|
|
230
|
-
}
|
|
231
|
-
case 'Name': {
|
|
232
|
-
attrs.gff_name = val
|
|
233
|
-
break
|
|
234
|
-
}
|
|
235
|
-
case 'Alias': {
|
|
236
|
-
attrs.gff_alias = val
|
|
237
|
-
break
|
|
238
|
-
}
|
|
239
|
-
case 'Target': {
|
|
240
|
-
attrs.gff_target = val
|
|
241
|
-
break
|
|
242
|
-
}
|
|
243
|
-
case 'Gap': {
|
|
244
|
-
attrs.gff_gap = val
|
|
245
|
-
break
|
|
246
|
-
}
|
|
247
|
-
case 'Derives_from': {
|
|
248
|
-
attrs.gff_derives_from = val
|
|
249
|
-
break
|
|
250
|
-
}
|
|
251
|
-
case 'Note': {
|
|
252
|
-
attrs.gff_note = val
|
|
253
|
-
break
|
|
254
|
-
}
|
|
255
|
-
case 'Dbxref': {
|
|
256
|
-
attrs.gff_dbxref = val
|
|
257
|
-
break
|
|
258
|
-
}
|
|
259
|
-
case 'Ontology_term': {
|
|
260
|
-
const goTerms: string[] = []
|
|
261
|
-
const otherTerms: string[] = []
|
|
262
|
-
for (const v of val) {
|
|
263
|
-
if (v.startsWith('GO:')) {
|
|
264
|
-
goTerms.push(v)
|
|
265
|
-
} else {
|
|
266
|
-
otherTerms.push(v)
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (goTerms.length > 0) {
|
|
270
|
-
attrs['Gene Ontology'] = goTerms
|
|
271
|
-
}
|
|
272
|
-
if (otherTerms.length > 0) {
|
|
273
|
-
attrs.gff_ontology_term = otherTerms
|
|
274
|
-
}
|
|
275
|
-
break
|
|
276
|
-
}
|
|
277
|
-
case 'Is_circular': {
|
|
278
|
-
attrs.gff_is_circular = val
|
|
279
|
-
break
|
|
280
|
-
}
|
|
281
|
-
default: {
|
|
282
|
-
attrs[key.toLowerCase()] = val
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
feature.attributes = attrs
|
|
290
|
-
}
|
|
291
|
-
return feature
|
|
292
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
|
-
import { AnnotationFeature, AnnotationFeatureI } from '@apollo-annotation/mst'
|
|
5
|
-
import { SessionWithWidgets } from '@jbrowse/core/util'
|
|
6
|
-
import { Button, Paper, Typography } from '@mui/material'
|
|
7
|
-
import { observer } from 'mobx-react'
|
|
8
|
-
import { IMSTMap } from 'mobx-state-tree'
|
|
9
|
-
import React from 'react'
|
|
10
|
-
import { makeStyles } from 'tss-react/mui'
|
|
11
|
-
|
|
12
|
-
import { ApolloSessionModel } from '../session'
|
|
13
|
-
|
|
14
|
-
const useStyles = makeStyles()((theme) => ({
|
|
15
|
-
paper: {
|
|
16
|
-
margin: theme.spacing(2),
|
|
17
|
-
padding: theme.spacing(2),
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
},
|
|
21
|
-
}))
|
|
22
|
-
|
|
23
|
-
export const RelatedFeatures = observer(function RelatedFeatures({
|
|
24
|
-
assembly,
|
|
25
|
-
feature,
|
|
26
|
-
refName,
|
|
27
|
-
session,
|
|
28
|
-
}: {
|
|
29
|
-
feature: AnnotationFeatureI
|
|
30
|
-
refName: string
|
|
31
|
-
session: ApolloSessionModel
|
|
32
|
-
assembly: string
|
|
33
|
-
}) {
|
|
34
|
-
const { classes } = useStyles()
|
|
35
|
-
const { parent } = feature
|
|
36
|
-
const { children } = feature as {
|
|
37
|
-
children?: IMSTMap<typeof AnnotationFeature>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const onButtonClick = (newFeature: AnnotationFeatureI) => {
|
|
41
|
-
if (parent) {
|
|
42
|
-
const apolloFeatureWidget = (
|
|
43
|
-
session as unknown as SessionWithWidgets
|
|
44
|
-
).addWidget('ApolloFeatureDetailsWidget', 'apolloFeatureDetailsWidget', {
|
|
45
|
-
feature: newFeature,
|
|
46
|
-
assembly,
|
|
47
|
-
refName,
|
|
48
|
-
})
|
|
49
|
-
;(session as unknown as SessionWithWidgets).showWidget(
|
|
50
|
-
apolloFeatureWidget,
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!(parent || (children && children.size > 0))) {
|
|
56
|
-
return null
|
|
57
|
-
}
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
<Typography variant="h4">Related features</Typography>
|
|
61
|
-
{parent && (
|
|
62
|
-
<>
|
|
63
|
-
<Typography variant="h5">Parent</Typography>
|
|
64
|
-
<Paper elevation={6} className={classes.paper}>
|
|
65
|
-
{`Start: ${parent.start}, End: ${parent.end}, Type: ${parent.type}`}
|
|
66
|
-
<Button
|
|
67
|
-
variant="contained"
|
|
68
|
-
onClick={() => {
|
|
69
|
-
onButtonClick(parent)
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
Go to parent
|
|
73
|
-
</Button>
|
|
74
|
-
</Paper>
|
|
75
|
-
</>
|
|
76
|
-
)}
|
|
77
|
-
{children && children.size > 0 && (
|
|
78
|
-
<>
|
|
79
|
-
<Typography variant="h5">Children</Typography>
|
|
80
|
-
{[...children.values()].map((child) => (
|
|
81
|
-
<Paper elevation={6} className={classes.paper} key={child._id}>
|
|
82
|
-
{`Start: ${child.start}, End: ${child.end}, Type: ${child.type}`}
|
|
83
|
-
<Button
|
|
84
|
-
variant="contained"
|
|
85
|
-
onClick={() => {
|
|
86
|
-
onButtonClick(child)
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
89
|
-
Go to child
|
|
90
|
-
</Button>
|
|
91
|
-
</Paper>
|
|
92
|
-
))}
|
|
93
|
-
</>
|
|
94
|
-
)}
|
|
95
|
-
</>
|
|
96
|
-
)
|
|
97
|
-
})
|