do not hard-wire column names in annotations (#785)

* enforce column name uniqueness for obs and var

* parameterize the column name containing obs and var user-readable names

* use the new annotation index value from schema

* update f/e unit tests

* PR review suggestions

* lint
This commit is contained in:
Bruce Martin
2019-05-24 21:00:54 -07:00
committed by GitHub
parent a8c2e408d1
commit 3dc45d6330
16 changed files with 246 additions and 155 deletions
+2 -1
View File
@@ -93,9 +93,10 @@ const Controls = (
}
case "request differential expression success": {
const { world } = prevSharedState;
const varIndexName = world.schema.annotations.var.index;
const _diffexpGenes = [];
action.data.forEach(d => {
_diffexpGenes.push(world.varAnnotations.at(d[0], "name"));
_diffexpGenes.push(world.varAnnotations.at(d[0], varIndexName));
});
return {
...state,
+4 -2
View File
@@ -90,8 +90,9 @@ const CrossfilterReducer = (
case "request differential expression success": {
const { world } = prevSharedState;
const varIndexName = world.schema.annotations.var.index;
const genes = _.map(action.data, d =>
world.varAnnotations.at(d[0], "name")
world.varAnnotations.at(d[0], varIndexName)
);
const crossfilter = _.reduce(
genes,
@@ -109,10 +110,11 @@ const CrossfilterReducer = (
case "clear differential expression": {
const { world } = prevSharedState;
const varIndexName = world.schema.annotations.var.index;
const crossfilter = _.reduce(
action.diffExp,
(xfltr, values) => {
const name = world.varAnnotations.at(values[0], "name");
const name = world.varAnnotations.at(values[0], varIndexName);
return xfltr.delDimension(diffexpDimensionName(name));
},
state