@apollo-annotation/shared 1.0.1 → 1.1.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,6 @@
1
1
  {
2
2
  "name": "@apollo-annotation/shared",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/GMOD/Apollo3.git",
@@ -17,19 +17,19 @@
17
17
  "test:ci": "NODE_V8_COVERAGE=./coverage glob -c \"tsx --test --test-reporter spec --experimental-test-coverage \" \"**/*.test.ts\""
18
18
  },
19
19
  "dependencies": {
20
- "@apollo-annotation/common": "^1.0.1",
21
- "@apollo-annotation/mst": "^1.0.1",
22
- "@apollo-annotation/schemas": "^1.0.1",
20
+ "@apollo-annotation/common": "^1.1.0",
21
+ "@apollo-annotation/mst": "^1.1.0",
22
+ "@apollo-annotation/schemas": "^1.1.0",
23
23
  "@gmod/gff": "^2.1.0",
24
24
  "@gmod/indexedfasta": "^5.0.2",
25
- "@jbrowse/core": "^4.1.1",
25
+ "@jbrowse/core": "^4.3.0",
26
26
  "bson-objectid": "^2.0.4",
27
27
  "generic-filehandle2": "^2.0.18",
28
28
  "jwt-decode": "^3.1.2",
29
29
  "tslib": "^2.3.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@jbrowse/mobx-state-tree": "^5.5.0",
32
+ "@jbrowse/mobx-state-tree": "^5.8.7",
33
33
  "@nestjs/common": "^10.1.0",
34
34
  "@nestjs/core": "^10.1.0",
35
35
  "@types/chai": "^4.3.19",
@@ -46,8 +46,8 @@
46
46
  "typescript": "^5.5.3"
47
47
  },
48
48
  "peerDependencies": {
49
- "@jbrowse/mobx-state-tree": "^5.5.0",
50
- "@mui/material": "^7.3.7",
49
+ "@jbrowse/mobx-state-tree": "^5.8.7",
50
+ "@mui/material": "^7.3.11",
51
51
  "@mui/x-data-grid": "^8.0.0",
52
52
  "mobx": "^6.6.1",
53
53
  "mobx-react": "^7.2.1",
@@ -129,9 +129,7 @@ export class MergeTranscriptsChange extends FeatureChange {
129
129
  secondFeatureChild: AnnotationFeatureSnapshot,
130
130
  firstTranscript: Feature,
131
131
  ) {
132
- if (!firstTranscript.children) {
133
- firstTranscript.children = new Map<string, Feature>()
134
- }
132
+ firstTranscript.children ??= new Map<string, Feature>()
135
133
  let merged = false
136
134
  let mrgChild: Feature | undefined
137
135
  let toDelete
@@ -169,9 +167,7 @@ export class MergeTranscriptsChange extends FeatureChange {
169
167
  firstFeatureChild.max,
170
168
  )
171
169
 
172
- if (!mrgChild.attributes) {
173
- mrgChild.attributes = {}
174
- }
170
+ mrgChild.attributes ??= {}
175
171
 
176
172
  const mrgChildAttr: Record<string, string[]> = JSON.parse(
177
173
  JSON.stringify(mrgChild.attributes),
@@ -256,9 +252,7 @@ export class MergeTranscriptsChange extends FeatureChange {
256
252
  secondFeatureChild: AnnotationFeatureSnapshot,
257
253
  firstTranscript: AnnotationFeature,
258
254
  ) {
259
- if (!firstTranscript.children) {
260
- firstTranscript.children = new Map<string, AnnotationFeature>()
261
- }
255
+ firstTranscript.children ??= new Map<string, AnnotationFeature>()
262
256
  let merged = false
263
257
  let mrgChild: AnnotationFeature | undefined
264
258
  let toDelete
@@ -104,8 +104,8 @@ function getOriginalCodonLocation(
104
104
  ? cdsLocation.toSorted((a, b) => (a.min < b.min ? 1 : -1))
105
105
  : cdsLocation.toSorted((a, b) => (a.min < b.min ? -1 : 1))
106
106
  let i = 0
107
- let currentStart: number | undefined = undefined
108
- let currentEnd: number | undefined = undefined
107
+ let currentStart: number | undefined
108
+ let currentEnd: number | undefined
109
109
  for (let iloc = 0; iloc < sortedLocation.length; iloc++) {
110
110
  const loc = sortedLocation[iloc]
111
111
  const { phase } = loc
@@ -172,7 +172,7 @@ async function checkMRNA(
172
172
  name: CHECK_NAME,
173
173
  cause: CAUSES[CAUSES.MissingStartCodon],
174
174
  ids,
175
- refSeq: refSeq.toString(),
175
+ refSeq,
176
176
  start: cdsStart,
177
177
  end: cdsStart,
178
178
  message: `Unexpected start codon "${start_codon}" in feature "${getPrintableId(feature)}": `,
@@ -186,7 +186,7 @@ async function checkMRNA(
186
186
  name: CHECK_NAME,
187
187
  cause: CAUSES[CAUSES.MissingStopCodon],
188
188
  ids,
189
- refSeq: refSeq.toString(),
189
+ refSeq,
190
190
  start: cdsEnd,
191
191
  end: cdsEnd,
192
192
  message: `Missing stop codon in feature "${getPrintableId(feature)}"`,
@@ -198,7 +198,7 @@ async function checkMRNA(
198
198
  name: CHECK_NAME,
199
199
  cause: CAUSES[CAUSES.MissingStopCodon],
200
200
  ids,
201
- refSeq: refSeq.toString(),
201
+ refSeq,
202
202
  start: cdsEnd,
203
203
  end: cdsEnd,
204
204
  message: `Missing stop codon in feature "${getPrintableId(feature)}"`,
@@ -217,7 +217,7 @@ async function checkMRNA(
217
217
  name: CHECK_NAME,
218
218
  cause: CAUSES[CAUSES.InternalStopCodon],
219
219
  ids,
220
- refSeq: refSeq.toString(),
220
+ refSeq,
221
221
  start: codonStart,
222
222
  end: codonEnd,
223
223
  message: `Internal stop codon in feature "${getPrintableId(feature)}"`,
@@ -78,7 +78,7 @@ async function checkTranscript(
78
78
  name: CHECK_NAME,
79
79
  cause: CAUSES[CAUSES.NonCanonicalSpliceSiteAtFivePrime],
80
80
  ids: [feature._id],
81
- refSeq: feature.refSeq.toString(),
81
+ refSeq: feature.refSeq,
82
82
  start: spliceSequence.fivePrimeMin,
83
83
  end: spliceSequence.fivePrimeMin + 2,
84
84
  message: `Unexpected 5′ splice site in "${getPrintableId(feature)}". Expected: ${[...VALID_FIVE_PRIME_SEQ].join('|')}, got: ${spliceSequence.fivePrimeSeq}`,
@@ -92,7 +92,7 @@ async function checkTranscript(
92
92
  name: CHECK_NAME,
93
93
  cause: CAUSES[CAUSES.NonCanonicalSpliceSiteAtThreePrime],
94
94
  ids: [feature._id],
95
- refSeq: feature.refSeq.toString(),
95
+ refSeq: feature.refSeq,
96
96
  start: spliceSequence.threePrimeMin,
97
97
  end: spliceSequence.threePrimeMin + 2,
98
98
  message: `Unexpected 3′ splice site in "${getPrintableId(feature)}". Expected: ${[...VALID_THREE_PRIME_SEQ].join('|')}, got: ${spliceSequence.threePrimeSeq}`,
@@ -3,11 +3,11 @@ import type { AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
3
3
  export function getPrintableId(feature: AnnotationFeatureSnapshot): string {
4
4
  const gff_id = feature.attributes?.gff_id?.join(', ')
5
5
  if (gff_id) {
6
- return `${gff_id} (_id: ${feature._id.toString()})`
6
+ return `${gff_id} (_id: ${feature._id})`
7
7
  }
8
8
  const gff_name = feature.attributes?.gff_name?.join(', ')
9
9
  if (gff_name) {
10
- return `${gff_name} (_id: ${feature._id.toString()})`
10
+ return `${gff_name} (_id: ${feature._id})`
11
11
  }
12
- return `_id: ${feature._id.toString()}`
12
+ return `_id: ${feature._id}`
13
13
  }
@@ -160,7 +160,7 @@ describe('annotationFeatureToGFF3', () => {
160
160
  const [mrna] = children
161
161
  const cds10001 = mrna.child_features.filter((child) => {
162
162
  const id = child[0].attributes?.ID
163
- return id !== undefined && id[0] === 'cds10001'
163
+ return id?.[0] === 'cds10001'
164
164
  })
165
165
  assert.deepEqual(cds10001.length, 2)
166
166
 
@@ -185,7 +185,7 @@ describe('annotationFeatureToGFF3', () => {
185
185
 
186
186
  const cds10004 = mrna.child_features.filter((child) => {
187
187
  const id = child[0].attributes?.ID
188
- return id !== undefined && id[0] === 'cds10004'
188
+ return id?.[0] === 'cds10004'
189
189
  })
190
190
  assert.deepEqual(cds10004.length, 2)
191
191
  const cds4_1 = cds10004[0][0]
@@ -96,8 +96,8 @@ export function annotationFeatureToGFF3(
96
96
  }
97
97
 
98
98
  return {
99
- start: Number(featureLoc.min) + 1,
100
- end: Number(featureLoc.max),
99
+ start: featureLoc.min + 1,
100
+ end: featureLoc.max,
101
101
  seq_id: refSeqNames
102
102
  ? refSeqNames[featureLoc.refSeq] ?? null
103
103
  : featureLoc.refSeq,
@@ -261,7 +261,7 @@ function getTranscriptParts(
261
261
  function getCdsLocations(
262
262
  feature: AnnotationFeatureSnapshot,
263
263
  ): TranscriptPartCoding[][] {
264
- let transcriptParts: TranscriptParts[] = []
264
+ let transcriptParts: TranscriptParts[]
265
265
  try {
266
266
  transcriptParts = getTranscriptParts(feature)
267
267
  } catch {
@@ -90,8 +90,8 @@
90
90
  "id": "abc",
91
91
  "refSeq": "chr1",
92
92
  "type": "CDS_region",
93
- "min": "1350",
94
- "max": "1400",
93
+ "min": 1350,
94
+ "max": 1400,
95
95
  "strand": 1,
96
96
  "attributes": {
97
97
  "gff_id": ["cds_region10001"]