mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-03 10:48:12 +08:00
feat(geneset): save diff exp result as geneset (#2216)
* update package lock * allow falsey vals * remove old diff exp handling * save diff exp results as geneset * delete test * check for undefined or null * use global geneset description for diffexp * remove diffexp special code, no longer showing adjpval + logfoldchange * remove differential map to state * remove clear from FSM, since we no longer support those actions * restore controlHelpers test with todo
This commit is contained in:
@@ -7,9 +7,7 @@ const ColorsReducer = (
|
||||
colorMode: null /* by continuous, by expression */,
|
||||
colorAccessor: null /* tissue, Apod */,
|
||||
},
|
||||
action,
|
||||
nextSharedState,
|
||||
prevSharedState
|
||||
action
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case "universe: user color load success": {
|
||||
@@ -20,19 +18,6 @@ const ColorsReducer = (
|
||||
};
|
||||
}
|
||||
|
||||
case "clear differential expression":
|
||||
case "set clip quantiles":
|
||||
case "subset to selection": {
|
||||
const { controls: prevControls } = prevSharedState;
|
||||
if (prevControls.diffexpGenes.includes(state.colorAccessor)) {
|
||||
return {
|
||||
colorMode: null,
|
||||
colorAccessor: null,
|
||||
};
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
case "annotation: category edited": {
|
||||
const { colorAccessor } = state;
|
||||
if (action.metadataField !== colorAccessor) {
|
||||
|
||||
Vendored
-25
@@ -1,6 +1,5 @@
|
||||
import uniq from "lodash.uniq";
|
||||
import filter from "lodash.filter";
|
||||
import { subsetAndResetGeneLists } from "../util/stateManager/controlsHelpers";
|
||||
|
||||
const Controls = (
|
||||
state = {
|
||||
@@ -11,7 +10,6 @@ const Controls = (
|
||||
// all of the data + selection state
|
||||
userDefinedGenes: [],
|
||||
userDefinedGenesLoading: false,
|
||||
diffexpGenes: [],
|
||||
|
||||
resettingInterface: false,
|
||||
graphInteractionMode: "select",
|
||||
@@ -45,26 +43,16 @@ const Controls = (
|
||||
};
|
||||
}
|
||||
case "reset subset": {
|
||||
const [newUserDefinedGenes, newDiffExpGenes] = subsetAndResetGeneLists(
|
||||
state
|
||||
);
|
||||
return {
|
||||
...state,
|
||||
resettingInterface: false,
|
||||
userDefinedGenes: newUserDefinedGenes,
|
||||
diffexpGenes: newDiffExpGenes,
|
||||
};
|
||||
}
|
||||
case "subset to selection": {
|
||||
const [newUserDefinedGenes, newDiffExpGenes] = subsetAndResetGeneLists(
|
||||
state
|
||||
);
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
error: null,
|
||||
userDefinedGenes: newUserDefinedGenes,
|
||||
diffexpGenes: newDiffExpGenes,
|
||||
};
|
||||
}
|
||||
case "request user defined gene started": {
|
||||
@@ -90,19 +78,6 @@ const Controls = (
|
||||
userDefinedGenesLoading: false,
|
||||
};
|
||||
}
|
||||
case "request differential expression success": {
|
||||
const diffexpGenes = action.data.map((v) => v[0]);
|
||||
return {
|
||||
...state,
|
||||
diffexpGenes,
|
||||
};
|
||||
}
|
||||
case "clear differential expression": {
|
||||
return {
|
||||
...state,
|
||||
diffexpGenes: [],
|
||||
};
|
||||
}
|
||||
case "clear user defined gene": {
|
||||
const { userDefinedGenes } = state;
|
||||
const newUserDefinedGenes = filter(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const Differential = (
|
||||
state = {
|
||||
diffExp: null,
|
||||
loading: null,
|
||||
error: null,
|
||||
celllist1: null,
|
||||
@@ -20,7 +19,6 @@ const Differential = (
|
||||
...state,
|
||||
error: null,
|
||||
loading: false,
|
||||
diffExp: action.data,
|
||||
};
|
||||
case "request differential expression error":
|
||||
return {
|
||||
@@ -38,18 +36,10 @@ const Differential = (
|
||||
...state,
|
||||
celllist2: action.data,
|
||||
};
|
||||
case "clear differential expression":
|
||||
return {
|
||||
...state,
|
||||
diffExp: null,
|
||||
celllist1: null,
|
||||
celllist2: null,
|
||||
};
|
||||
case "reset subset":
|
||||
case "subset to selection":
|
||||
return {
|
||||
...state,
|
||||
diffExp: null,
|
||||
celllist1: null,
|
||||
celllist2: null,
|
||||
};
|
||||
|
||||
@@ -69,6 +69,7 @@ const GeneSets = (
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
initialized: true,
|
||||
lastTid,
|
||||
genesets,
|
||||
@@ -353,6 +354,33 @@ const GeneSets = (
|
||||
};
|
||||
}
|
||||
|
||||
case "request differential expression success": {
|
||||
const { data } = action;
|
||||
|
||||
const genes = new Map(
|
||||
data.map((diffExpGene) => [
|
||||
diffExpGene[0],
|
||||
{
|
||||
geneSymbol: diffExpGene[0],
|
||||
},
|
||||
])
|
||||
);
|
||||
|
||||
const genesetName = `DiffExp Set (${new Date().toLocaleString()})`;
|
||||
|
||||
const genesets = new Map(state.genesets); // clone
|
||||
genesets.set(genesetName, {
|
||||
genesetName,
|
||||
genesetDescription: "",
|
||||
genes,
|
||||
});
|
||||
|
||||
return {
|
||||
...state,
|
||||
genesets,
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -185,20 +185,6 @@ const createFsmTransitions = (
|
||||
action: applyPending,
|
||||
},
|
||||
|
||||
/* Clear Differential Expression button user action */
|
||||
{
|
||||
event: "clear differential expression",
|
||||
from: "init",
|
||||
to: "CDE Button in progress",
|
||||
action: stashPending,
|
||||
},
|
||||
{
|
||||
event: "clear scatterplot",
|
||||
from: "CDE Button in progress",
|
||||
to: "done",
|
||||
action: applyPending,
|
||||
},
|
||||
|
||||
/* clear scatter plot button (eg, on scatterplot view) */
|
||||
{
|
||||
event: "clear scatterplot",
|
||||
|
||||
Reference in New Issue
Block a user