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"; /* http://emilebres.github.io/react-virtualized-checkbox/ */ 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

Select cells & compute differential to see heatmap

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)) }} />

Gene

1

2

{ topGenesForCellSet1.topgenes.map((gene, i) => { return }) } { topGenesForCellSet2.topgenes.map((gene, i) => { return }) }
) } } export default Heatmap;