From ce73db48adbdf5bce7497df9aca4521700376931 Mon Sep 17 00:00:00 2001 From: Gaofei Zhao Date: Fri, 10 Dec 2021 11:55:03 -0500 Subject: [PATCH] Returns an empty list for undefined profileIds in isSampleProfiledInMultiple function --- src/shared/lib/isSampleProfiled.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/shared/lib/isSampleProfiled.ts b/src/shared/lib/isSampleProfiled.ts index 679b387eabe..5156d6377d5 100644 --- a/src/shared/lib/isSampleProfiled.ts +++ b/src/shared/lib/isSampleProfiled.ts @@ -62,17 +62,22 @@ export function isSampleProfiledInSomeMolecularProfile( export function isSampleProfiledInMultiple( uniqueSampleKey: string, - molecularProfileIds: string[], + molecularProfileIds: string[] | undefined, coverageInformation: CoverageInformation, hugoGeneSymbol?: string ): boolean[] { - // returns boolean[] in same order as molecularProfileIds - const profiledReport = getSampleProfiledReport( - uniqueSampleKey, - coverageInformation, - hugoGeneSymbol - ); - return molecularProfileIds.map( - molecularProfileId => !!profiledReport[molecularProfileId] - ); + // returns empty list if molecularProfileIds is undefined + if (!molecularProfileIds) { + return []; + } else { + // returns boolean[] in same order as molecularProfileIds + const profiledReport = getSampleProfiledReport( + uniqueSampleKey, + coverageInformation, + hugoGeneSymbol + ); + return molecularProfileIds.map( + molecularProfileId => !!profiledReport[molecularProfileId] + ); + } }