@apollo-annotation/shared 0.3.4 → 0.3.6

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.
Files changed (86) hide show
  1. package/dist/Changes/AddAssemblyAndFeaturesFromFileChange.d.ts +1 -1
  2. package/dist/Changes/AddAssemblyFromExternalChange.d.ts +1 -1
  3. package/dist/Changes/AddAssemblyFromFileChange.d.ts +1 -1
  4. package/dist/Changes/AddAssemblyFromFileChange.js +3 -3
  5. package/dist/Changes/AddAssemblyFromFileChange.js.map +1 -1
  6. package/dist/Changes/AddFeatureChange.d.ts +2 -2
  7. package/dist/Changes/AddFeatureChange.js +1 -0
  8. package/dist/Changes/AddFeatureChange.js.map +1 -1
  9. package/dist/Changes/AddFeaturesFromFileChange.d.ts +1 -1
  10. package/dist/Changes/AddRefSeqAliasesChange.d.ts +1 -1
  11. package/dist/Changes/DeleteAssemblyChange.d.ts +1 -1
  12. package/dist/Changes/DeleteFeatureChange.d.ts +3 -3
  13. package/dist/Changes/DeleteUserChange.d.ts +1 -1
  14. package/dist/Changes/FeatureAttributeChange.d.ts +1 -1
  15. package/dist/Changes/FromFileBaseChange.d.ts +3 -3
  16. package/dist/Changes/FromFileBaseChange.js.map +1 -1
  17. package/dist/Changes/ImportJBrowseConfigChange.d.ts +1 -1
  18. package/dist/Changes/LocationEndChange.d.ts +1 -1
  19. package/dist/Changes/LocationStartChange.d.ts +1 -1
  20. package/dist/Changes/StrandChange.d.ts +1 -1
  21. package/dist/Changes/TypeChange.d.ts +1 -1
  22. package/dist/Changes/UserChange.d.ts +1 -1
  23. package/dist/Checks/CDSCheck.d.ts +2 -1
  24. package/dist/Checks/CDSCheck.js +98 -30
  25. package/dist/Checks/CDSCheck.js.map +1 -1
  26. package/dist/GFF3/annotationFeatureToGFF3.d.ts +2 -2
  27. package/dist/GFF3/annotationFeatureToGFF3.js +2 -0
  28. package/dist/GFF3/annotationFeatureToGFF3.js.map +1 -1
  29. package/dist/GFF3/annotationFeatureToGFF3.test.js +1 -1
  30. package/dist/GFF3/annotationFeatureToGFF3.test.js.map +1 -1
  31. package/dist/GFF3/gff3ToAnnotationFeature.d.ts +2 -2
  32. package/dist/GFF3/gff3ToAnnotationFeature.js +9 -2
  33. package/dist/GFF3/gff3ToAnnotationFeature.js.map +1 -1
  34. package/dist/GFF3/gff3ToAnnotationFeature.test.d.ts +1 -1
  35. package/dist/GFF3/gff3ToAnnotationFeature.test.js +1 -1
  36. package/dist/GFF3/gff3ToAnnotationFeature.test.js.map +1 -1
  37. package/dist/GFF3/gffReservedKeys.d.ts +7 -0
  38. package/dist/GFF3/gffReservedKeys.js +21 -1
  39. package/dist/GFF3/gffReservedKeys.js.map +1 -1
  40. package/dist/Messages.d.ts +2 -2
  41. package/dist/Operations/GetAssembliesOperation.d.ts +1 -1
  42. package/dist/Operations/GetFeaturesOperation.d.ts +1 -1
  43. package/dist/Validations/CoreValidation.d.ts +2 -2
  44. package/dist/Validations/CoreValidation.js +1 -1
  45. package/dist/Validations/CoreValidation.js.map +1 -1
  46. package/dist/Validations/ParentChildValidation.d.ts +5 -5
  47. package/dist/Validations/ParentChildValidation.js.map +1 -1
  48. package/dist/Validations/Validation.d.ts +5 -5
  49. package/dist/Validations/ValidationSet.d.ts +4 -4
  50. package/dist/Validations/ValidationSet.js.map +1 -1
  51. package/dist/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +4 -4
  53. package/src/Changes/AddAssemblyAndFeaturesFromFileChange.ts +6 -6
  54. package/src/Changes/AddAssemblyFromExternalChange.ts +5 -5
  55. package/src/Changes/AddAssemblyFromFileChange.ts +8 -8
  56. package/src/Changes/AddFeatureChange.ts +7 -6
  57. package/src/Changes/AddFeaturesFromFileChange.ts +6 -6
  58. package/src/Changes/AddRefSeqAliasesChange.ts +6 -6
  59. package/src/Changes/DeleteAssemblyChange.ts +4 -4
  60. package/src/Changes/DeleteFeatureChange.ts +7 -7
  61. package/src/Changes/DeleteUserChange.ts +5 -5
  62. package/src/Changes/FeatureAttributeChange.ts +6 -6
  63. package/src/Changes/FromFileBaseChange.ts +6 -3
  64. package/src/Changes/ImportJBrowseConfigChange.ts +4 -4
  65. package/src/Changes/LocationEndChange.ts +6 -6
  66. package/src/Changes/LocationStartChange.ts +6 -6
  67. package/src/Changes/StrandChange.ts +6 -6
  68. package/src/Changes/TypeChange.ts +6 -6
  69. package/src/Changes/UserChange.ts +5 -5
  70. package/src/Checks/CDSCheck.ts +113 -32
  71. package/src/GFF3/annotationFeatureToGFF3.test.ts +4 -2
  72. package/src/GFF3/annotationFeatureToGFF3.ts +6 -4
  73. package/src/GFF3/gff3ToAnnotationFeature.test.ts +3 -3
  74. package/src/GFF3/gff3ToAnnotationFeature.ts +11 -2
  75. package/src/GFF3/gffReservedKeys.ts +25 -0
  76. package/src/Messages.ts +2 -2
  77. package/src/Operations/GetAssembliesOperation.ts +3 -3
  78. package/src/Operations/GetFeaturesOperation.ts +4 -4
  79. package/src/Validations/CoreValidation.ts +4 -3
  80. package/src/Validations/ParentChildValidation.ts +7 -6
  81. package/src/Validations/Validation.ts +5 -5
  82. package/src/Validations/ValidationSet.ts +8 -4
  83. package/test_data/example01.json +3 -3
  84. package/test_data/example02.json +3 -3
  85. package/test_data/example04.json +3 -3
  86. package/test_data/gene_representations.gff3 +686 -1686
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable @typescript-eslint/no-floating-promises */
2
- import { describe, it } from 'node:test'
3
2
  import { readFileSync } from 'node:fs'
3
+ import { describe, it } from 'node:test'
4
4
 
5
- import gff, { GFF3Feature } from '@gmod/gff'
5
+ import { type AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
6
+ import gff, { type GFF3Feature } from '@gmod/gff'
6
7
  import { assert, use } from 'chai'
7
8
  import chaiExclude from 'chai-exclude'
8
9
 
9
10
  import { gff3ToAnnotationFeature } from './gff3ToAnnotationFeature'
10
- import { AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
11
11
 
12
12
  use(chaiExclude)
13
13
 
@@ -1,5 +1,5 @@
1
- import { AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
2
- import { GFF3Feature, GFF3FeatureLineWithRefs } from '@gmod/gff'
1
+ import { type AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
2
+ import { type GFF3Feature, type GFF3FeatureLineWithRefs } from '@gmod/gff'
3
3
  import { doesIntersect2 } from '@jbrowse/core/util'
4
4
  import ObjectID from 'bson-objectid'
5
5
 
@@ -199,6 +199,7 @@ function convertChildren(
199
199
  exonFeatures,
200
200
  utrFeatures,
201
201
  processedCDS[0].refSeq,
202
+ featureIds,
202
203
  )
203
204
  for (const exon of missingExons) {
204
205
  convertedChildren[exon._id] = exon
@@ -216,6 +217,7 @@ function inferMissingExons(
216
217
  existingExons: GFF3Feature[],
217
218
  utrFeatures: GFF3Feature[],
218
219
  refSeq: string,
220
+ featureIds?: string[],
219
221
  ): AnnotationFeatureSnapshot[] {
220
222
  // Convert utrFeatures from GFF3Feature to AnnotationFeatureSnapshot
221
223
  const utrExons: AnnotationFeatureSnapshot[] = []
@@ -326,6 +328,13 @@ function inferMissingExons(
326
328
  }
327
329
  }
328
330
  const mergedExons = mergeAnnotationFeatures(missingExons)
331
+ if (featureIds) {
332
+ for (const exon of mergedExons) {
333
+ if (!featureIds.includes(exon._id)) {
334
+ featureIds.push(exon._id)
335
+ }
336
+ }
337
+ }
329
338
  return mergedExons
330
339
  }
331
340
 
@@ -59,3 +59,28 @@ export const internalToGFF: Record<GFFInternalAttribute, GFFReservedAttribute> =
59
59
  gff_ontology_term: 'Ontology_term',
60
60
  gff_is_circular: 'Is_circular',
61
61
  }
62
+
63
+ export function isGFFInternalAttribute(
64
+ attribute: string,
65
+ ): attribute is GFFInternalAttribute {
66
+ return attribute in internalToGFF
67
+ }
68
+
69
+ export type GFFColumn = 'score' | 'source'
70
+ export type GFFColumnInternal = 'gff_score' | 'gff_source'
71
+ export const gffColumnToInternal: Record<GFFColumn, GFFColumnInternal> = {
72
+ score: 'gff_score',
73
+ source: 'gff_source',
74
+ }
75
+ export function isGFFColumn(attribute: string): attribute is GFFColumn {
76
+ return attribute in gffColumnToInternal
77
+ }
78
+ export const gffInternalToColumn: Record<GFFColumnInternal, GFFColumn> = {
79
+ gff_score: 'score',
80
+ gff_source: 'source',
81
+ }
82
+ export function isGFFColumnInternal(
83
+ column: string,
84
+ ): column is GFFColumnInternal {
85
+ return column in gffInternalToColumn
86
+ }
package/src/Messages.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { SerializedChange } from '@apollo-annotation/common'
2
- import { CheckResultSnapshot } from '@apollo-annotation/mst'
1
+ import { type SerializedChange } from '@apollo-annotation/common'
2
+ import { type CheckResultSnapshot } from '@apollo-annotation/mst'
3
3
 
4
4
  interface BaseMessage {
5
5
  channel: string
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/require-await */
2
2
  import {
3
- LocalGFF3DataStore,
3
+ type LocalGFF3DataStore,
4
4
  Operation,
5
- SerializedOperation,
6
- ServerDataStore,
5
+ type SerializedOperation,
6
+ type ServerDataStore,
7
7
  } from '@apollo-annotation/common'
8
8
 
9
9
  interface SerializedGetAssembliesOperation extends SerializedOperation {
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/require-await */
2
2
  import {
3
- LocalGFF3DataStore,
3
+ type LocalGFF3DataStore,
4
4
  Operation,
5
- OperationOptions,
6
- SerializedOperation,
7
- ServerDataStore,
5
+ type OperationOptions,
6
+ type SerializedOperation,
7
+ type ServerDataStore,
8
8
  } from '@apollo-annotation/common'
9
9
 
10
10
  interface SerializedGetFeaturesOperation extends SerializedOperation {
@@ -1,9 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/require-await */
2
- import { Change } from '@apollo-annotation/common'
2
+ import { type Change } from '@apollo-annotation/common'
3
+
4
+ import { type TypeChange } from '../Changes'
3
5
 
4
- import { TypeChange } from '../Changes'
5
- import soSequenceTypes from './soSequenceTypes'
6
6
  import { Validation } from './Validation'
7
+ import soSequenceTypes from './soSequenceTypes'
7
8
 
8
9
  export function isTypeChange(thing: Change): thing is TypeChange {
9
10
  return 'oldType' in thing && 'newType' in thing
@@ -1,16 +1,17 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
2
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
3
- import { Change } from '@apollo-annotation/common'
4
- import { Feature, FeatureDocument } from '@apollo-annotation/schemas'
5
- import { ClientSession, Model } from 'mongoose'
3
+ import { type Change } from '@apollo-annotation/common'
4
+ import { type Feature, type FeatureDocument } from '@apollo-annotation/schemas'
5
+ import { type ClientSession, type Model } from 'mongoose'
6
6
 
7
7
  import {
8
- LocationEndChange,
9
- LocationStartChange,
8
+ type LocationEndChange,
9
+ type LocationStartChange,
10
10
  isLocationEndChange,
11
11
  isLocationStartChange,
12
12
  } from '../Changes'
13
- import { Validation, ValidationResult } from './Validation'
13
+
14
+ import { Validation, type ValidationResult } from './Validation'
14
15
 
15
16
  export class ParentChildValidation extends Validation {
16
17
  name = 'ParentChildValidation' as const
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
2
  /* eslint-disable @typescript-eslint/require-await */
3
- import { Change, ClientDataStore } from '@apollo-annotation/common'
4
- import { FeatureDocument } from '@apollo-annotation/schemas'
5
- import type { ExecutionContext } from '@nestjs/common'
6
- import type { Reflector } from '@nestjs/core'
7
- import { ClientSession, Model } from 'mongoose'
3
+ import { type Change, type ClientDataStore } from '@apollo-annotation/common'
4
+ import { type FeatureDocument } from '@apollo-annotation/schemas'
5
+ import { type ExecutionContext } from '@nestjs/common'
6
+ import { type Reflector } from '@nestjs/core'
7
+ import { type ClientSession, type Model } from 'mongoose'
8
8
 
9
9
  export interface Context {
10
10
  context: ExecutionContext
@@ -1,8 +1,12 @@
1
- import { Change, ClientDataStore } from '@apollo-annotation/common'
2
- import { FeatureDocument } from '@apollo-annotation/schemas'
3
- import { ClientSession, Model } from 'mongoose'
1
+ import { type Change, type ClientDataStore } from '@apollo-annotation/common'
2
+ import { type FeatureDocument } from '@apollo-annotation/schemas'
3
+ import { type ClientSession, type Model } from 'mongoose'
4
4
 
5
- import { Context, Validation, ValidationResult } from './Validation'
5
+ import {
6
+ type Context,
7
+ type Validation,
8
+ type ValidationResult,
9
+ } from './Validation'
6
10
 
7
11
  export class ValidationResultSet {
8
12
  results: ValidationResult[] = []
@@ -30,7 +30,7 @@
30
30
  "refSeq": "chr1",
31
31
  "type": "exon",
32
32
  "min": 1049,
33
- "max": 1500,
33
+ "max": 1499,
34
34
  "strand": 1,
35
35
  "attributes": {
36
36
  "gff_id": ["exon10002"]
@@ -100,7 +100,7 @@
100
100
  "refSeq": "chr1",
101
101
  "type": "exon",
102
102
  "min": 1049,
103
- "max": 1500,
103
+ "max": 1499,
104
104
  "strand": 1,
105
105
  "attributes": {
106
106
  "gff_id": ["exon10002"]
@@ -159,7 +159,7 @@
159
159
  "refSeq": "chr1",
160
160
  "type": "exon",
161
161
  "min": 1299,
162
- "max": 1500,
162
+ "max": 1499,
163
163
  "strand": 1,
164
164
  "attributes": {
165
165
  "gff_id": ["exon10001"]
@@ -19,7 +19,7 @@
19
19
  "refSeq": "chr1",
20
20
  "type": "exon",
21
21
  "min": 11049,
22
- "max": 11500,
22
+ "max": 11499,
23
23
  "strand": 1,
24
24
  "attributes": {
25
25
  "gff_id": ["exon20001"]
@@ -89,7 +89,7 @@
89
89
  "refSeq": "chr1",
90
90
  "type": "exon",
91
91
  "min": 11049,
92
- "max": 11500,
92
+ "max": 11499,
93
93
  "strand": 1,
94
94
  "attributes": {
95
95
  "gff_id": ["exon20002"]
@@ -148,7 +148,7 @@
148
148
  "refSeq": "chr1",
149
149
  "type": "exon",
150
150
  "min": 11299,
151
- "max": 11500,
151
+ "max": 11499,
152
152
  "strand": 1,
153
153
  "attributes": {
154
154
  "gff_id": ["exon20003"]
@@ -19,7 +19,7 @@
19
19
  "refSeq": "chr1",
20
20
  "type": "exon",
21
21
  "min": 31049,
22
- "max": 31500,
22
+ "max": 31499,
23
23
  "strand": 1,
24
24
  "attributes": {
25
25
  "gff_id": ["exon40001"]
@@ -89,7 +89,7 @@
89
89
  "refSeq": "chr1",
90
90
  "type": "exon",
91
91
  "min": 31049,
92
- "max": 31500,
92
+ "max": 31499,
93
93
  "strand": 1,
94
94
  "attributes": {
95
95
  "gff_id": ["exon40001"]
@@ -148,7 +148,7 @@
148
148
  "refSeq": "chr1",
149
149
  "type": "exon",
150
150
  "min": 31299,
151
- "max": 31500,
151
+ "max": 31499,
152
152
  "strand": 1,
153
153
  "attributes": {
154
154
  "gff_id": ["exon40002"]