diff --git a/src/components/expression/diffExpHeatmap.js b/src/components/expression/diffExpHeatmap.js
new file mode 100644
index 00000000..2af6ded1
--- /dev/null
+++ b/src/components/expression/diffExpHeatmap.js
@@ -0,0 +1,246 @@
+import React from "react";
+import _ from "lodash";
+import { connect } from "react-redux";
+import * as globals from "../../globals";
+import styles from "./expression.css";
+import SectionHeader from "../framework/sectionHeader"
+import actions from "../../actions";
+import ReactAutocomplete from "react-autocomplete";
+import getContrast from "font-color-contrast"; // https://www.npmjs.com/package/font-color-contrast
+
+class HeatmapSquare extends React.Component {
+ constructor (props) {
+ super(props)
+ this.state = {
+ value: '',
+ }
+ }
+ render() {
+ const contrastColor = getContrast(
+ this.props.backgroundColor
+ .substring(4, this.props.backgroundColor.length-1)
+ .replace(/ /g, "")
+ .split(",")
+ )
+ return (
+
+ {this.props.text}
+
+ )
+ }
+}
+
+/**********************************
+***********************************
+***********************************
+ Row
+***********************************
+***********************************
+**********************************/
+@connect((state) => {
+
+ return {
+ scatterplotXXaccessor: state.controls.scatterplotXXaccessor,
+ scatterplotYYaccessor: state.controls.scatterplotYYaccessor,
+ colorAccessor: state.controls.colorAccessor,
+ }
+})
+class HeatmapRow extends React.Component {
+ constructor (props) {
+ super(props)
+ this.state = {
+ value: '',
+ }
+ }
+ handleGeneColorScaleClick(gene) {
+ return () => {
+ this.props.dispatch(
+ actions.requestSingleGeneExpressionCountsForColoringPOST(this.props.gene)
+ )
+ }
+ }
+ handleSetGeneAsScatterplotX(gene) {
+ return () => {
+ this.props.dispatch({
+ type: "set scatterplot x",
+ data: this.props.gene
+ })
+ }
+ }
+ handleSetGeneAsScatterplotY(gene) {
+ return () => {
+ this.props.dispatch({
+ type: "set scatterplot y",
+ data: this.props.gene
+ })
+ }
+ }
+ render() {
+ return (
+
+
+ X
+ Y
+ 🖌️
+
+ {this.props.gene}
+
+
+
+
+
+ )
+ }
+}
+
+/**********************************
+***********************************
+***********************************
+ DiffExp Heatmap
+***********************************
+***********************************
+**********************************/
+
+@connect((state) => {
+ return {
+ differential: state.differential,
+ allGeneNames: state.controls.allGeneNames
+ }
+})
+class Heatmap extends React.Component {
+ constructor (props) {
+ super(props)
+ this.state = {
+ value: '',
+ }
+ }
+ render() {
+ if (!this.props.differential.diffExp) return null
+
+ const topGenesForCellSet1 = this.props.differential.diffExp.data.celllist1;
+ const topGenesForCellSet2 = this.props.differential.diffExp.data.celllist2;
+
+ const extent = d3.extent(
+ _.union(
+ topGenesForCellSet1.mean_expression_cellset1,
+ topGenesForCellSet1.mean_expression_cellset2,
+ topGenesForCellSet2.mean_expression_cellset1,
+ topGenesForCellSet2.mean_expression_cellset2
+ )
+ )
+
+ const greyColorScale = d3.scaleSequential()
+ .domain(extent)
+ .interpolator(d3.interpolateGreys);
+
+ return (
+
+ Color by any gene:
+
item.toLowerCase().indexOf(value.toLowerCase()) > -1}
+ getItemValue={item => item}
+ renderItem={(item, highlighted) =>
+
+ {item}
+
+ }
+ value={this.state.value}
+ onChange={e => this.setState({ value: e.target.value })}
+ onSelect={(value) => {
+ this.setState({ value });
+ this.props.dispatch(actions.requestSingleGeneExpressionCountsForColoringPOST(value))
+ }}
+ />
+
+ {
+ topGenesForCellSet1.topgenes.map((gene, i) => {
+ return
+ })
+ }
+ {
+ topGenesForCellSet2.topgenes.map((gene, i) => {
+ return
+ })
+ }
+
+ )
+ }
+}
+
+export default Heatmap;
diff --git a/src/components/expression/expression.js b/src/components/expression/expression.js
index e46799ad..8ff6abba 100644
--- a/src/components/expression/expression.js
+++ b/src/components/expression/expression.js
@@ -3,177 +3,11 @@ import _ from "lodash";
import { connect } from "react-redux";
import * as globals from "../../globals";
import styles from "./expression.css";
-import SectionHeader from "../framework/sectionHeader"
import actions from "../../actions";
-import ReactAutocomplete from "react-autocomplete";
-
-
-@connect((state) => {
- return {
- differential: state.differential,
- allGeneNames: state.controls.allGeneNames
- }
-})
-class DiffExp extends React.Component {
- constructor (props) {
- super(props)
- this.state = {
- value: '',
- }
- }
- handleGeneColorScaleClick(gene) {
- return () => {
- this.props.dispatch(actions.requestSingleGeneExpressionCountsForColoringPOST(gene))
- }
- }
- render() {
- if (!this.props.differential.diffExp) return null
-
- const topGenesForCellSet1 = this.props.differential.diffExp.data.celllist1;
- const topGenesForCellSet2 = this.props.differential.diffExp.data.celllist2;
- const rectSide = 10;
- const rightMargin = 0;
-
- const extent = d3.extent(
- _.union(
- topGenesForCellSet1.mean_expression_cellset1,
- topGenesForCellSet1.mean_expression_cellset2,
- topGenesForCellSet2.mean_expression_cellset1,
- topGenesForCellSet2.mean_expression_cellset2
- )
- )
-
- const greyColorScale = d3.scaleSequential()
- .domain(extent)
- .interpolator(d3.interpolateGreys);
-
- return (
-
- Color by any gene:
-
item.toLowerCase().indexOf(value.toLowerCase()) > -1}
- getItemValue={item => item}
- renderItem={(item, highlighted) =>
-
- {item}
-
- }
- value={this.state.value}
- onChange={e => this.setState({ value: e.target.value })}
- onSelect={(value) => {
- this.setState({ value });
- this.props.dispatch(actions.requestSingleGeneExpressionCountsForColoringPOST(value))
- }}
- />
-
-
Gene
-
Set 1 exp
-
Set 2 exp
-
- {
- topGenesForCellSet1.topgenes.map((gene, i) => {
- return (
-
-
- 🖌️
- {gene}
-
-
- {Math.floor(topGenesForCellSet1.mean_expression_cellset1[i])}
-
-
- {Math.floor(topGenesForCellSet1.mean_expression_cellset2[i])}
-
-
- )
- })
- }
- {
- topGenesForCellSet2.topgenes.map((gene, i) => {
- return (
-
-
- 🖌️
- {gene}
-
-
- {Math.floor(topGenesForCellSet2.mean_expression_cellset1[i])}
-
-
- {Math.floor(topGenesForCellSet2.mean_expression_cellset2[i])}
-
-
- )
- })
- }
-
- )
- }
-}
-
+import Heatmap from "./diffExpHeatmap";
// Top genes expressed by cellset 2
// Gene {"............"} Exp in set 1 {"............"} Exp in set 2
-
@connect((state) => {
return {
currentCellSelection: state.controls.currentCellSelection,
@@ -276,7 +110,6 @@ class Expression extends React.Component {
border: "none",
borderRadius: 3,
cursor: "pointer",
-
}}
onClick={this.set2.bind(this)}>
{
@@ -298,55 +131,15 @@ class Expression extends React.Component {
border: "none",
borderRadius: 3,
cursor: "pointer",
-
}}
onClick={this.computeDiffExp.bind(this)}>
Compute differential expression
-
+
)
}
};
export default Expression;
-
-
-//
-//
-// {
-// _.map(this.props.expression.genes, (gene) => {
-// return (
-//
-// )
-// })
-// }
-
-
-// Gene count:
-//
-
-//