From 70120a295abf05056c70939b65b13179965f44fe Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Wed, 12 Oct 2016 11:45:43 +0200 Subject: [PATCH] Unify code for RawDataTable and InvertedRawDataTable, selections will added as new column Caleydo/targid2#255 --- ExpressionScore.ts | 8 +------- Scores.ts | 10 ++-------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/ExpressionScore.ts b/ExpressionScore.ts index 9a2f20c..176a0c1 100644 --- a/ExpressionScore.ts +++ b/ExpressionScore.ts @@ -20,17 +20,11 @@ class ExpressionScore implements IScore { domain: this.score === 'ab_int' ? [0, 100] : [-1, 1] }; } - compute(ids: ranges.Range, idtype: idtypes.IDType, idMapper:(id:string) => number): Promise<{ [id:string]: number }> { + compute(ids: ranges.Range, idtype: idtypes.IDType): Promise { return ajax.getAPIJSON('/targid/db/dummy/expression_score', { score: this.score, b_cat2 : this.tumor_sample, agg: this.aggregation - }).then((rows: any[]) => { - const r : { [id:string]: number } = {}; - rows.forEach((row) => { - r[idMapper(row.id)] = row.score; - }); - return r; }); } } diff --git a/Scores.ts b/Scores.ts index 3de4e15..deac3fe 100644 --- a/Scores.ts +++ b/Scores.ts @@ -20,14 +20,8 @@ class AvgScore implements IScore { domain: [0, 100] }; } - compute(ids: ranges.Range, idtype: idtypes.IDType, idMapper:(id:string) => number): Promise<{ [id:string]: number }> { - return ajax.getAPIJSON('/targid/db/dummy/avg_score').then((rows: any[]) => { - const r : { [id:string]: number } = {}; - rows.forEach((row) => { - r[idMapper(row.id)] = row.score; - }); - return r; - }); + compute(ids: ranges.Range, idtype: idtypes.IDType): Promise { + return ajax.getAPIJSON('/targid/db/dummy/avg_score'); } }