move expression counts func into util

This commit is contained in:
Colin Megill
2017-11-02 12:53:23 -07:00
parent b5f068abf9
commit 48c614a735
2 changed files with 26 additions and 31 deletions
+25
View File
@@ -0,0 +1,25 @@
createExpressionsCountsMap () {
const CHANGE_ME_MAGIC_GENE_INDEX = 5;
const expressionsCountsMap = {};
/* currently selected gene */
expressionsCountsMap.geneName = this.state.expressions.data.genes[3];
let maxExpressionValue = 0;
/* create map of expressions for every cell */
this.state.expressions.data.cells.map((c) => {
/* cellname = 234 */
expressionsCountsMap[c.cellname] = c["e"][CHANGE_ME_MAGIC_GENE_INDEX];
/* collect the maximum value as we iterate */
if (c["e"][CHANGE_ME_MAGIC_GENE_INDEX] > maxExpressionValue) {
maxExpressionValue = c["e"][CHANGE_ME_MAGIC_GENE_INDEX]
}
})
expressionsCountsMap.maxValue = maxExpressionValue;
return expressionsCountsMap;
}