geneset show mean expression

This commit is contained in:
Colin Megill
2020-11-17 12:55:17 -08:00
parent 0ee62a86a0
commit 36939d99fa
+29 -20
View File
@@ -4,15 +4,14 @@
import React from "react"; import React from "react";
import _ from "lodash"; import _ from "lodash";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { AnchorButton, Icon, Tooltip, Position } from "@blueprintjs/core"; import { Tooltip, Position, Switch } from "@blueprintjs/core";
import { FaChevronRight, FaChevronDown } from "react-icons/fa"; import { FaChevronRight, FaChevronDown } from "react-icons/fa";
import actions from "../../actions"; import actions from "../../actions";
import Gene from "./gene"; import Gene from "./gene";
import { memoize } from "../../util/dataframe/util"; import { memoize } from "../../util/dataframe/util";
import Truncate from "../util/truncate"; import Truncate from "../util/truncate";
// import TestMiniHisto from "./test_miniHisto";
import * as globals from "../../globals"; import * as globals from "../../globals";
// import GenesetMenus from "./menus/genesetMenus"; import GenesetMenus from "./menus/genesetMenus";
@connect((state, ownProps) => { @connect((state, ownProps) => {
return { return {
@@ -29,6 +28,7 @@ class GeneSet extends React.Component {
super(props); super(props);
this.state = { this.state = {
isOpen: false, isOpen: false,
toggleSummaryHisto: false,
}; };
} }
@@ -96,9 +96,14 @@ class GeneSet extends React.Component {
}); });
}; };
toggleSummaryHisto = () => {
const { toggleSummaryHisto } = this.state;
this.setState({ toggleSummaryHisto: !toggleSummaryHisto });
};
render() { render() {
const { setName, setGenes, isColorAccessor } = this.props; const { setName, setGenes } = this.props;
const { isOpen } = this.state; const { isOpen, toggleSummaryHisto } = this.state;
return ( return (
<div style={{ marginBottom: 3 }}> <div style={{ marginBottom: 3 }}>
<div <div
@@ -135,7 +140,7 @@ class GeneSet extends React.Component {
style={{ style={{
maxWidth: maxWidth:
globals.leftSidebarWidth - globals.leftSidebarWidth -
150 /* todo_genesets this magic number determines how much of a long geneset name we see, and will be tweaked as we build */, 120 /* todo_genesets this magic number determines how much of a long geneset name we see, and will be tweaked as we build */,
}} }}
data-testid={`${setName}:geneset-label`} data-testid={`${setName}:geneset-label`}
> >
@@ -144,11 +149,15 @@ class GeneSet extends React.Component {
</Truncate> </Truncate>
</span> </span>
<div> <div>
{/* <TestMiniHisto /> */} <GenesetMenus genesetsEditable geneset={setName} />
{/* <GenesetMenus genesetsEditable geneset={setName} /> */} </div>
</div>
<div style={{ marginLeft: 15, marginTop: 5, marginRight: 0 }}>
{isOpen ? (
<Tooltip <Tooltip
content="Color by geneset" content="Aggregate all genes in this geneset, and allow coloring by and selecting on the entire set."
position={Position.LEFT} position={Position.BOTTOM_RIGHT}
usePortal usePortal
hoverOpenDelay={globals.tooltipHoverOpenDelay} hoverOpenDelay={globals.tooltipHoverOpenDelay}
modifiers={{ modifiers={{
@@ -156,20 +165,20 @@ class GeneSet extends React.Component {
hide: { enabled: false }, hide: { enabled: false },
}} }}
> >
<AnchorButton <Switch
disabled style={{ fontStyle: "italic" }}
data-testclass="colorby" checked={toggleSummaryHisto}
data-testid={`colorby-${setName}`} label="Show mean expression for genes in set"
onClick={this.onColorChangeClick} alignIndicator="left"
active={isColorAccessor} innerLabel="off"
intent={isColorAccessor ? "primary" : "none"} innerLabelChecked="on"
icon={<Icon icon="tint" iconSize={16} />} onChange={this.toggleSummaryHisto}
/> />
</Tooltip> </Tooltip>
</div> ) : null}
</div> </div>
{isOpen {isOpen && !toggleSummaryHisto
? _.map(setGenes, (gene) => { ? _.map(setGenes, (gene) => {
return <Gene key={gene} gene={gene} geneset={setName} />; return <Gene key={gene} gene={gene} geneset={setName} />;
}) })