From 5508c7713ae735e72b3ca4443bb8e869faa5e4fa Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Thu, 4 Jan 2018 23:33:45 -0800 Subject: [PATCH] request single expression for color action --- src/actions/index.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/actions/index.js b/src/actions/index.js index 996f590c..c1e02f31 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -93,6 +93,31 @@ const requestGeneExpressionCounts = () => { } } +const requestSingleGeneExpressionCountsForColoringPOST = (gene) => { + return (dispatch, getState) => { + dispatch({type: "get single gene expression for coloring started"}) + fetch(`${globals.API.prefix}${globals.API.version}expression`, { + method: "POST", + body: JSON.stringify({ + "genelist": [gene] + }), + headers: new Headers({ + "accept": "application/json", + "Content-Type": "application/json" + }) + }) + .then(res => res.json()) + .then( + data => dispatch({ + type: "color by expression", + gene: gene, + data + }), + error => dispatch({type: "get single gene expression for coloring error", error}) + ) + } +} + const ___hardcoded___requestGeneExpressionCountsPOST = () => { return (dispatch, getState) => { dispatch({type: "get expression started"}) @@ -117,7 +142,7 @@ const ___hardcoded___requestGeneExpressionCountsPOST = () => { } } -const requestDifferentialExpression = (celllist1, celllist2, num_genes = 10) => { +const requestDifferentialExpression = (celllist1, celllist2, num_genes = 7) => { return (dispatch, getState) => { dispatch({type: "request differential expression started"}) fetch(`${globals.API.prefix}${globals.API.version}diffexpression`, { @@ -145,6 +170,7 @@ export default { requestCells, requestGeneExpressionCounts, ___hardcoded___requestGeneExpressionCountsPOST, + requestSingleGeneExpressionCountsForColoringPOST, attemptCategoricalMetadataSelection, attemptCategoricalMetadataDeselection, requestDifferentialExpression