set row and column

This commit is contained in:
Colin Megill
2021-07-23 13:29:27 -07:00
parent bb5bbaac8a
commit e21cac65bf
6 changed files with 53 additions and 13 deletions
@@ -45,6 +45,7 @@ const LABEL_WIDTH_ANNO = LABEL_WIDTH - ANNO_BUTTON_WIDTH;
crossfilter: state.obsCrossfilter, crossfilter: state.obsCrossfilter,
isUserAnno, isUserAnno,
genesets: state.genesets.genesets, genesets: state.genesets.genesets,
dotplot: state.layoutChoice.dotplot,
}; };
}) })
class Category extends React.PureComponent { class Category extends React.PureComponent {
@@ -83,11 +84,19 @@ class Category extends React.PureComponent {
} }
handleColorChange = () => { handleColorChange = () => {
const { dispatch, metadataField } = this.props; const { dispatch, metadataField, dotplot } = this.props;
dispatch({
type: "color by categorical metadata", if (dotplot) {
colorAccessor: metadataField, dispatch({
}); type: "set dotplot row",
data: metadataField,
});
} else {
dispatch({
type: "color by categorical metadata",
colorAccessor: metadataField,
});
}
}; };
handleCategoryClick = () => { handleCategoryClick = () => {
@@ -220,6 +229,7 @@ class Category extends React.PureComponent {
colors, colors,
annoMatrix, annoMatrix,
isUserAnno, isUserAnno,
dotplot,
} = this.props; } = this.props;
const checkboxID = `category-select-${metadataField}`; const checkboxID = `category-select-${metadataField}`;
@@ -278,6 +288,7 @@ class Category extends React.PureComponent {
onCategoryToggleAllClick={handleCategoryToggleAllClick} onCategoryToggleAllClick={handleCategoryToggleAllClick}
onCategoryMenuClick={this.handleCategoryClick} onCategoryMenuClick={this.handleCategoryClick}
onCategoryMenuKeyPress={this.handleCategoryKeyPress} onCategoryMenuKeyPress={this.handleCategoryKeyPress}
dotplot={dotplot}
/> />
); );
}} }}
@@ -372,6 +383,7 @@ const CategoryHeader = React.memo(
onCategoryMenuClick, onCategoryMenuClick,
onCategoryMenuKeyPress, onCategoryMenuKeyPress,
onCategoryToggleAllClick, onCategoryToggleAllClick,
dotplot,
}) => { }) => {
/* /*
Render category name and controls (eg, color-by button). Render category name and controls (eg, color-by button).
@@ -473,7 +485,7 @@ const CategoryHeader = React.memo(
active={isColorAccessor} active={isColorAccessor}
intent={isColorAccessor ? "primary" : "none"} intent={isColorAccessor ? "primary" : "none"}
disabled={isTruncated} disabled={isTruncated}
icon="tint" icon={dotplot ? "layout-grid" : "tint"}
/> />
</Tooltip> </Tooltip>
</div> </div>
@@ -500,6 +512,7 @@ const CategoryRender = React.memo(
onCategoryMenuClick, onCategoryMenuClick,
onCategoryMenuKeyPress, onCategoryMenuKeyPress,
onCategoryToggleAllClick, onCategoryToggleAllClick,
dotplot,
}) => { }) => {
/* /*
Render the core of the category, including checkboxes, controls, etc. Render the core of the category, including checkboxes, controls, etc.
@@ -544,6 +557,7 @@ const CategoryRender = React.memo(
onCategoryToggleAllClick={onCategoryToggleAllClick} onCategoryToggleAllClick={onCategoryToggleAllClick}
onCategoryMenuClick={onCategoryMenuClick} onCategoryMenuClick={onCategoryMenuClick}
onCategoryMenuKeyPress={onCategoryMenuKeyPress} onCategoryMenuKeyPress={onCategoryMenuKeyPress}
dotplot={dotplot}
/> />
</div> </div>
<div style={{ marginLeft: 26 }}> <div style={{ marginLeft: 26 }}>
+1
View File
@@ -21,6 +21,7 @@ import {
genesets: state.genesets.genesets, genesets: state.genesets.genesets,
pointDilation: state.pointDilation, pointDilation: state.pointDilation,
differential: state.differential, differential: state.differential,
dotplot: state.dotplot,
})) }))
class Column extends React.Component { class Column extends React.Component {
static watchAsync(props, prevProps) { static watchAsync(props, prevProps) {
@@ -21,6 +21,7 @@ import AddGeneToGenesetDialogue from "./addGeneToGenesetDialogue";
return { return {
genesetsUI: state.genesetsUI, genesetsUI: state.genesetsUI,
colorAccessor: state.colors.colorAccessor, colorAccessor: state.colors.colorAccessor,
dotplot: state.layoutChoice.dotplot,
}; };
}) })
class GenesetMenus extends React.PureComponent { class GenesetMenus extends React.PureComponent {
@@ -47,12 +48,19 @@ class GenesetMenus extends React.PureComponent {
}; };
handleColorByEntireGeneset = () => { handleColorByEntireGeneset = () => {
const { dispatch, geneset } = this.props; const { dispatch, geneset, dotplot } = this.props;
dispatch({ if (dotplot) {
type: "color by geneset mean expression", dispatch({
geneset, type: "set dotplot column",
}); data: geneset,
});
} else {
dispatch({
type: "color by geneset mean expression",
geneset,
});
}
}; };
handleDeleteGeneset = () => { handleDeleteGeneset = () => {
@@ -61,7 +69,13 @@ class GenesetMenus extends React.PureComponent {
}; };
render() { render() {
const { geneset, genesetsEditable, createText, colorAccessor } = this.props; const {
geneset,
genesetsEditable,
createText,
colorAccessor,
dotplot,
} = this.props;
const isColorBy = geneset === colorAccessor; const isColorBy = geneset === colorAccessor;
@@ -130,7 +144,9 @@ class GenesetMenus extends React.PureComponent {
onClick={this.handleColorByEntireGeneset} onClick={this.handleColorByEntireGeneset}
data-testclass="colorby-entire-geneset" data-testclass="colorby-entire-geneset"
data-testid={`${geneset}:colorby-entire-geneset`} data-testid={`${geneset}:colorby-entire-geneset`}
icon={<Icon icon="tint" iconSize={16} />} icon={
<Icon icon={dotplot ? "layout-grid" : "tint"} iconSize={16} />
}
/> />
</Tooltip2> </Tooltip2>
</> </>
+3
View File
@@ -7,11 +7,14 @@ const Dotplot = (
) => { ) => {
switch (action.type) { switch (action.type) {
case "set dotplot row": case "set dotplot row":
console.log("in dotplot reducer row is", action.data);
return { return {
...state, ...state,
row: action.data, row: action.data,
}; };
case "set dotplot column": case "set dotplot column":
console.log("in dotplot reducer COLUMN is", action.data);
return { return {
...state, ...state,
column: action.data, column: action.data,
+2
View File
@@ -17,6 +17,7 @@ import controls from "./controls";
import annotations from "./annotations"; import annotations from "./annotations";
import genesets from "./genesets"; import genesets from "./genesets";
import genesetsUI from "./genesetsUI"; import genesetsUI from "./genesetsUI";
import dotplot from "./dotplot";
import autosave from "./autosave"; import autosave from "./autosave";
import centroidLabels from "./centroidLabels"; import centroidLabels from "./centroidLabels";
import pointDialation from "./pointDilation"; import pointDialation from "./pointDilation";
@@ -32,6 +33,7 @@ const Reducer = undoable(
["annotations", annotations], ["annotations", annotations],
["genesets", genesets], ["genesets", genesets],
["genesetsUI", genesetsUI], ["genesetsUI", genesetsUI],
["dotplot", dotplot],
["layoutChoice", layoutChoice], ["layoutChoice", layoutChoice],
["categoricalSelection", categoricalSelection], ["categoricalSelection", categoricalSelection],
["continuousSelection", continuousSelection], ["continuousSelection", continuousSelection],
+4
View File
@@ -82,6 +82,10 @@ const saveOnActions = new Set([
"color by expression", "color by expression",
"color by geneset mean expression", "color by geneset mean expression",
"set dotplot row",
"set dotplot column",
"toggle dotplot",
"show centroid labels for category", "show centroid labels for category",
"set scatterplot x", "set scatterplot x",