Skip to content

Commit 9ec8500

Browse files
Add outline for LocalDriver
1 parent cd532b6 commit 9ec8500

File tree

5 files changed

+129
-2
lines changed

5 files changed

+129
-2
lines changed

packages/apollo-mst/src/ApolloAssembly.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ import { type Instance, type SnapshotIn, types } from '@jbrowse/mobx-state-tree'
22

33
import { ApolloRefSeq } from './ApolloRefSeq.js'
44

5-
export type BackendDriverType = 'CollaborationServerDriver'
5+
export type BackendDriverType = 'CollaborationServerDriver' | 'LocalDriver'
66

77
export const ApolloAssembly = types
88
.model('ApolloAssembly', {
99
_id: types.identifier,
1010
refSeqs: types.map(ApolloRefSeq),
1111
comments: types.array(types.string),
1212
backendDriverType: types.optional(
13-
types.enumeration('backendDriverType', ['CollaborationServerDriver']),
13+
types.enumeration('backendDriverType', [
14+
'CollaborationServerDriver',
15+
'LocalDriver',
16+
]),
1417
'CollaborationServerDriver',
1518
),
1619
})
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"assemblies": [
3+
{
4+
"name": "volvox",
5+
"sequence": {
6+
"type": "ReferenceSequenceTrack",
7+
"trackId": "volvox_refseq",
8+
"adapter": {
9+
"type": "TwoBitAdapter",
10+
"twoBitLocation": {
11+
"uri": "test_data/volvox.2bit",
12+
"locationType": "UriLocation"
13+
}
14+
}
15+
}
16+
}
17+
],
18+
"defaultSession": {
19+
"name": "Apollo",
20+
"views": [{ "type": "LinearGenomeView" }]
21+
},
22+
"tracks": [
23+
{
24+
"type": "ApolloTrack",
25+
"trackId": "apollo_track_volvox",
26+
"name": "Apollo Annotations",
27+
"assemblyNames": ["volvox"]
28+
},
29+
{
30+
"type": "FeatureTrack",
31+
"trackId": "gff3tabix_genes",
32+
"assemblyNames": ["volvox"],
33+
"name": "GFF3Tabix genes",
34+
"adapter": {
35+
"type": "Gff3TabixAdapter",
36+
"gffGzLocation": {
37+
"uri": "test_data/volvox.sort.gff3.gz",
38+
"locationType": "UriLocation"
39+
},
40+
"index": {
41+
"location": {
42+
"uri": "test_data/volvox.sort.gff3.gz.tbi",
43+
"locationType": "UriLocation"
44+
}
45+
}
46+
}
47+
}
48+
],
49+
"plugins": [
50+
{
51+
"name": "Apollo",
52+
"url": "http://localhost:9000/dist/jbrowse-plugin-apollo.umd.development.js"
53+
}
54+
],
55+
"configuration": {
56+
"ApolloPlugin": {
57+
"ontologies": [
58+
{
59+
"name": "Sequence Ontology",
60+
"source": {
61+
"uri": "http://localhost:9000/test_data/so-v3.1.json",
62+
"locationType": "UriLocation"
63+
}
64+
}
65+
]
66+
}
67+
}
68+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
/* eslint-disable @typescript-eslint/require-await */
3+
import type { Change } from '@apollo-annotation/common'
4+
import type {
5+
AnnotationFeatureSnapshot,
6+
CheckResultSnapshot,
7+
} from '@apollo-annotation/mst'
8+
import { ValidationResultSet } from '@apollo-annotation/shared'
9+
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly'
10+
import type { Region } from '@jbrowse/core/util'
11+
12+
import type { SubmitOpts } from '../ChangeManager'
13+
14+
import { BackendDriver, type RefNameAliases } from './BackendDriver'
15+
16+
export class LocalDriver extends BackendDriver {
17+
async getFeatures(
18+
region: Region,
19+
): Promise<[AnnotationFeatureSnapshot[], CheckResultSnapshot[]]> {
20+
return [[], []]
21+
}
22+
23+
async getSequence(region: Region): Promise<{ seq: string; refSeq: string }> {
24+
return { seq: '', refSeq: '' }
25+
}
26+
27+
async getRegions(assemblyName: string): Promise<Region[]> {
28+
return []
29+
}
30+
31+
getAssemblies(internetAccountConfigId?: string): Assembly[] {
32+
return []
33+
}
34+
35+
async getRefNameAliases(assemblyName: string): Promise<RefNameAliases[]> {
36+
return []
37+
}
38+
39+
async submitChange(
40+
change: Change,
41+
opts: SubmitOpts,
42+
): Promise<ValidationResultSet> {
43+
return new ValidationResultSet()
44+
}
45+
46+
async searchFeatures(
47+
term: string,
48+
assemblies: string[],
49+
): Promise<AnnotationFeatureSnapshot[]> {
50+
return []
51+
}
52+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './BackendDriver'
2+
export * from './LocalDriver'
23
export * from './CollaborationServerDriver'

packages/jbrowse-plugin-apollo/src/session/ClientDataStore.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
type ApolloInternetAccount,
3838
type BackendDriver,
3939
CollaborationServerDriver,
40+
LocalDriver,
4041
} from '../BackendDrivers'
4142
import { ChangeManager } from '../ChangeManager'
4243
import {
@@ -159,6 +160,7 @@ export function clientDataStoreFactory(
159160
collaborationServerDriver: new CollaborationServerDriver(
160161
self as ClientDataStoreModel,
161162
),
163+
localDriver: new LocalDriver(self as ClientDataStoreModel),
162164
}))
163165
.actions((self) => ({
164166
afterCreate() {
@@ -243,6 +245,7 @@ export function clientDataStoreFactory(
243245
if (internetAccountConfigId) {
244246
return self.collaborationServerDriver
245247
}
248+
return self.localDriver
246249
},
247250
getInternetAccount(assemblyName?: string, internetAccountId?: string) {
248251
if (!(assemblyName ?? internetAccountId)) {

0 commit comments

Comments
 (0)