mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 14:08:11 +08:00
colorby histo
This commit is contained in:
@@ -179,7 +179,12 @@ class GeneSet extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<GenesetMenus genesetsEditable geneset={setName} />
|
<GenesetMenus
|
||||||
|
isOpen={isOpen}
|
||||||
|
toggleSummaryHisto={toggleSummaryHisto}
|
||||||
|
genesetsEditable
|
||||||
|
geneset={setName}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { Tooltip2 } from "@blueprintjs/popover2";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
AnchorButton,
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Popover,
|
Popover,
|
||||||
Position,
|
Position,
|
||||||
Tooltip,
|
|
||||||
Icon,
|
Icon,
|
||||||
PopoverInteractionKind,
|
PopoverInteractionKind,
|
||||||
} from "@blueprintjs/core";
|
} from "@blueprintjs/core";
|
||||||
@@ -18,6 +20,7 @@ import AddGeneToGenesetDialogue from "./addGeneToGenesetDialogue";
|
|||||||
@connect((state) => {
|
@connect((state) => {
|
||||||
return {
|
return {
|
||||||
genesetsUI: state.genesetsUI,
|
genesetsUI: state.genesetsUI,
|
||||||
|
colorAccessor: state.colors.colorAccessor,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
class GenesetMenus extends React.PureComponent {
|
class GenesetMenus extends React.PureComponent {
|
||||||
@@ -43,19 +46,41 @@ class GenesetMenus extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleColorByEntireGeneset = () => {
|
||||||
|
const { dispatch, geneset } = this.props;
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: "color by geneset mean expression",
|
||||||
|
geneset,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
handleDeleteCategory = () => {
|
handleDeleteCategory = () => {
|
||||||
const { dispatch, geneset } = this.props;
|
const { dispatch, geneset } = this.props;
|
||||||
dispatch(actions.genesetDelete(geneset));
|
dispatch(actions.genesetDelete(geneset));
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { geneset, genesetsEditable, createText } = this.props;
|
const {
|
||||||
|
geneset,
|
||||||
|
genesetsEditable,
|
||||||
|
createText,
|
||||||
|
colorAccessor,
|
||||||
|
isOpen,
|
||||||
|
toggleSummaryHisto,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const isColorBy = geneset === colorAccessor;
|
||||||
|
const genesetClosed = !isOpen;
|
||||||
|
const showingAllGenes = !toggleSummaryHisto;
|
||||||
|
|
||||||
|
const notShowingSummary = genesetClosed || showingAllGenes;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{genesetsEditable ? (
|
{genesetsEditable ? (
|
||||||
<>
|
<>
|
||||||
<Tooltip
|
<Tooltip2
|
||||||
content={createText}
|
content={createText}
|
||||||
position={Position.BOTTOM}
|
position={Position.BOTTOM}
|
||||||
hoverOpenDelay={globals.tooltipHoverOpenDelay}
|
hoverOpenDelay={globals.tooltipHoverOpenDelay}
|
||||||
@@ -69,7 +94,7 @@ class GenesetMenus extends React.PureComponent {
|
|||||||
small
|
small
|
||||||
minimal
|
minimal
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip2>
|
||||||
<AddGeneToGenesetDialogue geneset={geneset} />
|
<AddGeneToGenesetDialogue geneset={geneset} />
|
||||||
<Popover
|
<Popover
|
||||||
interactionKind={PopoverInteractionKind.HOVER}
|
interactionKind={PopoverInteractionKind.HOVER}
|
||||||
@@ -104,13 +129,22 @@ class GenesetMenus extends React.PureComponent {
|
|||||||
minimal
|
minimal
|
||||||
/>
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
<Button
|
<Tooltip2
|
||||||
disabled
|
content={`Color by gene set ${geneset} mean (gene set must be open, and toggled to mean expression histogram)`}
|
||||||
style={{ marginLeft: 0 }}
|
position={Position.BOTTOM}
|
||||||
data-testclass="colorby-entire-geneset"
|
hoverOpenDelay={globals.tooltipHoverOpenDelay}
|
||||||
data-testid={`${geneset}:colorby-entire-geneset`}
|
>
|
||||||
icon={<Icon icon="tint" iconSize={16} />}
|
<AnchorButton
|
||||||
/>
|
disabled={notShowingSummary && !isColorBy}
|
||||||
|
active={isColorBy}
|
||||||
|
intent={isColorBy ? "primary" : "none"}
|
||||||
|
style={{ marginLeft: 0 }}
|
||||||
|
onClick={this.handleColorByEntireGeneset}
|
||||||
|
data-testclass="colorby-entire-geneset"
|
||||||
|
data-testid={`${geneset}:colorby-entire-geneset`}
|
||||||
|
icon={<Icon icon="tint" iconSize={16} />}
|
||||||
|
/>
|
||||||
|
</Tooltip2>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ Color By UI state
|
|||||||
|
|
||||||
const ColorsReducer = (
|
const ColorsReducer = (
|
||||||
state = {
|
state = {
|
||||||
colorMode: null,
|
colorMode: null /* by continuous, by expression */,
|
||||||
colorAccessor: null,
|
colorAccessor: null /* tissue, Apod */,
|
||||||
},
|
},
|
||||||
action,
|
action,
|
||||||
nextSharedState,
|
nextSharedState,
|
||||||
@@ -96,6 +96,21 @@ const ColorsReducer = (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "color by geneset mean expression": {
|
||||||
|
/* toggle between this mode and reset */
|
||||||
|
const resetCurrent =
|
||||||
|
action.type === state.colorMode &&
|
||||||
|
action.geneset === state.colorAccessor;
|
||||||
|
const colorMode = !resetCurrent ? action.type : null;
|
||||||
|
const colorAccessor = !resetCurrent ? action.geneset : null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
colorMode,
|
||||||
|
colorAccessor,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user