@apollo-annotation/mst 0.3.13 → 1.0.0

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/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@apollo-annotation/mst",
3
- "version": "0.3.13",
3
+ "version": "1.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/GMOD/Apollo3.git",
7
+ "directory": "packages/apollo-mst"
8
+ },
4
9
  "sideEffects": false,
5
10
  "type": "module",
6
11
  "exports": "./dist/index.js",
@@ -4,18 +4,19 @@
4
4
  import { getSession, intersection2 } from '@jbrowse/core/util'
5
5
  import {
6
6
  type IAnyModelType,
7
+ type IAnyStateTreeNode,
7
8
  type IMSTMap,
8
9
  type Instance,
9
10
  type SnapshotIn,
10
11
  type SnapshotOrInstance,
11
12
  cast,
13
+ getParent,
12
14
  getParentOfType,
13
15
  getSnapshot,
16
+ hasParent,
14
17
  types,
15
18
  } from '@jbrowse/mobx-state-tree'
16
19
 
17
- import { ApolloAssembly } from './index.js'
18
-
19
20
  const LateAnnotationFeature = types.late(
20
21
  (): IAnyModelType => AnnotationFeatureModel,
21
22
  )
@@ -291,40 +292,6 @@ export const AnnotationFeatureModel = types
291
292
  transcript.filter((transcriptPart) => transcriptPart.type === 'CDS'),
292
293
  )
293
294
  },
294
- get looksLikeGene(): boolean {
295
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
- const session = getSession(self) as any
297
- const { apolloDataStore } = session
298
- const { featureTypeOntology } = apolloDataStore.ontologyManager
299
- if (!featureTypeOntology) {
300
- return false
301
- }
302
- const children = self.children as Children
303
- if (!children?.size) {
304
- return false
305
- }
306
- const isGene =
307
- featureTypeOntology.isTypeOf(self.type, 'gene') ||
308
- featureTypeOntology.isTypeOf(self.type, 'pseudogene')
309
- if (!isGene) {
310
- return false
311
- }
312
- for (const [, child] of children) {
313
- if (
314
- featureTypeOntology.isTypeOf(child.type, 'transcript') ||
315
- featureTypeOntology.isTypeOf(child.type, 'pseudogenic_transcript')
316
- ) {
317
- const { children: grandChildren } = child
318
- if (!grandChildren?.size) {
319
- return false
320
- }
321
- return [...grandChildren.values()].some((grandchild) =>
322
- featureTypeOntology.isTypeOf(grandchild.type, 'exon'),
323
- )
324
- }
325
- }
326
- return false
327
- },
328
295
  }))
329
296
  .actions((self) => ({
330
297
  setAttributes(attributes: Map<string, string[]>) {
@@ -431,7 +398,18 @@ export const AnnotationFeatureModel = types
431
398
  return feature as AnnotationFeature
432
399
  },
433
400
  get assemblyId(): string {
434
- return getParentOfType(self, ApolloAssembly)._id
401
+ // Not using getParentOfType because importing ApolloAssembly would create
402
+ // a circular module dependency
403
+ let node: IAnyStateTreeNode = self
404
+ while (hasParent(node)) {
405
+ node = getParent(node)
406
+ if ('refSeqs' in node && '_id' in node) {
407
+ return node._id as string
408
+ }
409
+ }
410
+ throw new Error(
411
+ 'AnnotationFeatureModel: could not find parent ApolloAssembly',
412
+ )
435
413
  },
436
414
  }))
437
415
 
@@ -2,10 +2,7 @@ import { type Instance, type SnapshotIn, types } from '@jbrowse/mobx-state-tree'
2
2
 
3
3
  import { ApolloRefSeq } from './ApolloRefSeq.js'
4
4
 
5
- export type BackendDriverType =
6
- | 'CollaborationServerDriver'
7
- | 'InMemoryFileDriver'
8
- | 'DesktopFileDriver'
5
+ export type BackendDriverType = 'CollaborationServerDriver' | 'LocalDriver'
9
6
 
10
7
  export const ApolloAssembly = types
11
8
  .model('ApolloAssembly', {
@@ -15,8 +12,7 @@ export const ApolloAssembly = types
15
12
  backendDriverType: types.optional(
16
13
  types.enumeration('backendDriverType', [
17
14
  'CollaborationServerDriver',
18
- 'InMemoryFileDriver',
19
- 'DesktopFileDriver',
15
+ 'LocalDriver',
20
16
  ]),
21
17
  'CollaborationServerDriver',
22
18
  ),