run prettier(2.0.5) (#1438)

This commit is contained in:
Severiano Badajoz
2020-05-04 10:26:42 -07:00
committed by GitHub
parent b255e32548
commit 6cccc41c0f
118 changed files with 1979 additions and 1584 deletions
+10 -10
View File
@@ -25,7 +25,7 @@ const Annotations = (
isEditingLabelName: false,
categoryBeingEdited: null,
categoryAddingNewLabel: null,
labelEditable: { category: null, label: null }
labelEditable: { category: null, label: null },
},
action
) => {
@@ -40,7 +40,7 @@ const Annotations = (
return {
...state,
dataCollectionNameIsReadOnly,
dataCollectionName
dataCollectionName,
};
}
@@ -50,7 +50,7 @@ const Annotations = (
}
return {
...state,
dataCollectionName: action.data
dataCollectionName: action.data,
};
}
@@ -59,7 +59,7 @@ const Annotations = (
return {
...state,
isAddingNewLabel: true,
categoryAddingNewLabel: action.data
categoryAddingNewLabel: action.data,
};
}
@@ -67,7 +67,7 @@ const Annotations = (
return {
...state,
isAddingNewLabel: false,
categoryAddingNewLabel: null
categoryAddingNewLabel: null,
};
}
@@ -75,7 +75,7 @@ const Annotations = (
return {
...state,
isEditingCategoryName: true,
categoryBeingEdited: action.data
categoryBeingEdited: action.data,
};
}
@@ -83,7 +83,7 @@ const Annotations = (
return {
...state,
isEditingCategoryName: false,
categoryBeingEdited: null
categoryBeingEdited: null,
};
}
@@ -94,8 +94,8 @@ const Annotations = (
isEditingLabelName: true,
labelEditable: {
category: action.metadataField,
label: action.categoryIndex
}
label: action.categoryIndex,
},
};
}
@@ -103,7 +103,7 @@ const Annotations = (
return {
...state,
isEditingLabelName: false,
labelEditable: { category: null, label: null }
labelEditable: { category: null, label: null },
};
}
+46 -46
View File
@@ -1,55 +1,55 @@
const Autosave = (
state = {
saveInProgress: false,
error: false,
lastSavedObsAnnotations: null,
initialDataLoadComplete: false
},
action,
nextSharedState
state = {
saveInProgress: false,
error: false,
lastSavedObsAnnotations: null,
initialDataLoadComplete: false,
},
action,
nextSharedState
) => {
switch (action.type) {
case "initial data load complete (universe exists)": {
/* don't save on init */
const { universe } = nextSharedState;
return {
...state,
error: false,
saveInProgress: false,
lastSavedObsAnnotations: universe.obsAnnotations,
initialDataLoadComplete: true,
};
}
switch (action.type) {
case "initial data load complete (universe exists)": {
/* don't save on init */
const { universe } = nextSharedState;
return {
...state,
error: false,
saveInProgress: false,
lastSavedObsAnnotations: universe.obsAnnotations,
initialDataLoadComplete: true,
};
}
case "writable obs annotations - save started": {
return {
...state,
saveInProgress: true
};
}
case "writable obs annotations - save started": {
return {
...state,
saveInProgress: true,
};
}
case "writable obs annotations - save error": {
const { message } = action;
return {
...state,
error: message,
saveInProgress: false
};
}
case "writable obs annotations - save error": {
const { message } = action;
return {
...state,
error: message,
saveInProgress: false,
};
}
case "writable obs annotations - save complete": {
const lastSavedObsAnnotations = action.obsAnnotations;
return {
...state,
saveInProgress: false,
error: false,
lastSavedObsAnnotations
};
}
case "writable obs annotations - save complete": {
const lastSavedObsAnnotations = action.obsAnnotations;
return {
...state,
saveInProgress: false,
error: false,
lastSavedObsAnnotations,
};
}
default:
return { ...state };
}
default:
return { ...state };
}
};
export default Autosave;
+11 -11
View File
@@ -36,7 +36,7 @@ const CategoricalSelection = (
if (names.length === 0) return state;
return {
...state,
...CH.createCategoricalSelection(world, names)
...CH.createCategoricalSelection(world, names),
};
}
@@ -52,8 +52,8 @@ const CategoricalSelection = (
...state,
[action.metadataField]: {
...state[action.metadataField],
categoryValueSelected: newCategoryValueSelected
}
categoryValueSelected: newCategoryValueSelected,
},
};
return newCategoricalSelection;
}
@@ -70,8 +70,8 @@ const CategoricalSelection = (
...state,
[action.metadataField]: {
...state[action.metadataField],
categoryValueSelected: newCategoryValueSelected
}
categoryValueSelected: newCategoryValueSelected,
},
};
return newCategoricalSelection;
}
@@ -87,8 +87,8 @@ const CategoricalSelection = (
categorySelected: false,
categoryValueSelected: Array.from(
state[action.metadataField].categoryValueSelected
).fill(false)
}
).fill(false),
},
};
return newCategoricalSelection;
}
@@ -104,8 +104,8 @@ const CategoricalSelection = (
categorySelected: true,
categoryValueSelected: Array.from(
state[action.metadataField].categoryValueSelected
).fill(true)
}
).fill(true),
},
};
return newCategoricalSelection;
}
@@ -115,7 +115,7 @@ const CategoricalSelection = (
const name = action.data;
return {
...state,
...CH.createCategoricalSelection(world, [name])
...CH.createCategoricalSelection(world, [name]),
};
}
@@ -143,7 +143,7 @@ const CategoricalSelection = (
const { [name]: _, ...partialState } = state;
return {
...partialState,
...CH.createCategoricalSelection(world, [name])
...CH.createCategoricalSelection(world, [name]),
};
}
+5 -5
View File
@@ -2,7 +2,7 @@ import calcCentroid from "../util/centroid";
const initialState = {
labels: [],
showLabels: false
showLabels: false,
};
const centroidLabels = (state = initialState, action, sharedNextState) => {
@@ -10,7 +10,7 @@ const centroidLabels = (state = initialState, action, sharedNextState) => {
world,
layoutChoice,
categoricalSelection,
colors: { colorAccessor }
colors: { colorAccessor },
} = sharedNextState;
const showLabels = action.showLabels ?? state.showLabels;
@@ -34,7 +34,7 @@ const centroidLabels = (state = initialState, action, sharedNextState) => {
categoricalSelection,
world.schema.annotations.obsByName
)
: []
: [],
};
case "color by categorical metadata":
@@ -45,7 +45,7 @@ const centroidLabels = (state = initialState, action, sharedNextState) => {
return {
...state,
labels: [],
showLabels
showLabels,
};
}
@@ -59,7 +59,7 @@ const centroidLabels = (state = initialState, action, sharedNextState) => {
categoricalSelection,
world.schema.annotations.obsByName
),
showLabels
showLabels,
};
case "color by continuous metadata":
+20 -11
View File
@@ -5,7 +5,7 @@ const ColorsReducer = (
colorMode: null,
colorAccessor: null,
rgb: null,
scale: null
scale: null,
},
action,
nextSharedState,
@@ -23,7 +23,7 @@ const ColorsReducer = (
colorAccessor,
colorMode,
rgb,
scale
scale,
};
}
@@ -31,7 +31,7 @@ const ColorsReducer = (
const { userColors } = action;
return {
...state,
userColors
userColors,
};
}
@@ -47,7 +47,7 @@ const ColorsReducer = (
return {
...state,
rgb,
scale
scale,
};
}
@@ -73,7 +73,7 @@ const ColorsReducer = (
return {
...state,
rgb,
scale
scale,
};
}
@@ -85,14 +85,14 @@ const ColorsReducer = (
/* else reset */
return {
...state,
...ColorHelpers.resetColors(prevSharedState.world)
...ColorHelpers.resetColors(prevSharedState.world),
};
}
case "reset colorscale": {
return {
...state,
...ColorHelpers.resetColors(prevSharedState.world)
...ColorHelpers.resetColors(prevSharedState.world),
};
}
@@ -107,13 +107,18 @@ const ColorsReducer = (
const colorMode = !resetCurrent ? action.type : null;
const colorAccessor = !resetCurrent ? action.colorAccessor : null;
const { rgb, scale } = ColorHelpers.createColors(world, colorMode, colorAccessor, colors.userColors);
const { rgb, scale } = ColorHelpers.createColors(
world,
colorMode,
colorAccessor,
colors.userColors
);
return {
...state,
colorMode,
colorAccessor,
rgb,
scale
scale,
};
}
@@ -136,7 +141,7 @@ const ColorsReducer = (
colorMode,
colorAccessor,
rgb,
scale
scale,
};
}
@@ -153,7 +158,11 @@ const ColorsReducer = (
return state;
/* else, we need to rebuild colors as labels have changed! */
const { rgb, scale } = ColorHelpers.createColors(world, colorMode, colorAccessor);
const { rgb, scale } = ColorHelpers.createColors(
world,
colorMode,
colorAccessor
);
return { ...state, rgb, scale };
}
+4 -4
View File
@@ -3,7 +3,7 @@ const Config = (
state = {
displayNames: null,
features: null,
parameters: null
parameters: null,
},
action
) => {
@@ -12,19 +12,19 @@ const Config = (
return {
...state,
loading: true,
error: null
error: null,
};
case "configuration load complete":
return {
...state,
loading: false,
error: null,
...action.config
...action.config,
};
case "initial data load error":
return {
...state,
error: action.error
error: action.error,
};
default:
return state;
+8 -8
View File
@@ -6,7 +6,7 @@ const Differential = (
loading: null,
error: null,
celllist1: null,
celllist2: null
celllist2: null,
},
action
) => {
@@ -15,37 +15,37 @@ const Differential = (
return {
...state,
loading: true,
error: null
error: null,
};
case "request differential expression success":
return {
...state,
error: null,
loading: false,
diffExp: action.data
diffExp: action.data,
};
case "request differential expression error":
return {
...state,
loading: false,
error: action.data
error: action.data,
};
case "store current cell selection as differential set 1":
return {
...state,
celllist1: action.data
celllist1: action.data,
};
case "store current cell selection as differential set 2":
return {
...state,
celllist2: action.data
celllist2: action.data,
};
case "clear differential expression":
return {
...state,
diffExp: null,
celllist1: null,
celllist2: null
celllist2: null,
};
case "reset World to eq Universe":
case "set World to current selection":
@@ -53,7 +53,7 @@ const Differential = (
...state,
diffExp: null,
celllist1: null,
celllist2: null
celllist2: null,
};
default:
return state;
+9 -9
View File
@@ -1,7 +1,7 @@
const GraphSelection = (
state = {
tool: "lasso", // what selection tool mode (lasso, brush, ...)
selection: { mode: "all" } // current selection, which is tool specific
selection: { mode: "all" }, // current selection, which is tool specific
},
action
) => {
@@ -12,8 +12,8 @@ const GraphSelection = (
return {
...state,
selection: {
mode: "all"
}
mode: "all",
},
};
}
@@ -24,8 +24,8 @@ const GraphSelection = (
...state,
selection: {
mode: "within-rect",
brushCoords
}
brushCoords,
},
};
}
@@ -35,8 +35,8 @@ const GraphSelection = (
...state,
selection: {
mode: "within-polygon",
polygon
}
polygon,
},
};
}
@@ -47,8 +47,8 @@ const GraphSelection = (
return {
...state,
selection: {
mode: "all"
}
mode: "all",
},
};
}
+7 -7
View File
@@ -9,14 +9,14 @@ about commonly used names. Preferentially, pick in the following order:
*/
function bestDefaultLayout(layouts) {
const preferredNames = ["umap", "tsne", "pca"];
const idx = preferredNames.findIndex(name => layouts.indexOf(name) !== -1);
const idx = preferredNames.findIndex((name) => layouts.indexOf(name) !== -1);
if (idx !== -1) return preferredNames[idx];
return layouts[0];
}
function setToDefaultLayout(world) {
const { schema } = world;
const available = schema.layout.obs.map(v => v.name).sort();
const available = schema.layout.obs.map((v) => v.name).sort();
const current = bestDefaultLayout(available);
const currentDimNames = schema.layout.obsByName[current].dims;
return { available, current, currentDimNames };
@@ -26,7 +26,7 @@ const LayoutChoice = (
state = {
available: [], // all available choices
current: undefined, // name of the current layout, eg, 'umap'
currentDimNames: [] // dimension name
currentDimNames: [], // dimension name
},
action,
nextSharedState
@@ -37,7 +37,7 @@ const LayoutChoice = (
const { universe } = nextSharedState;
return {
...state,
...setToDefaultLayout(universe)
...setToDefaultLayout(universe),
};
}
@@ -53,7 +53,7 @@ const LayoutChoice = (
const available = Array.from(new Set(state.available).add(name));
return {
...state,
available
available,
};
}
@@ -64,12 +64,12 @@ const LayoutChoice = (
if (dflt.available.includes(current)) {
return {
...state,
available: dflt.available
available: dflt.available,
};
}
return {
...state,
...dflt
...dflt,
};
}
+2 -2
View File
@@ -3,7 +3,7 @@ const Ontology = (
enabled: false, // are ontology terms enabled?
terms: null, // an array of term names, eg, ['cell', 'lung cell', ...]
termSet: null, // a Set object containing all terms, for fast lookup
loading: true
loading: true,
},
action
) => {
@@ -20,7 +20,7 @@ const Ontology = (
loading: false,
enabled,
terms,
termSet
termSet,
};
}
default: {
+2 -2
View File
@@ -1,6 +1,6 @@
const initialState = {
metadataField: "",
categoryField: ""
categoryField: "",
};
const pointDialation = (state = initialState, action, sharedNextState) => {
@@ -15,7 +15,7 @@ const pointDialation = (state = initialState, action, sharedNextState) => {
return {
...state,
metadataField,
categoryField
categoryField,
};
case "category value mouse hover end":
+7 -7
View File
@@ -3,7 +3,7 @@ controller state is not part of the undo/redo history
*/
export const reembedController = (
state = {
pendingFetch: null
pendingFetch: null,
},
action
) => {
@@ -11,7 +11,7 @@ export const reembedController = (
case "reembed: request start": {
return {
...state,
pendingFetch: action.abortableFetch
pendingFetch: action.abortableFetch,
};
}
case "reembed: request aborted":
@@ -19,7 +19,7 @@ export const reembedController = (
case "reembed: request completed": {
return {
...state,
pendingFetch: null
pendingFetch: null,
};
}
default: {
@@ -33,7 +33,7 @@ actual reembedding data is part of the undo/redo history
*/
export const reembedding = (
state = {
reembeddings: new Map()
reembeddings: new Map(),
},
action
) => {
@@ -47,14 +47,14 @@ export const reembedding = (
reembeddings: new Map(reembeddings).set(name, {
name,
schema,
embedding
})
embedding,
}),
};
}
case "reembed: clear all reembeddings": {
return {
...state,
reembeddings: new Map()
reembeddings: new Map(),
};
}
default: {
+2 -2
View File
@@ -8,7 +8,7 @@ which improves Reset UI performance.
*/
const ResetCacheReducer = (
state = {
crossfilter: null
crossfilter: null,
},
action,
nextSharedState
@@ -19,7 +19,7 @@ const ResetCacheReducer = (
const { crossfilter } = nextSharedState;
return {
...state,
crossfilter
crossfilter,
};
}
default: {
+2 -2
View File
@@ -2,7 +2,7 @@
const Responsive = (
state = {
width: null,
height: null
height: null,
},
action
) => {
@@ -11,7 +11,7 @@ const Responsive = (
return {
...state,
width: action.data.width,
height: action.data.height
height: action.data.height,
};
default:
return state;
+14 -14
View File
@@ -80,7 +80,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
const past = currentState[pastKey];
const future = currentState[futureKey];
if (past.length === 0) return currentState;
const currentUndoableState = Object.entries(currentState).filter(kv =>
const currentUndoableState = Object.entries(currentState).filter((kv) =>
undoableKeysSet.has(kv[0])
);
const newPast = [...past];
@@ -91,7 +91,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
...fromEntries(newState),
[pastKey]: newPast,
[futureKey]: newFuture,
[pendingKey]: null
[pendingKey]: null,
};
return nextState;
}
@@ -103,7 +103,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
const past = currentState[pastKey] || [];
const future = currentState[futureKey] || [];
if (future.length === 0) return currentState;
const currentUndoableState = Object.entries(currentState).filter(kv =>
const currentUndoableState = Object.entries(currentState).filter((kv) =>
undoableKeysSet.has(kv[0])
);
const newFuture = [...future];
@@ -114,7 +114,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
...fromEntries(newState),
[pastKey]: newPast,
[futureKey]: newFuture,
[pendingKey]: null
[pendingKey]: null,
};
return nextState;
}
@@ -128,7 +128,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
[pastKey]: [],
[futureKey]: [],
[filterStateKey]: {},
[pendingKey]: null
[pendingKey]: null,
};
}
@@ -145,7 +145,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
[pastKey]: past,
[futureKey]: future,
[filterStateKey]: filterState,
[pendingKey]: pending
[pendingKey]: pending,
};
}
@@ -154,7 +154,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
*/
function save(currentState, action, filterState) {
const past = currentState[pastKey] || [];
const currentUndoableState = Object.entries(currentState).filter(kv =>
const currentUndoableState = Object.entries(currentState).filter((kv) =>
undoableKeysSet.has(kv[0])
);
const res = reducer(currentState, action);
@@ -164,7 +164,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
[pastKey]: newPast,
[futureKey]: [],
[filterStateKey]: filterState,
[pendingKey]: null
[pendingKey]: null,
};
return nextState;
}
@@ -173,12 +173,12 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
Save current state as pending history change. No other side effects.
*/
function stashPending(currentState) {
const currentUndoableState = Object.entries(currentState).filter(kv =>
const currentUndoableState = Object.entries(currentState).filter((kv) =>
undoableKeysSet.has(kv[0])
);
return {
...currentState,
[pendingKey]: currentUndoableState
[pendingKey]: currentUndoableState,
};
}
@@ -188,7 +188,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
function cancelPending(currentState) {
return {
...currentState,
[pendingKey]: null
[pendingKey]: null,
};
}
@@ -203,7 +203,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
...currentState,
[pastKey]: newPast,
[futureKey]: [],
[pendingKey]: null
[pendingKey]: null,
};
return nextState;
}
@@ -213,7 +213,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
[pastKey]: [],
[futureKey]: [],
[filterStateKey]: {},
[pendingKey]: null
[pendingKey]: null,
},
action
) => {
@@ -241,7 +241,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
);
const {
[filterActionKey]: filterAction,
[filterStateKey]: filterStateUpdate
[filterStateKey]: filterStateUpdate,
} = actionFilterResp;
const nextFilterState = { ...currentFilterState, ...filterStateUpdate };
+16 -16
View File
@@ -49,7 +49,7 @@ const skipOnActions = new Set([
"annotation: disable category edit mode",
"annotation: activate edit label mode",
"annotation: cancel edit label mode",
"set annotations collection name"
"set annotations collection name",
]);
/*
@@ -101,7 +101,7 @@ const saveOnActions = new Set([
"annotation: label edited",
"annotation: label current cell selection",
"annotation: delete label",
"annotation: category edited"
"annotation: category edited",
]);
/**
@@ -115,26 +115,26 @@ See graph definition for the transitions that use each.
Signature: (fsm, transition, reducerState, reducerAction) => undoableAction
*/
const stashPending = fsm => ({
const stashPending = (fsm) => ({
[actionKey]: "stashPending",
[stateKey]: { fsm }
[stateKey]: { fsm },
});
const cancelPending = () => ({
[actionKey]: "cancelPending",
[stateKey]: { fsm: null }
[stateKey]: { fsm: null },
});
const applyPending = () => ({
[actionKey]: "applyPending",
[stateKey]: { fsm: null }
[stateKey]: { fsm: null },
});
const skip = (fsm, transition) => ({
[actionKey]: "skip",
[stateKey]: { fsm: transition.to !== "done" ? fsm : null }
[stateKey]: { fsm: transition.to !== "done" ? fsm : null },
});
const clear = () => ({ [actionKey]: "clear", [stateKey]: { fsm: null } });
const save = (fsm, transition) => ({
[actionKey]: "save",
[stateKey]: { fsm: transition.to !== "done" ? fsm : null }
[stateKey]: { fsm: transition.to !== "done" ? fsm : null },
});
/*
@@ -171,11 +171,11 @@ Basic approach:
* only implement complex state machines where absolutely required (eg,
multi-event seleciton and the like)
*/
const actionFilter = debug => (state, action, prevFilterState) => {
const actionFilter = (debug) => (state, action, prevFilterState) => {
const actionType = action.type;
const filterState = {
...prevFilterState,
prevAction: action
prevAction: action,
};
if (skipOnActions.has(actionType)) {
return { [actionKey]: "skip", [stateKey]: filterState };
@@ -246,7 +246,7 @@ const debug = false;
const undoableConfig = {
debug,
historyLimit: 50, // maximum history size
actionFilter: actionFilter(debug)
actionFilter: actionFilter(debug),
};
/*
@@ -258,9 +258,9 @@ if (debug) {
Confirm no intersection between the various trivial rejection action filters
*/
if (
new Set([...skipOnActions].filter(x => clearOnActions.has(x))).size > 0 ||
new Set([...skipOnActions].filter(x => saveOnActions.has(x))).size > 0 ||
new Set([...clearOnActions].filter(x => saveOnActions.has(x))).size > 0
new Set([...skipOnActions].filter((x) => clearOnActions.has(x))).size > 0 ||
new Set([...skipOnActions].filter((x) => saveOnActions.has(x))).size > 0 ||
new Set([...clearOnActions].filter((x) => saveOnActions.has(x))).size > 0
) {
console.error(
"Undoable misconfiguration - action filters have redundant events"
@@ -275,10 +275,10 @@ if (debug) {
const trivialFilters = new Set([
...skipOnActions,
...clearOnActions,
...saveOnActions
...saveOnActions,
]);
const trivialOverlapWithFsm = new Set(
[...trivialFilters].filter(x => seedFsm.events.has(x))
[...trivialFilters].filter((x) => seedFsm.events.has(x))
);
if (trivialOverlapWithFsm.size > 0) {
console.error(
+26 -26
View File
@@ -32,13 +32,13 @@ const createFsmTransitions = (
event: "graph brush start",
from: "init",
to: "graph brush in progress",
action: stashPending
action: stashPending,
},
{
event: "graph brush cancel",
from: "graph brush in progress",
to: "done",
action: applyPending
action: applyPending,
},
{
event: "graph brush deselect",
@@ -48,13 +48,13 @@ const createFsmTransitions = (
action: (fsm, transition, data) =>
data.state.graphSelection.selection.mode === "all"
? cancelPending()
: applyPending()
: applyPending(),
},
{
event: "graph brush end",
from: "graph brush in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* graph selection lasso */
@@ -62,13 +62,13 @@ const createFsmTransitions = (
event: "graph lasso start",
from: "init",
to: "graph lasso in progress",
action: stashPending
action: stashPending,
},
{
event: "graph lasso cancel",
from: "graph lasso in progress",
to: "done",
action: applyPending
action: applyPending,
},
{
event: "graph lasso deselect",
@@ -78,13 +78,13 @@ const createFsmTransitions = (
action: (fsm, transition, data) =>
data.state.graphSelection.selection.mode === "all"
? cancelPending()
: applyPending()
: applyPending(),
},
{
event: "graph lasso end",
from: "graph lasso in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* Continuous metadata histogram brush selection */
@@ -92,19 +92,19 @@ const createFsmTransitions = (
event: "continuous metadata histogram start",
from: "init",
to: "continuous histo select in progress",
action: stashPending
action: stashPending,
},
{
event: "continuous metadata histogram cancel",
from: "continuous histo select in progress",
to: "done",
action: cancelPending
action: cancelPending,
},
{
event: "continuous metadata histogram end",
from: "continuous histo select in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* Single gene request by user */
@@ -112,25 +112,25 @@ const createFsmTransitions = (
event: "single user defined gene start",
from: "init",
to: "single user gene request in progress",
action: stashPending
action: stashPending,
},
{
event: "request user defined gene error",
from: "single user gene request in progress",
to: "single user gene error in progress",
action: skip
action: skip,
},
{
event: "single user defined gene error",
from: "single user gene error in progress",
to: "done",
action: cancelPending
action: cancelPending,
},
{
event: "single user defined gene complete",
from: "single user gene request in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* Bulk gene request by user */
@@ -138,25 +138,25 @@ const createFsmTransitions = (
event: "bulk user defined gene start",
from: "init",
to: "bulk user gene request in progress",
action: stashPending
action: stashPending,
},
{
event: "request user defined gene error",
from: "bulk user gene request in progress",
to: "bulk user gene request error in progress",
action: skip
action: skip,
},
{
event: "bulk user defined gene error",
from: "bulk user gene request error in progress",
to: "done",
action: cancelPending
action: cancelPending,
},
{
event: "bulk user defined gene complete",
from: "bulk user gene request in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* Compute Differential Expression button user action */
@@ -164,19 +164,19 @@ const createFsmTransitions = (
event: "request differential expression started",
from: "init",
to: "diffexp in progress",
action: stashPending
action: stashPending,
},
{
event: "request user defined gene error",
from: "diffexp in progress",
to: "done",
action: cancelPending
action: cancelPending,
},
{
event: "request differential expression success",
from: "diffexp in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* Clear Differential Expression button user action */
@@ -184,13 +184,13 @@ const createFsmTransitions = (
event: "clear differential expression",
from: "init",
to: "CDE Button in progress",
action: stashPending
action: stashPending,
},
{
event: "clear scatterplot",
from: "CDE Button in progress",
to: "done",
action: applyPending
action: applyPending,
},
/* clear scatter plot button (eg, on scatterplot view) */
@@ -198,8 +198,8 @@ const createFsmTransitions = (
event: "clear scatterplot",
from: "init",
to: "done",
action: save
}
action: save,
},
];
};
+12 -10
View File
@@ -2,12 +2,12 @@ import { unassignedCategoryLabel } from "../globals";
import {
addObsAnnotations,
addVarAnnotations,
addObsLayout
addObsLayout,
} from "../util/stateManager/universe";
import {
World,
ControlsHelpers,
AnnotationsHelpers
AnnotationsHelpers,
} from "../util/stateManager";
const Universe = (state = null, action, nextSharedState, prevSharedState) => {
@@ -23,19 +23,19 @@ const Universe = (state = null, action, nextSharedState, prevSharedState) => {
case "obsAnnotations": {
return {
...state,
...addObsAnnotations(state, dataframe)
...addObsAnnotations(state, dataframe),
};
}
case "varAnnotations": {
return {
...state,
...addVarAnnotations(state, dataframe)
...addVarAnnotations(state, dataframe),
};
}
case "obsLayout": {
return {
...state,
...addObsLayout(state, dataframe)
...addObsLayout(state, dataframe),
};
}
default: {
@@ -62,8 +62,10 @@ const Universe = (state = null, action, nextSharedState, prevSharedState) => {
const { userDefinedGenes, diffexpGenes } = prevSharedState;
const allTheGenesWeNeed = [
...new Set(
[userDefinedGenes, diffexpGenes, Object.keys(action.expressionData)].filter(ele => ele).flat()
)
[userDefinedGenes, diffexpGenes, Object.keys(action.expressionData)]
.filter((ele) => ele)
.flat()
),
];
varData = ControlsHelpers.pruneVarDataCache(varData, allTheGenesWeNeed);
return { ...state, varData };
@@ -98,7 +100,7 @@ const Universe = (state = null, action, nextSharedState, prevSharedState) => {
categoryToDuplicate,
name,
{
writable: true
writable: true,
}
);
/* if we are duplicating a non-writable annotation, it may not have an unassigned category */
@@ -114,7 +116,7 @@ const Universe = (state = null, action, nextSharedState, prevSharedState) => {
name,
categories,
type: "categorical",
writable: true
writable: true,
});
data = new Array(state.nObs).fill(unassignedCategoryLabel);
}
@@ -134,7 +136,7 @@ const Universe = (state = null, action, nextSharedState, prevSharedState) => {
const colSchema = {
...state.schema.annotations.obsByName[name],
name: newName
name: newName,
};
const schema = AnnotationsHelpers.addObsAnnoSchema(
AnnotationsHelpers.removeObsAnnoSchema(state.schema, name),
+23 -23
View File
@@ -2,11 +2,11 @@ import { unassignedCategoryLabel } from "../globals";
import {
World,
ControlsHelpers,
AnnotationsHelpers
AnnotationsHelpers,
} from "../util/stateManager";
import {
addObsLayout,
removeObsLayout
removeObsLayout,
} from "../util/stateManager/schemaHelpers";
import clip from "../util/clip";
import quantile from "../util/quantile";
@@ -45,14 +45,14 @@ const WorldReducer = (
if (dim == "varData" || dim == "obsAnnotations") {
unclipped = {
...unclipped,
[dim]: universe[dim].clone()
[dim]: universe[dim].clone(),
};
}
return {
...state,
schema: universe.schema,
[dim]: universe[dim].clone(),
unclipped
unclipped,
};
}
@@ -113,9 +113,9 @@ const WorldReducer = (
const allTheGenesWeNeed = [
...new Set(
[userDefinedGenes, diffexpGenes, Object.keys(action.expressionData)]
.filter(ele => ele)
.filter((ele) => ele)
.flat()
)
),
];
unclippedVarData = ControlsHelpers.pruneVarDataCache(
unclippedVarData,
@@ -130,14 +130,14 @@ const WorldReducer = (
let clippedVarData = state.varData;
const keysToDrop = clippedVarData.colIndex
.keys()
.filter(k => !unclippedVarData.hasCol(k));
.filter((k) => !unclippedVarData.hasCol(k));
const keysToAdd = unclippedVarData.colIndex
.keys()
.filter(k => !clippedVarData.hasCol(k));
keysToDrop.forEach(k => {
.filter((k) => !clippedVarData.hasCol(k));
keysToDrop.forEach((k) => {
clippedVarData = clippedVarData.dropCol(k);
});
keysToAdd.forEach(k => {
keysToAdd.forEach((k) => {
const data = unclippedVarData.col(k).asArray();
const q = [state.clipQuantiles.min, state.clipQuantiles.max];
const [qMinVal, qMaxVal] = quantile(q, data);
@@ -154,8 +154,8 @@ const WorldReducer = (
varData: clippedVarData,
unclipped: {
...state.unclipped,
varData: unclippedVarData
}
varData: unclippedVarData,
},
};
}
@@ -188,7 +188,7 @@ const WorldReducer = (
name,
newAnnotation,
state.unclipped.obsAnnotations.rowIndex
)
),
};
return { ...state, schema, obsAnnotations, unclipped };
}
@@ -201,7 +201,7 @@ const WorldReducer = (
const obsAnnotations = state.obsAnnotations.renameCol(name, newName);
const unclipped = {
...state.unclipped,
obsAnnotations: state.unclipped.obsAnnotations.renameCol(name, newName)
obsAnnotations: state.unclipped.obsAnnotations.renameCol(name, newName),
};
return { ...state, schema, obsAnnotations, unclipped };
}
@@ -213,7 +213,7 @@ const WorldReducer = (
const obsAnnotations = state.obsAnnotations.dropCol(name);
const unclipped = {
...state.unclipped,
obsAnnotations: state.unclipped.obsAnnotations.dropCol(name)
obsAnnotations: state.unclipped.obsAnnotations.dropCol(name),
};
return { ...state, schema, obsAnnotations, unclipped };
}
@@ -233,7 +233,7 @@ const WorldReducer = (
crossfilter,
metadataField,
newLabelText
)
),
};
}
return { ...state, schema };
@@ -253,7 +253,7 @@ const WorldReducer = (
metadataField,
oldLabelName,
newLabelName
)
),
};
const obsAnnotations = state.obsAnnotations.replaceColData(
metadataField,
@@ -274,7 +274,7 @@ const WorldReducer = (
metadataField,
label,
unassignedCategoryLabel
)
),
};
const obsAnnotations = state.obsAnnotations.replaceColData(
metadataField,
@@ -288,7 +288,7 @@ const WorldReducer = (
const { crossfilter } = prevSharedState;
return {
...state,
...setLabelOnCurrentSelection(state, crossfilter, metadataField, label)
...setLabelOnCurrentSelection(state, crossfilter, metadataField, label),
};
}
@@ -306,14 +306,14 @@ const WorldReducer = (
const embedingLabels = embedding.colIndex.keys();
const labels = {
[embedingLabels[0]]: dims[0],
[embedingLabels[1]]: dims[1]
[embedingLabels[1]]: dims[1],
};
obsLayout = obsLayout.withColsFrom(embedding, labels);
schema = addObsLayout(schema, embeddingSchema);
return {
...state,
obsLayout,
schema
schema,
};
}
@@ -334,7 +334,7 @@ const WorldReducer = (
return {
...state,
obsLayout,
schema
schema,
};
}
@@ -357,7 +357,7 @@ function setLabelOnCurrentSelection(world, crossfilter, metadataField, label) {
metadataField,
mask,
label
)
),
};
const obsAnnotations = world.obsAnnotations.replaceColData(
metadataField,