From bafd2827fe50fd4793de7ae3f38cdcb5e4116360 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Wed, 28 Feb 2018 09:49:58 -0800 Subject: [PATCH] componetize buttons on diffexp to generalize --- src/components/expression/cellSetButtons.js | 63 ++++++++++++ src/components/expression/diffExpHeatmap.js | 4 +- src/components/expression/expression.js | 101 +++----------------- 3 files changed, 80 insertions(+), 88 deletions(-) create mode 100644 src/components/expression/cellSetButtons.js diff --git a/src/components/expression/cellSetButtons.js b/src/components/expression/cellSetButtons.js new file mode 100644 index 00000000..86f8062a --- /dev/null +++ b/src/components/expression/cellSetButtons.js @@ -0,0 +1,63 @@ +import React from "react"; +import _ from "lodash"; +import { connect } from "react-redux"; +import * as globals from "../../globals"; +import styles from "../framework/buttons.css"; +import actions from "../../actions"; + +@connect() +class CellSetButton extends React.Component { + set() { + const set = []; + + _.each(this.props.currentCellSelection, (cell) => { + if (cell["__selected__"]) { + set.push(cell.CellName) + } + }) + + this.props.dispatch({ + type: "store current cell selection as differential set " + this.props.eitherCellSetOneOrTwo, + data: set + }) + } + render() { + return ( + + + + + ) + } +} + +export default CellSetButton; diff --git a/src/components/expression/diffExpHeatmap.js b/src/components/expression/diffExpHeatmap.js index 2af6ded1..5761ed8e 100644 --- a/src/components/expression/diffExpHeatmap.js +++ b/src/components/expression/diffExpHeatmap.js @@ -46,7 +46,7 @@ class HeatmapSquare extends React.Component { *********************************** **********************************/ @connect((state) => { - + return { scatterplotXXaccessor: state.controls.scatterplotXXaccessor, scatterplotYYaccessor: state.controls.scatterplotYYaccessor, @@ -166,7 +166,7 @@ class Heatmap extends React.Component { } } render() { - if (!this.props.differential.diffExp) return null + if (!this.props.differential.diffExp) return

Select cells & compute differential to see heatmap

const topGenesForCellSet1 = this.props.differential.diffExp.data.celllist1; const topGenesForCellSet2 = this.props.differential.diffExp.data.celllist2; diff --git a/src/components/expression/expression.js b/src/components/expression/expression.js index 8ff6abba..c6e47c3a 100644 --- a/src/components/expression/expression.js +++ b/src/components/expression/expression.js @@ -2,11 +2,8 @@ import React from "react"; import _ from "lodash"; import { connect } from "react-redux"; import * as globals from "../../globals"; -import styles from "./expression.css"; import actions from "../../actions"; -import Heatmap from "./diffExpHeatmap"; -//

Top genes expressed by cellset 2

-//

Gene {"............"} Exp in set 1 {"............"} Exp in set 2

+import CellSetButton from "./cellSetButtons"; @connect((state) => { return { @@ -29,34 +26,6 @@ class Expression extends React.Component { }); } } - set1() { - const set = []; - - _.each(this.props.currentCellSelection, (cell) => { - if (cell["__selected__"]) { - set.push(cell.CellName) - } - }) - - this.props.dispatch({ - type: "store current cell selection as differential set 1", - data: set - }) - } - set2() { - const set = []; - - _.each(this.props.currentCellSelection, (cell) => { - if (cell["__selected__"]) { - set.push(cell.CellName) - } - }) - - this.props.dispatch({ - type: "store current cell selection as differential set 2", - data: set - }) - } computeDiffExp() { this.props.dispatch( actions.requestDifferentialExpression( @@ -73,70 +42,30 @@ class Expression extends React.Component { } return (
-
- - -
+
+ + +
-
) }