From c97672d085545f2e7eb8b24a182133be2cb0e68d Mon Sep 17 00:00:00 2001 From: tsheils Date: Fri, 26 Apr 2024 10:02:44 -0400 Subject: [PATCH] fix download file --- .../pathway-enrichment/pathway-enrichment.component.ts | 6 +++++- libs/models/ramp-models/src/lib/fisher-result.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libs/features/ramp/pathway-enrichment/src/lib/pathway-enrichment/pathway-enrichment.component.ts b/libs/features/ramp/pathway-enrichment/src/lib/pathway-enrichment/pathway-enrichment.component.ts index 3cd2979..a399e61 100644 --- a/libs/features/ramp/pathway-enrichment/src/lib/pathway-enrichment/pathway-enrichment.component.ts +++ b/libs/features/ramp/pathway-enrichment/src/lib/pathway-enrichment/pathway-enrichment.component.ts @@ -517,14 +517,18 @@ export class PathwayEnrichmentComponent fetchEnrichedPathwaysFile(): void { let data: unknown[]; + let analyteType = 'both'; if (this.enrichedDataframe.fishresults) { data = this.enrichedDataframe.fishresults as unknown[] } else { data = this.enrichedDataframe as unknown[] } + if(this.enrichedDataframe.analyte_type) { + analyteType = this.enrichedDataframe.analyte_type[0]; + } const fff = new FisherResult(data[0] as Partial) this._downloadFile( - this._toTSV(data, fff._getFields()), + this._toTSV(data, fff._getFields(analyteType)), 'fetchEnrichedPathwaysFromAnalytes-download.tsv', ); } diff --git a/libs/models/ramp-models/src/lib/fisher-result.ts b/libs/models/ramp-models/src/lib/fisher-result.ts index 05be9c4..9f81453 100644 --- a/libs/models/ramp-models/src/lib/fisher-result.ts +++ b/libs/models/ramp-models/src/lib/fisher-result.ts @@ -47,7 +47,12 @@ export class FisherResult { } } - _getFields() { - return Object.keys(this).filter(field => !['Total_In_Path', 'Pval_Holm', 'Pval_FDR', 'Pval', 'Num_In_Path', 'metabCount', 'geneCount', 'pathCount'].includes(field)); + _getFields(analyte_type: string) { + let ret: string[]; + if(analyte_type ==='both') { + return Object.keys(this).filter(field => !['Total_In_Path', 'Pval_Holm', 'Pval_FDR', 'Pval', 'Num_In_Path', 'metabCount', 'geneCount', 'pathCount'].includes(field)); + } else { + return Object.keys(this).filter(field => !['Total_In_Path_Metab', 'Total_In_Path_Gene', 'Pval_combined_Holm', 'Pval_combined_FDR', 'Pval_Metab','Pval_combined', 'Num_In_Path_Metab', 'Num_In_Path_Gene', 'metabCount', 'geneCount', 'pathCount'].includes(field)); + } } }