// jshint esversion: 6 import React from "react"; import _ from "lodash"; import memoize from "memoize-one"; 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 import FaPaintBrush from "react-icons/lib/fa/paint-brush"; import * as d3 from "d3"; import { interpolateGreys } from "d3-scale-chromatic"; 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 (Select cells & compute differential to see heatmap
; const topGenesForCellSet1 = this.props.differential.diffExp.data.celllist1; const topGenesForCellSet2 = this.props.differential.diffExp.data.celllist2; // const allGeneNames = this.getAllGeneNames(this.props.world); 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(interpolateGreys); return (Gene
1
2
ave diff