gene set summary progress (#2127)

* revert removal of cache control headers

* checkpoint work on revising summary route

* add summary query support to annoMatrix

* summarize route cleanup

* add mising file

* clean up summarize route

* add summary histogram

* update deps

* lint

* more lint

* lint

* manage crossfiler during gene set state changes

* remove obsolete debugging code

* correctly perform async watch in histogram

* better error handling
This commit is contained in:
Bruce Martin
2021-03-30 14:43:53 -07:00
committed by GitHub
parent bfb9e1edcc
commit ae30b66123
47 changed files with 28628 additions and 9109 deletions
+26 -15
View File
@@ -30,22 +30,27 @@ export function catchErrorsWrap(fn, dispatchToUser = false) {
};
}
/*
Wrapper to perform async fetch with some modest error handling
and decoding.
*/
const doFetch = async (url, acceptType) => {
/**
* Wrapper to perform async fetch with some modest error handling
* and decoding. Arguments are identical to standard fetch.
*/
export const doFetch = async (url, init = {}) => {
try {
const res = await fetch(url, {
// add defaults to the fetch init param.
init = {
method: "get",
headers: new Headers({
Accept: acceptType,
}),
credentials: "include",
});
if (res.ok && res.headers.get("Content-Type").includes(acceptType)) {
...init,
};
const acceptType = init.headers?.get("Accept");
const res = await fetch(url, init);
if (
res.ok &&
(!acceptType || res.headers.get("Content-Type").includes(acceptType))
) {
return res;
}
// else an error
const msg = `Unexpected HTTP response ${res.status}, ${res.statusText}`;
dispatchNetworkErrorMessageToUser(msg);
@@ -61,16 +66,22 @@ const doFetch = async (url, acceptType) => {
/*
Wrapper to perform an async fetch and JSON decode response.
*/
export const doJsonRequest = async (url) => {
const res = await doFetch(url, "application/json");
export const doJsonRequest = async (url, init = {}) => {
const res = await doFetch(url, {
...init,
headers: new Headers({ Accept: "application/json" }),
});
return res.json();
};
/*
Wrapper to perform an async fetch for binary data.
*/
export const doBinaryRequest = async (url) => {
const res = await doFetch(url, "application/octet-stream");
export const doBinaryRequest = async (url, init = {}) => {
const res = await doFetch(url, {
...init,
headers: new Headers({ Accept: "application/octet-stream" }),
});
return res.arrayBuffer();
};
+9 -1
View File
@@ -8,6 +8,9 @@ have a obsAnnotation named X, but we are using that for layout. So
we namespace, and abstract to avoid proliferating strings throughout the
codebase.
It is _no longer_ used to remove collisions in the crossfilter or
anno matrix namespaces. It is still used by the component tier.
*/
const makeDimensionName = (namespace, key) => `${namespace}_${key}`;
@@ -18,12 +21,15 @@ export const diffexpDimensionName = (key) =>
makeDimensionName("varData_diffexp", key);
export const userDefinedDimensionName = (key) =>
makeDimensionName("varData_userDefined", key);
export const geneSetSummaryDimensionName = (key) =>
makeDimensionName("geneSetSummary", key);
/*
continuousNamespace = {
isObs: true,
isDiffExp: false,
isUserDefined: false
isUserDefined: false,
isGeneSet: false,
}
ie., makeContinuousDimensionName(continuousNamespace = {isObs: true}, "total_reads")
@@ -37,6 +43,8 @@ export const makeContinuousDimensionName = (continuousNamespace, key) => {
name = diffexpDimensionName(key);
} else if (continuousNamespace.isUserDefined) {
name = userDefinedDimensionName(key);
} else if (continuousNamespace.isGeneSetSummary) {
name = geneSetSummaryDimensionName(key);
} else {
throw new Error("unknown continuous dimension");
}
+5 -3
View File
@@ -25,9 +25,11 @@ export function createColorQuery(colorMode, colorByAccessor, schema) {
return [
"X",
{
field: "var",
column: varIndex,
value: colorByAccessor,
where: {
field: "var",
column: varIndex,
value: colorByAccessor,
},
},
];
}
+13 -5
View File
@@ -4,8 +4,16 @@ This is all VERY tightly integrated with reducers and actions, and
exists to support those concepts.
*/
export * as ColorHelpers from "./colorHelpers";
export * as ControlsHelpers from "./controlsHelpers";
export * as AnnotationsHelpers from "./annotationsHelpers";
export * as SchemaHelpers from "./schemaHelpers";
export * as MatrixFBS from "./matrix";
import * as ColorHelpers from "./colorHelpers";
import * as ControlsHelpers from "./controlsHelpers";
import * as AnnotationsHelpers from "./annotationsHelpers";
import * as SchemaHelpers from "./schemaHelpers";
import * as MatrixFBS from "./matrix";
export {
ColorHelpers,
ControlsHelpers,
AnnotationsHelpers,
SchemaHelpers,
MatrixFBS,
};