Skip to content

Commit

Permalink
Fix bug in Set creation
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Sep 18, 2024
1 parent de32ed4 commit c186ea4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/apollo-shared/src/GFF3/gff3ToAnnotationFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ function getFeatureMinMax(gff3Feature: GFF3Feature): [number, number] {

function convertFeatureAttributes(
gff3Feature: GFF3Feature,
): Record<string, string[]> | undefined {
const convertedAttributes: Record<string, string[]> = {}
): Record<string, string[] | undefined> | undefined {
const convertedAttributes: Record<string, string[] | undefined> | undefined =
{}
const scores = gff3Feature
.map((f) => f.score)
.filter((score) => score !== null)
Expand All @@ -106,22 +107,21 @@ function convertFeatureAttributes(
if (sources.length > 0) {
let [source] = sources
if (sources.length > 1) {
const sourceSet = new Set(...sources)
const sourceSet = new Set(sources)
source = [...sourceSet].join(',')
}
convertedAttributes.gff_source = [source]
}
if (attributesCollections.length > 0) {
const newAttributes: Record<string, string[] | undefined> = {}
for (const attributesCollection of attributesCollections) {
for (const [key, val] of Object.entries(attributesCollection)) {
if (!val || key === 'Parent') {
continue
}
const newKey = isGFFReservedAttribute(key) ? gffToInternal[key] : key
const existingVal = newAttributes[newKey]
const existingVal = convertedAttributes[newKey]
if (existingVal) {
const valSet = new Set(...existingVal, ...val)
const valSet = new Set([...existingVal, ...val])
convertedAttributes[newKey] = [...valSet]
} else {
convertedAttributes[newKey] = val
Expand Down

0 comments on commit c186ea4

Please sign in to comment.