Skip to content

Commit b798aa5

Browse files
Remove references to gff_id
1 parent 25b032a commit b798aa5

File tree

17 files changed

+44
-108
lines changed

17 files changed

+44
-108
lines changed

packages/apollo-cli/src/test/test.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,10 @@ void describe('Test CLI', () => {
339339
assert.deepStrictEqual(p.stdout.trim(), '[]') // No failing check
340340

341341
// Get the ID of the CDS. We need need it to modify the CDS coordinates
342-
const gene = out.filter(
343-
(x: any) =>
344-
JSON.stringify(x.attributes.gff_id) === JSON.stringify(['gene01']),
345-
)
342+
const gene = out.filter((x: any) => x.featureId === 'gene01')
346343
const mrna = Object.values(gene.at(0).children).at(0) as any
347344
const cds = Object.values(mrna.children).find(
348-
(x: any) => x.attributes.gff_id.at(0) === 'cds01',
345+
(x: any) => x.featureId === 'cds01',
349346
) as any
350347
const cds_id = cds._id
351348

@@ -377,12 +374,11 @@ void describe('Test CLI', () => {
377374

378375
// Get the ID of the CDS. We need need it to modify the CDS coordinates
379376
const gene = out.filter(
380-
(x: any) =>
381-
JSON.stringify(x.attributes.gff_id) === JSON.stringify(['gene01']),
377+
(x: any) => x.featureId === JSON.stringify(['gene01']),
382378
)
383379
const mrna = Object.values(gene.at(0).children).at(0) as any
384380
const cds = Object.values(mrna.children).find(
385-
(x: any) => x.attributes.gff_id.at(0) === 'cds01',
381+
(x: any) => x.featureId === 'cds01',
386382
) as any
387383
const cds_id = cds._id
388384

@@ -1660,23 +1656,13 @@ void describe('Test CLI', () => {
16601656
if (!child.attributes) {
16611657
throw new Error('Error getting attributes')
16621658
}
1663-
if (
1664-
JSON.stringify(child.attributes.gff_id) ===
1665-
JSON.stringify(['EDEN.1']) ||
1666-
JSON.stringify(child.attributes.gff_id) ===
1667-
JSON.stringify(['EDEN2.1'])
1668-
) {
1659+
if (child.featureId === 'EDEN.1' || child.featureId === 'EDEN2.1') {
16691660
okMrnaId.push(child._id)
16701661
}
1671-
if (
1672-
JSON.stringify(child.attributes.gff_id) === JSON.stringify(['EDEN.2'])
1673-
) {
1662+
if (child.featureId === 'EDEN.2') {
16741663
warnMrnaIdForw = child._id
16751664
}
1676-
if (
1677-
JSON.stringify(child.attributes.gff_id) ===
1678-
JSON.stringify(['EDEN2.2'])
1679-
) {
1665+
if (child.featureId === 'EDEN2.2') {
16801666
warnMrnaIdRev = child._id
16811667
}
16821668
}

packages/apollo-cli/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"skipLibCheck": true,
1111
},
1212
"include": ["./src"],
13+
"references": [{ "path": "../apollo-mst" }, { "path": "../apollo-shared" }],
1314
"ts-node": {
1415
"esm": true,
1516
},

packages/apollo-mst/src/AnnotationFeatureModel.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ export const AnnotationFeatureModel = types
8484
get length() {
8585
return self.max - self.min
8686
},
87-
get featureId() {
88-
return self.attributes.get('id')
89-
},
9087
/**
9188
* Possibly different from `min` because "The GFF3 format does not enforce a
9289
* rule in which features must be wholly contained within the location of

packages/apollo-shared/src/Changes/MergeExonsChange.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -166,36 +166,4 @@ export class MergeExonsChange extends FeatureChange {
166166
{ logger },
167167
)
168168
}
169-
170-
// mergeAttributes(
171-
// firstExon: AnnotationFeatureSnapshot,
172-
// secondExon: AnnotationFeatureSnapshot,
173-
// ): Record<string, string[]> {
174-
// let mergedAttrs: Record<string, string[]> = {}
175-
// if (firstExon.attributes) {
176-
// // eslint-disable-next-line unicorn/prefer-structured-clone
177-
// mergedAttrs = JSON.parse(JSON.stringify(firstExon.attributes))
178-
// }
179-
180-
// if (secondExon.attributes) {
181-
// // eslint-disable-next-line unicorn/prefer-structured-clone
182-
// const attrs: Record<string, string[]> = JSON.parse(
183-
// JSON.stringify(secondExon.attributes),
184-
// )
185-
// for (const key of Object.keys(attrs)) {
186-
// if (key === '_id' || key === 'gff_id') {
187-
// continue
188-
// }
189-
// if (!Object.keys(mergedAttrs).includes(key)) {
190-
// mergedAttrs[key] = []
191-
// }
192-
// attrs[key].map((x) => {
193-
// if (!mergedAttrs[key].includes(x)) {
194-
// mergedAttrs[key].push(x)
195-
// }
196-
// })
197-
// }
198-
// }
199-
// return mergedAttrs
200-
// }
201169
}

packages/apollo-shared/src/Changes/SplitExonChange.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ export class SplitExonChange extends FeatureChange {
229229
const exon = JSON.parse(JSON.stringify(exonToBeSplit))
230230
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
231231
delete exon.attributes._id
232-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
233-
delete exon.attributes.gff_id
234232

235233
const leftExon = structuredClone(
236234
exon,

packages/apollo-shared/src/Checks/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { type AnnotationFeatureSnapshot } from '@apollo-annotation/mst'
22

33
export function getPrintableId(feature: AnnotationFeatureSnapshot): string {
4-
const gff_id = feature.attributes?.gff_id?.join(', ')
5-
if (gff_id) {
6-
return `${gff_id} (_id: ${feature._id.toString()})`
4+
const { featureId } = feature
5+
if (featureId) {
6+
return `${featureId} (_id: ${feature._id.toString()})`
77
}
88
const gff_name = feature.attributes?.gff_name?.join(', ')
99
if (gff_name) {

packages/apollo-shared/src/GFF3/annotationFeatureToGFF3.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ describe('annotationFeatureToGFF3', () => {
9595
"max": 9000,
9696
"strand": 1,
9797
"attributes": {
98-
"gff_id": ["gene10001"],
9998
"gff_score": ["123", "345"]
100-
}
99+
},
100+
"featureId": "gene10001"
101101
}`) as AnnotationFeatureSnapshot
102102
const [gff3Feature] = annotationFeatureToGFF3(annotationFeature)
103103
assert.deepEqual(gff3Feature.score, 123)
@@ -111,9 +111,9 @@ describe('annotationFeatureToGFF3', () => {
111111
"max": 9000,
112112
"strand": 1,
113113
"attributes": {
114-
"gff_id": ["gene10001"],
115114
"gff_score": ["xyz"]
116-
}
115+
},
116+
"featureId": "gene10001"
117117
}`) as AnnotationFeatureSnapshot
118118
const [gff3Feature] = annotationFeatureToGFF3(annotationFeature)
119119
assert.deepEqual(gff3Feature.score, null)

packages/apollo-shared/src/GFF3/gff3ToAnnotationFeature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function convertFeatureAttributes(
137137
}
138138
}
139139
}
140-
if (Object.keys(convertedAttributes).length > 0) {
140+
if (id || Object.keys(convertedAttributes).length > 0) {
141141
return [convertedAttributes, id]
142142
}
143143
return

packages/apollo-shared/src/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export function splitStringIntoChunks(
1616

1717
export function getPrintableId(feature: Feature): string {
1818
const ff = feature as unknown as AnnotationFeature
19-
const gff_id = ff.attributes.get('gff_id')?.join(',')
20-
if (gff_id) {
21-
return `ID=${gff_id} (_id: ${feature._id.toString()})`
19+
const { featureId } = feature
20+
if (featureId) {
21+
return `ID=${featureId} (_id: ${feature._id.toString()})`
2222
}
2323
const gff_name = ff.attributes.get('gff_name')?.join(',')
2424
if (gff_name) {

packages/jbrowse-plugin-apollo/src/LinearApolloSixFrameDisplay/glyphs/GeneGlyph.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function draw(
206206
x: topLevelFeatureStartPx,
207207
y: topLevelFeatureTop,
208208
h: topLevelFeatureHeight,
209-
text: attributes.get('gff_id')?.toString(),
209+
text: topLevelFeature.featureId,
210210
color: textColor,
211211
isSelected,
212212
}
@@ -262,9 +262,7 @@ function draw(
262262
if (!childrenOfmRNA) {
263263
continue
264264
}
265-
const childID: string | undefined = child.attributes
266-
.get('gff_id')
267-
?.toString()
265+
const childID: string | undefined = child.featureId?.toString()
268266
if (childID && filteredTranscripts.includes(childID)) {
269267
continue
270268
}
@@ -311,7 +309,7 @@ function draw(
311309
x: startPx,
312310
y: exonTop,
313311
h: exonHeight,
314-
text: exon.attributes.get('gff_id')?.toString(),
312+
text: exon.featureId,
315313
color: textColor,
316314
isSelected,
317315
}
@@ -424,7 +422,7 @@ function draw(
424422
x: cdsStartPx,
425423
y: cdsTop,
426424
h: cdsHeight,
427-
text: child.attributes.get('gff_id')?.toString(),
425+
text: child.featureId?.toString(),
428426
color: textColor,
429427
isSelected,
430428
}
@@ -493,9 +491,7 @@ function drawHover(
493491
if (!featureTypeOntology.isTypeOf(feature.type, 'transcript')) {
494492
return
495493
}
496-
const featureID: string | undefined = feature.attributes
497-
.get('gff_id')
498-
?.toString()
494+
const featureID: string | undefined = feature.featureId?.toString()
499495
if (featureID && filteredTranscripts.includes(featureID)) {
500496
return
501497
}
@@ -656,9 +652,7 @@ function getDraggableFeatureInfo(
656652
throw new Error('featureTypeOntology is undefined')
657653
}
658654
const isTranscript = featureTypeOntology.isTypeOf(feature.type, 'transcript')
659-
const featureID: string | undefined = feature.attributes
660-
.get('gff_id')
661-
?.toString()
655+
const featureID: string | undefined = feature.featureId?.toString()
662656
if (featureID && filteredTranscripts.includes(featureID)) {
663657
return
664658
}
@@ -750,7 +744,7 @@ function drawTooltip(
750744
if (!position) {
751745
return
752746
}
753-
const featureID: string | undefined = attributes.get('gff_id')?.toString()
747+
const featureID: string | undefined = feature.featureId?.toString()
754748
if (featureID && filteredTranscripts.includes(featureID)) {
755749
return
756750
}
@@ -862,9 +856,7 @@ function getContextMenuItems(
862856
}
863857

864858
for (const feature of featuresUnderClick) {
865-
const featureID: string | undefined = feature.attributes
866-
.get('gff_id')
867-
?.toString()
859+
const featureID: string | undefined = feature.featureId?.toString()
868860
if (featureID && filteredTranscripts.includes(featureID)) {
869861
continue
870862
}

0 commit comments

Comments
 (0)