From 2d3a331c78ebff92c394b5410ee3a588f0cfed01 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:32:05 -0800 Subject: [PATCH] Make JsonAnnotation.strand optional The previous error message code indicated the possibility that this property is unset. Express that directly in the type annotation and simplify the error message code. --- src/util/entropyCreateStateFromJsons.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/entropyCreateStateFromJsons.ts b/src/util/entropyCreateStateFromJsons.ts index 2f67c164a..afd4b7f09 100644 --- a/src/util/entropyCreateStateFromJsons.ts +++ b/src/util/entropyCreateStateFromJsons.ts @@ -20,7 +20,7 @@ interface JsonAnnotation { end?: number start?: number segments?: JsonSegmentRange[] - strand: Strand + strand?: Strand gene?: string color?: string display_name?: string @@ -225,7 +225,7 @@ function cdsFromAnnotation( * which are represented by augur as '?' and null, respectively. (null comes from `None` in python.) * In both cases it's not a good idea to make an assumption of strandedness, or to assume it's even a CDS. */ console.error(`[Genome annotation] ${cdsName} has strand ` + - (Object.prototype.hasOwnProperty.call(annotation, "strand") ? String(annotation.strand) : '(missing)') + + (annotation.strand !== undefined ? annotation.strand : '(missing)') + ". This CDS will be ignored."); return invalidCds; }