mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-03 19:08:11 +08:00
Merge branch 'visium-beta' of github.com:chanzuckerberg/cellxgene into visium-beta
This commit is contained in:
@@ -16,10 +16,11 @@ import actions from "../../actions";
|
|||||||
import { getDiscreteCellEmbeddingRowIndex } from "../../util/stateManager/viewStackHelpers";
|
import { getDiscreteCellEmbeddingRowIndex } from "../../util/stateManager/viewStackHelpers";
|
||||||
|
|
||||||
@connect((state) => ({
|
@connect((state) => ({
|
||||||
layoutChoice: state.layoutChoice, // TODO: really should clean up naming, s/layout/embedding/g
|
imageUnderlay: state.imageUnderlay,
|
||||||
schema: state.annoMatrix?.schema,
|
layoutChoice: state.layoutChoice, // TODO: really should clean up naming, s/layout/embedding/g
|
||||||
crossfilter: state.obsCrossfilter,
|
schema: state.annoMatrix?.schema,
|
||||||
}))
|
crossfilter: state.obsCrossfilter,
|
||||||
|
}))
|
||||||
class Embedding extends React.PureComponent {
|
class Embedding extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -27,8 +28,18 @@ class Embedding extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleLayoutChoiceChange = (e) => {
|
handleLayoutChoiceChange = (e) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, imageUnderlay } = this.props;
|
||||||
dispatch(actions.layoutChoiceAction(e.currentTarget.value));
|
dispatch(actions.layoutChoiceAction(e.currentTarget.value));
|
||||||
|
|
||||||
|
// if we just switched off spatial, if the image is on, turn it off
|
||||||
|
if (
|
||||||
|
imageUnderlay.isActive &&
|
||||||
|
e.target.value !== globals.spatialEmbeddingKeyword
|
||||||
|
) {
|
||||||
|
dispatch({
|
||||||
|
type: "toggle image underlay",
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import { getEmbSubsetView } from "../../util/stateManager/viewStackHelpers";
|
|||||||
subsetPossible,
|
subsetPossible,
|
||||||
subsetResetPossible,
|
subsetResetPossible,
|
||||||
graphInteractionMode: state.controls.graphInteractionMode,
|
graphInteractionMode: state.controls.graphInteractionMode,
|
||||||
|
imageUnderlay: state.imageUnderlay,
|
||||||
|
layoutChoice: state.layoutChoice, // TODO: really should clean up naming, s/layout/embedding/g
|
||||||
clipPercentileMin: Math.round(100 * (annoMatrix?.clipRange?.[0] ?? 0)),
|
clipPercentileMin: Math.round(100 * (annoMatrix?.clipRange?.[0] ?? 0)),
|
||||||
clipPercentileMax: Math.round(100 * (annoMatrix?.clipRange?.[1] ?? 1)),
|
clipPercentileMax: Math.round(100 * (annoMatrix?.clipRange?.[1] ?? 1)),
|
||||||
userDefinedGenes: state.controls.userDefinedGenes,
|
userDefinedGenes: state.controls.userDefinedGenes,
|
||||||
@@ -206,6 +208,8 @@ class MenuBar extends React.PureComponent {
|
|||||||
colorAccessor,
|
colorAccessor,
|
||||||
subsetPossible,
|
subsetPossible,
|
||||||
subsetResetPossible,
|
subsetResetPossible,
|
||||||
|
imageUnderlay,
|
||||||
|
layoutChoice,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { pendingClipPercentiles } = this.state;
|
const { pendingClipPercentiles } = this.state;
|
||||||
|
|
||||||
@@ -268,6 +272,29 @@ class MenuBar extends React.PureComponent {
|
|||||||
disabled={!isColoredByCategorical}
|
disabled={!isColoredByCategorical}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
{layoutChoice?.available?.includes(globals.spatialEmbeddingKeyword) && (
|
||||||
|
<ButtonGroup className={styles.menubarButton}>
|
||||||
|
<Tooltip
|
||||||
|
content={"Toggle image"}
|
||||||
|
position="bottom"
|
||||||
|
hoverOpenDelay={globals.tooltipHoverOpenDelay}
|
||||||
|
>
|
||||||
|
<AnchorButton
|
||||||
|
type="button"
|
||||||
|
data-testid="toggle-image-underlay"
|
||||||
|
icon={"media"}
|
||||||
|
intent={imageUnderlay.isActive ? "primary" : "none"}
|
||||||
|
active={imageUnderlay.isActive}
|
||||||
|
onClick={() => {
|
||||||
|
dispatch({
|
||||||
|
type: "toggle image underlay",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</ButtonGroup>
|
||||||
|
)}
|
||||||
|
|
||||||
<ButtonGroup className={styles.menubarButton}>
|
<ButtonGroup className={styles.menubarButton}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={selectionTooltip}
|
content={selectionTooltip}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import { Colors } from "@blueprintjs/core";
|
|||||||
import { dispatchNetworkErrorMessageToUser } from "./util/actionHelpers";
|
import { dispatchNetworkErrorMessageToUser } from "./util/actionHelpers";
|
||||||
import ENV_DEFAULT from "../../environment.default.json";
|
import ENV_DEFAULT from "../../environment.default.json";
|
||||||
|
|
||||||
|
// visium embedding word, spatial image underlay
|
||||||
|
export const spatialEmbeddingKeyword = "spatial";
|
||||||
|
|
||||||
/* overflow category values are created using this string */
|
/* overflow category values are created using this string */
|
||||||
export const overflowCategoryLabel = ": all other labels";
|
export const overflowCategoryLabel = ": all other labels";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const imageUnderlay = (state = { isActive: false }, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case "toggle image underlay":
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
isActive: !state.isActive,
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default imageUnderlay;
|
||||||
@@ -20,6 +20,7 @@ import genesetsUI from "./genesetsUI";
|
|||||||
import autosave from "./autosave";
|
import autosave from "./autosave";
|
||||||
import centroidLabels from "./centroidLabels";
|
import centroidLabels from "./centroidLabels";
|
||||||
import pointDialation from "./pointDilation";
|
import pointDialation from "./pointDilation";
|
||||||
|
import imageUnderlay from "./imageUnderlay";
|
||||||
import { gcMiddleware as annoMatrixGC } from "../annoMatrix";
|
import { gcMiddleware as annoMatrixGC } from "../annoMatrix";
|
||||||
|
|
||||||
import undoableConfig from "./undoableConfig";
|
import undoableConfig from "./undoableConfig";
|
||||||
@@ -41,6 +42,7 @@ const Reducer = undoable(
|
|||||||
["differential", differential],
|
["differential", differential],
|
||||||
["spatial", spatial],
|
["spatial", spatial],
|
||||||
["centroidLabels", centroidLabels],
|
["centroidLabels", centroidLabels],
|
||||||
|
["imageUnderlay", imageUnderlay],
|
||||||
["pointDilation", pointDialation],
|
["pointDilation", pointDialation],
|
||||||
["autosave", autosave],
|
["autosave", autosave],
|
||||||
]),
|
]),
|
||||||
|
|||||||
Reference in New Issue
Block a user