@apollo-annotation/jbrowse-plugin-apollo 0.2.0 → 0.2.2
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 +46 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/jbrowse-plugin-apollo.cjs.development.js +45 -9
- 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 +348 -108
- 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 +6 -6
- package/src/BackendDrivers/DesktopFileDriver.ts +2 -2
- package/src/BackendDrivers/InMemoryFileDriver.ts +10 -0
- package/src/OntologyManager/OntologyStore/prefixes.ts +11 -5
- package/src/components/DownloadGFF3.tsx +2 -2
- package/src/session/ClientDataStore.ts +3 -0
- package/src/session/session.ts +33 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo-annotation/jbrowse-plugin-apollo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Apollo plugin for JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@apollo-annotation/common": "^0.2.
|
|
52
|
-
"@apollo-annotation/mst": "^0.2.
|
|
53
|
-
"@apollo-annotation/shared": "^0.2.
|
|
51
|
+
"@apollo-annotation/common": "^0.2.2",
|
|
52
|
+
"@apollo-annotation/mst": "^0.2.2",
|
|
53
|
+
"@apollo-annotation/shared": "^0.2.2",
|
|
54
54
|
"@emotion/react": "^11.10.6",
|
|
55
55
|
"@emotion/styled": "^11.10.6",
|
|
56
56
|
"@gmod/gff": "1.2.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"librpc-web-mod": "^1.1.9",
|
|
92
92
|
"mobx": "^6.6.1",
|
|
93
93
|
"mobx-react": "^7.2.1",
|
|
94
|
-
"mobx-state-tree": "^5.
|
|
94
|
+
"mobx-state-tree": "^5.4.0",
|
|
95
95
|
"npm-run-all": "^4.1.5",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
97
97
|
"react": "^18.2.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@mui/material": "^5.11.14",
|
|
113
113
|
"mobx": "^6.6.1",
|
|
114
114
|
"mobx-react": "^7.2.1",
|
|
115
|
-
"mobx-state-tree": "^5.
|
|
115
|
+
"mobx-state-tree": "^5.4.0",
|
|
116
116
|
"prop-types": "^15.8.1",
|
|
117
117
|
"react": "^18.2.0",
|
|
118
118
|
"react-dom": "^18.2.0",
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
CheckResultSnapshot,
|
|
10
10
|
} from '@apollo-annotation/mst'
|
|
11
11
|
import {
|
|
12
|
+
annotationFeatureToGFF3,
|
|
12
13
|
ValidationResultSet,
|
|
13
|
-
makeGFF3Feature,
|
|
14
14
|
splitStringIntoChunks,
|
|
15
15
|
} from '@apollo-annotation/shared'
|
|
16
16
|
import gff, { GFF3Item } from '@gmod/gff'
|
|
@@ -148,7 +148,7 @@ export class DesktopFileDriver extends BackendDriver {
|
|
|
148
148
|
for (const [, refSeq] of clientAssembly.refSeqs) {
|
|
149
149
|
const { features } = refSeq
|
|
150
150
|
for (const [, feature] of features) {
|
|
151
|
-
gff3Items.push(
|
|
151
|
+
gff3Items.push(annotationFeatureToGFF3(getSnapshot(feature)))
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
for (const [, refSeq] of clientAssembly.refSeqs) {
|
|
@@ -10,6 +10,7 @@ import { Region, getSession } from '@jbrowse/core/util'
|
|
|
10
10
|
|
|
11
11
|
import { SubmitOpts } from '../ChangeManager'
|
|
12
12
|
import { BackendDriver, RefNameAliases } from './BackendDriver'
|
|
13
|
+
import { checkFeatures } from '../util'
|
|
13
14
|
|
|
14
15
|
export class InMemoryFileDriver extends BackendDriver {
|
|
15
16
|
async getFeatures(): Promise<
|
|
@@ -84,6 +85,15 @@ export class InMemoryFileDriver extends BackendDriver {
|
|
|
84
85
|
_change: Change | AssemblySpecificChange,
|
|
85
86
|
_opts: SubmitOpts = {},
|
|
86
87
|
) {
|
|
88
|
+
const { clientStore } = this
|
|
89
|
+
const { assemblies } = clientStore
|
|
90
|
+
clientStore.clearCheckResults()
|
|
91
|
+
for (const [, assembly] of assemblies) {
|
|
92
|
+
if (assembly.backendDriverType === 'InMemoryFileDriver') {
|
|
93
|
+
const checkResults = await checkFeatures(assembly)
|
|
94
|
+
clientStore.addCheckResults(checkResults)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
87
97
|
return new ValidationResultSet()
|
|
88
98
|
}
|
|
89
99
|
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
/**
|
|
14
14
|
* compact the given URI using the given prefixes
|
|
15
15
|
*/
|
|
16
|
-
export function applyPrefixes(
|
|
16
|
+
export function applyPrefixes(
|
|
17
|
+
uri: string,
|
|
18
|
+
prefixes: Map<string | number, string>,
|
|
19
|
+
) {
|
|
17
20
|
for (const [prefix, uriBase] of prefixes.entries()) {
|
|
18
21
|
if (uri.startsWith(uriBase)) {
|
|
19
|
-
return uri.replace(uriBase, prefix)
|
|
22
|
+
return uri.replace(uriBase, String(prefix))
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
return uri
|
|
@@ -25,10 +28,13 @@ export function applyPrefixes(uri: string, prefixes: Map<string, string>) {
|
|
|
25
28
|
/**
|
|
26
29
|
* expand the given compacted URI using given prefixes
|
|
27
30
|
*/
|
|
28
|
-
export function expandPrefixes(
|
|
31
|
+
export function expandPrefixes(
|
|
32
|
+
uri: string,
|
|
33
|
+
prefixes: Map<string | number, string>,
|
|
34
|
+
) {
|
|
29
35
|
for (const [prefix, uriBase] of prefixes.entries()) {
|
|
30
|
-
if (uri.startsWith(prefix)) {
|
|
31
|
-
return uri.replace(prefix, uriBase)
|
|
36
|
+
if (uri.startsWith(String(prefix))) {
|
|
37
|
+
return uri.replace(String(prefix), uriBase)
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
return uri
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
6
6
|
import { ApolloAssembly } from '@apollo-annotation/mst'
|
|
7
|
-
import { makeGFF3Feature } from '@apollo-annotation/shared'
|
|
8
7
|
import gff, { GFF3Item } from '@gmod/gff'
|
|
9
8
|
import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
|
|
10
9
|
import { getConf } from '@jbrowse/core/configuration'
|
|
@@ -29,6 +28,7 @@ import {
|
|
|
29
28
|
import { ApolloSessionModel } from '../session'
|
|
30
29
|
import { createFetchErrorMessage } from '../util'
|
|
31
30
|
import { Dialog } from './Dialog'
|
|
31
|
+
import { annotationFeatureToGFF3 } from '@apollo-annotation/shared'
|
|
32
32
|
|
|
33
33
|
interface DownloadGFF3Props {
|
|
34
34
|
session: ApolloSessionModel
|
|
@@ -153,7 +153,7 @@ export function DownloadGFF3({ handleClose, session }: DownloadGFF3Props) {
|
|
|
153
153
|
continue
|
|
154
154
|
}
|
|
155
155
|
for (const [, feature] of features) {
|
|
156
|
-
gff3Items.push(
|
|
156
|
+
gff3Items.push(annotationFeatureToGFF3(getSnapshot(feature)))
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
for (const sequenceFeature of sequenceFeatures) {
|
|
@@ -125,6 +125,9 @@ export function clientDataStoreFactory(
|
|
|
125
125
|
deleteCheckResult(checkResultId: string) {
|
|
126
126
|
self.checkResults.delete(checkResultId)
|
|
127
127
|
},
|
|
128
|
+
clearCheckResults() {
|
|
129
|
+
self.checkResults.clear()
|
|
130
|
+
},
|
|
128
131
|
}))
|
|
129
132
|
.volatile((self) => ({
|
|
130
133
|
changeManager: new ChangeManager(self as unknown as ClientDataStoreType),
|
package/src/session/session.ts
CHANGED
|
@@ -154,7 +154,14 @@ export function extendSession(
|
|
|
154
154
|
dynamicBlocks.forEach((block) => {
|
|
155
155
|
if (block.regionNumber !== undefined) {
|
|
156
156
|
const { assemblyName, end, refName, start } = block
|
|
157
|
-
|
|
157
|
+
const assembly =
|
|
158
|
+
self.apolloDataStore.assemblies.get(assemblyName)
|
|
159
|
+
if (
|
|
160
|
+
assembly &&
|
|
161
|
+
assembly.backendDriverType === 'CollaborationServerDriver'
|
|
162
|
+
) {
|
|
163
|
+
locations.push({ assemblyName, refName, start, end })
|
|
164
|
+
}
|
|
158
165
|
}
|
|
159
166
|
})
|
|
160
167
|
}
|
|
@@ -217,7 +224,14 @@ export function extendSession(
|
|
|
217
224
|
dynamicBlocks.forEach((block) => {
|
|
218
225
|
if (block.regionNumber !== undefined) {
|
|
219
226
|
const { assemblyName, end, refName, start } = block
|
|
220
|
-
|
|
227
|
+
const assembly =
|
|
228
|
+
self.apolloDataStore.assemblies.get(assemblyName)
|
|
229
|
+
if (
|
|
230
|
+
assembly &&
|
|
231
|
+
assembly.backendDriverType === 'CollaborationServerDriver'
|
|
232
|
+
) {
|
|
233
|
+
locations.push({ assemblyName, refName, start, end })
|
|
234
|
+
}
|
|
221
235
|
}
|
|
222
236
|
})
|
|
223
237
|
}
|
|
@@ -286,6 +300,7 @@ export function extendSession(
|
|
|
286
300
|
continue
|
|
287
301
|
}
|
|
288
302
|
applySnapshot(jbrowse, jbrowseConfig)
|
|
303
|
+
// @ts-expect-error snapshot seems to get wrong type?
|
|
289
304
|
applySnapshot(self, sessionSnapshot)
|
|
290
305
|
}
|
|
291
306
|
}),
|
|
@@ -412,7 +427,7 @@ export function extendSession(
|
|
|
412
427
|
}
|
|
413
428
|
})
|
|
414
429
|
return types.snapshotProcessor(sm, {
|
|
415
|
-
postProcessor(snap: SnapshotOut<typeof sm
|
|
430
|
+
postProcessor(snap: SnapshotOut<typeof sm>, node) {
|
|
416
431
|
snap.apolloSelectedFeature = undefined
|
|
417
432
|
const assemblies = Object.fromEntries(
|
|
418
433
|
Object.entries(snap.apolloDataStore.assemblies).filter(
|
|
@@ -425,6 +440,21 @@ export function extendSession(
|
|
|
425
440
|
assemblies,
|
|
426
441
|
checkResults: {},
|
|
427
442
|
}
|
|
443
|
+
if (!node) {
|
|
444
|
+
return snap
|
|
445
|
+
}
|
|
446
|
+
const { apolloDataStore } = node
|
|
447
|
+
const { checkResults } = apolloDataStore
|
|
448
|
+
for (const [, cr] of checkResults) {
|
|
449
|
+
const [feature] = cr.ids
|
|
450
|
+
if (!feature) {
|
|
451
|
+
continue
|
|
452
|
+
}
|
|
453
|
+
const assembly = apolloDataStore.assemblies.get(feature.assemblyId)
|
|
454
|
+
if (assembly && assembly.backendDriverType === 'InMemoryFileDriver') {
|
|
455
|
+
snap.apolloDataStore.checkResults[cr._id] = getSnapshot(cr)
|
|
456
|
+
}
|
|
457
|
+
}
|
|
428
458
|
return snap
|
|
429
459
|
},
|
|
430
460
|
})
|