@apollo-annotation/mst 0.3.1 → 0.3.3
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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo-annotation/mst",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jbrowse/core": "^
|
|
9
|
+
"@jbrowse/core": "^3.0.1",
|
|
10
10
|
"mobx": "^6.6.1",
|
|
11
11
|
"mobx-state-tree": "^5.4.0",
|
|
12
12
|
"react-dom": "^18.2.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { intersection2 } from '@jbrowse/core/util'
|
|
1
|
+
import { getSession, intersection2 } from '@jbrowse/core/util'
|
|
2
2
|
import {
|
|
3
3
|
IAnyModelType,
|
|
4
4
|
IMSTMap,
|
|
@@ -127,20 +127,28 @@ export const AnnotationFeatureModel = types
|
|
|
127
127
|
return false
|
|
128
128
|
},
|
|
129
129
|
get transcriptParts(): TranscriptParts[] {
|
|
130
|
-
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
131
|
+
const session = getSession(self) as any
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
133
|
+
const { apolloDataStore } = session
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
135
|
+
const { featureTypeOntology } = apolloDataStore.ontologyManager
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
137
|
+
if (!featureTypeOntology.isTypeOf(self.type, 'transcript')) {
|
|
131
138
|
throw new Error(
|
|
132
|
-
'Only features of type "
|
|
139
|
+
'Only features of type "transcript" or equivalent can calculate CDS locations',
|
|
133
140
|
)
|
|
134
141
|
}
|
|
135
142
|
const children = self.children as Children
|
|
136
143
|
if (!children) {
|
|
137
|
-
throw new Error('no CDS or exons in
|
|
144
|
+
throw new Error('no CDS or exons in transcript')
|
|
138
145
|
}
|
|
139
146
|
const cdsChildren = [...children.values()].filter(
|
|
140
|
-
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
148
|
+
(child) => featureTypeOntology.isTypeOf(child.type, 'CDS'),
|
|
141
149
|
)
|
|
142
150
|
if (cdsChildren.length === 0) {
|
|
143
|
-
throw new Error('no CDS in
|
|
151
|
+
throw new Error('no CDS in transcript')
|
|
144
152
|
}
|
|
145
153
|
const transcriptParts: TranscriptParts[] = []
|
|
146
154
|
for (const cds of cdsChildren) {
|
|
@@ -149,7 +157,8 @@ export const AnnotationFeatureModel = types
|
|
|
149
157
|
let hasIntersected = false
|
|
150
158
|
const exonLocations: TranscriptPartLocation[] = []
|
|
151
159
|
for (const [, child] of children) {
|
|
152
|
-
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
161
|
+
if (featureTypeOntology.isTypeOf(child.type, 'exon')) {
|
|
153
162
|
exonLocations.push({ min: child.min, max: child.max })
|
|
154
163
|
}
|
|
155
164
|
}
|