@vitessce/statistical-plots 3.4.14 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deflate-1b022792.js → deflate-9412420e.js} +1 -1
- package/dist/{index-8fb3f92c.js → index-5a8190d9.js} +65 -63
- package/dist/index.js +1 -1
- package/dist/{jpeg-b5458646.js → jpeg-c60720b8.js} +1 -1
- package/dist/{lerc-021481cc.js → lerc-922b46fe.js} +1 -1
- package/dist/{lzw-a7fe4b6d.js → lzw-401bb3ee.js} +1 -1
- package/dist/{packbits-d87185df.js → packbits-3219f1f5.js} +1 -1
- package/dist/{raw-a6544f4b.js → raw-ee5f13d0.js} +1 -1
- package/dist/{webimage-cca79872.js → webimage-9f8ff63a.js} +1 -1
- package/dist-tsc/CellSetSizesPlot.js +1 -1
- package/dist-tsc/dot-plot-hook.d.ts.map +1 -1
- package/dist-tsc/dot-plot-hook.js +4 -4
- package/dist-tsc/expr-hooks.d.ts +2 -2
- package/dist-tsc/expr-hooks.d.ts.map +1 -1
- package/dist-tsc/expr-hooks.js +25 -20
- package/package.json +8 -8
- package/src/CellSetSizesPlot.js +1 -1
- package/src/dot-plot-hook.js +4 -5
- package/src/expr-hooks.js +35 -31
@@ -957,7 +957,8 @@ const ViewType$1 = {
|
|
957
957
|
OBS_SET_FEATURE_VALUE_DISTRIBUTION: "obsSetFeatureValueDistribution",
|
958
958
|
FEATURE_VALUE_HISTOGRAM: "featureValueHistogram",
|
959
959
|
DOT_PLOT: "dotPlot",
|
960
|
-
FEATURE_BAR_PLOT: "featureBarPlot"
|
960
|
+
FEATURE_BAR_PLOT: "featureBarPlot",
|
961
|
+
BIOMARKER_SELECT: "biomarkerSelect"
|
961
962
|
};
|
962
963
|
const DataType$2 = {
|
963
964
|
OBS_LABELS: "obsLabels",
|
@@ -1652,6 +1653,11 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
1652
1653
|
CoordinationType$1.OBS_SET_COLOR,
|
1653
1654
|
CoordinationType$1.OBS_COLOR_ENCODING,
|
1654
1655
|
CoordinationType$1.ADDITIONAL_OBS_SETS
|
1656
|
+
],
|
1657
|
+
[ViewType$1.BIOMARKER_SELECT]: [
|
1658
|
+
CoordinationType$1.FEATURE_SELECTION,
|
1659
|
+
CoordinationType$1.SAMPLE_SET_SELECTION
|
1660
|
+
// TODO: create coordination types for internal state of the biomarker selection view?
|
1655
1661
|
]
|
1656
1662
|
};
|
1657
1663
|
function commonjsRequire(path2) {
|
@@ -18937,15 +18943,13 @@ function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
18937
18943
|
}
|
18938
18944
|
function aggregateStratifiedExpressionData(stratifiedResult, geneSelection) {
|
18939
18945
|
const result = new InternMap([], JSON.stringify);
|
18940
|
-
|
18941
|
-
|
18942
|
-
|
18943
|
-
|
18944
|
-
|
18945
|
-
result.get(cellSetKey).set(sampleSetKey, values2);
|
18946
|
-
});
|
18946
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
18947
|
+
result.set(cellSetKey, new InternMap([], JSON.stringify));
|
18948
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
18949
|
+
const values2 = secondLevelInternMap.get(geneSelection[0]);
|
18950
|
+
result.get(cellSetKey).set(sampleSetKey, values2);
|
18947
18951
|
});
|
18948
|
-
}
|
18952
|
+
});
|
18949
18953
|
return result;
|
18950
18954
|
}
|
18951
18955
|
const $b5e257d569688ac6$var$defaultContext = {
|
@@ -98979,7 +98983,7 @@ keysShim.shim = function shimObjectKeys() {
|
|
98979
98983
|
return Object.keys || keysShim;
|
98980
98984
|
};
|
98981
98985
|
var objectKeys$1 = keysShim;
|
98982
|
-
var shams$
|
98986
|
+
var shams$1 = function hasSymbols() {
|
98983
98987
|
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
|
98984
98988
|
return false;
|
98985
98989
|
}
|
@@ -99024,9 +99028,9 @@ var shams$2 = function hasSymbols() {
|
|
99024
99028
|
}
|
99025
99029
|
return true;
|
99026
99030
|
};
|
99027
|
-
var hasSymbols$
|
99028
|
-
var shams
|
99029
|
-
return hasSymbols$
|
99031
|
+
var hasSymbols$3 = shams$1;
|
99032
|
+
var shams = function hasToStringTagShams() {
|
99033
|
+
return hasSymbols$3() && !!Symbol.toStringTag;
|
99030
99034
|
};
|
99031
99035
|
var esErrors = Error;
|
99032
99036
|
var _eval = EvalError;
|
@@ -99036,8 +99040,8 @@ var syntax = SyntaxError;
|
|
99036
99040
|
var type$1 = TypeError;
|
99037
99041
|
var uri = URIError;
|
99038
99042
|
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
99039
|
-
var hasSymbolSham = shams$
|
99040
|
-
var hasSymbols$
|
99043
|
+
var hasSymbolSham = shams$1;
|
99044
|
+
var hasSymbols$2 = function hasNativeSymbols() {
|
99041
99045
|
if (typeof origSymbol !== "function") {
|
99042
99046
|
return false;
|
99043
99047
|
}
|
@@ -99053,11 +99057,12 @@ var hasSymbols$3 = function hasNativeSymbols() {
|
|
99053
99057
|
return hasSymbolSham();
|
99054
99058
|
};
|
99055
99059
|
var test$1 = {
|
99060
|
+
__proto__: null,
|
99056
99061
|
foo: {}
|
99057
99062
|
};
|
99058
99063
|
var $Object$1 = Object;
|
99059
99064
|
var hasProto$1 = function hasProto() {
|
99060
|
-
return { __proto__: test$1 }.foo === test$1.foo && !(
|
99065
|
+
return { __proto__: test$1 }.foo === test$1.foo && !(test$1 instanceof $Object$1);
|
99061
99066
|
};
|
99062
99067
|
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
99063
99068
|
var toStr$2 = Object.prototype.toString;
|
@@ -99172,7 +99177,7 @@ var ThrowTypeError = $gOPD$2 ? function() {
|
|
99172
99177
|
}
|
99173
99178
|
}
|
99174
99179
|
}() : throwTypeError;
|
99175
|
-
var hasSymbols$
|
99180
|
+
var hasSymbols$1 = hasSymbols$2();
|
99176
99181
|
var hasProto2 = hasProto$1();
|
99177
99182
|
var getProto$2 = Object.getPrototypeOf || (hasProto2 ? function(x2) {
|
99178
99183
|
return x2.__proto__;
|
@@ -99184,7 +99189,7 @@ var INTRINSICS = {
|
|
99184
99189
|
"%AggregateError%": typeof AggregateError === "undefined" ? undefined$2 : AggregateError,
|
99185
99190
|
"%Array%": Array,
|
99186
99191
|
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$2 : ArrayBuffer,
|
99187
|
-
"%ArrayIteratorPrototype%": hasSymbols$
|
99192
|
+
"%ArrayIteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$2,
|
99188
99193
|
"%AsyncFromSyncIteratorPrototype%": undefined$2,
|
99189
99194
|
"%AsyncFunction%": needsEval,
|
99190
99195
|
"%AsyncGenerator%": needsEval,
|
@@ -99215,10 +99220,10 @@ var INTRINSICS = {
|
|
99215
99220
|
"%Int32Array%": typeof Int32Array === "undefined" ? undefined$2 : Int32Array,
|
99216
99221
|
"%isFinite%": isFinite,
|
99217
99222
|
"%isNaN%": isNaN,
|
99218
|
-
"%IteratorPrototype%": hasSymbols$
|
99223
|
+
"%IteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$2,
|
99219
99224
|
"%JSON%": typeof JSON === "object" ? JSON : undefined$2,
|
99220
99225
|
"%Map%": typeof Map === "undefined" ? undefined$2 : Map,
|
99221
|
-
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$
|
99226
|
+
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$1 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
99222
99227
|
"%Math%": Math,
|
99223
99228
|
"%Number%": Number,
|
99224
99229
|
"%Object%": Object,
|
@@ -99231,11 +99236,11 @@ var INTRINSICS = {
|
|
99231
99236
|
"%Reflect%": typeof Reflect === "undefined" ? undefined$2 : Reflect,
|
99232
99237
|
"%RegExp%": RegExp,
|
99233
99238
|
"%Set%": typeof Set === "undefined" ? undefined$2 : Set,
|
99234
|
-
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$
|
99239
|
+
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$1 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Set())[Symbol.iterator]()),
|
99235
99240
|
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$2 : SharedArrayBuffer,
|
99236
99241
|
"%String%": String,
|
99237
|
-
"%StringIteratorPrototype%": hasSymbols$
|
99238
|
-
"%Symbol%": hasSymbols$
|
99242
|
+
"%StringIteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2(""[Symbol.iterator]()) : undefined$2,
|
99243
|
+
"%Symbol%": hasSymbols$1 ? Symbol : undefined$2,
|
99239
99244
|
"%SyntaxError%": $SyntaxError$1,
|
99240
99245
|
"%ThrowTypeError%": ThrowTypeError,
|
99241
99246
|
"%TypedArray%": TypedArray,
|
@@ -99604,7 +99609,7 @@ var callBound$2 = function callBoundIntrinsic(name2, allowMissing) {
|
|
99604
99609
|
}
|
99605
99610
|
return intrinsic;
|
99606
99611
|
};
|
99607
|
-
var hasToStringTag$2 = shams
|
99612
|
+
var hasToStringTag$2 = shams();
|
99608
99613
|
var callBound$1 = callBound$2;
|
99609
99614
|
var $toString$1 = callBound$1("Object.prototype.toString");
|
99610
99615
|
var isStandardArguments = function isArguments2(value2) {
|
@@ -99649,7 +99654,7 @@ hasPropertyDescriptors2.hasArrayLengthDefineBug = function hasArrayLengthDefineB
|
|
99649
99654
|
};
|
99650
99655
|
var hasPropertyDescriptors_1 = hasPropertyDescriptors2;
|
99651
99656
|
var keys$4 = objectKeys$1;
|
99652
|
-
var
|
99657
|
+
var hasSymbols2 = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
|
99653
99658
|
var toStr$1 = Object.prototype.toString;
|
99654
99659
|
var concat = Array.prototype.concat;
|
99655
99660
|
var defineDataProperty2 = defineDataProperty$1;
|
@@ -99676,7 +99681,7 @@ var defineProperty$1 = function(object2, name2, value2, predicate) {
|
|
99676
99681
|
var defineProperties = function(object2, map2) {
|
99677
99682
|
var predicates = arguments.length > 2 ? arguments[2] : {};
|
99678
99683
|
var props = keys$4(map2);
|
99679
|
-
if (
|
99684
|
+
if (hasSymbols2) {
|
99680
99685
|
props = concat.call(props, Object.getOwnPropertySymbols(map2));
|
99681
99686
|
}
|
99682
99687
|
for (var i2 = 0; i2 < props.length; i2 += 1) {
|
@@ -99727,10 +99732,6 @@ define$4(polyfill$1, {
|
|
99727
99732
|
shim: shim$2
|
99728
99733
|
});
|
99729
99734
|
var objectIs = polyfill$1;
|
99730
|
-
var hasSymbols2 = shams$2;
|
99731
|
-
var shams = function hasToStringTagShams2() {
|
99732
|
-
return hasSymbols2() && !!Symbol.toStringTag;
|
99733
|
-
};
|
99734
99735
|
var callBound = callBound$2;
|
99735
99736
|
var hasToStringTag$1 = shams();
|
99736
99737
|
var has$2;
|
@@ -99937,7 +99938,7 @@ var tryDateObject = function tryDateGetDayCall(value2) {
|
|
99937
99938
|
};
|
99938
99939
|
var toStr = Object.prototype.toString;
|
99939
99940
|
var dateClass = "[object Date]";
|
99940
|
-
var hasToStringTag = shams
|
99941
|
+
var hasToStringTag = shams();
|
99941
99942
|
var isDateObject = function isDateObject2(value2) {
|
99942
99943
|
if (typeof value2 !== "object" || value2 === null) {
|
99943
99944
|
return false;
|
@@ -133223,16 +133224,16 @@ function addDecoder(cases2, importFn) {
|
|
133223
133224
|
}
|
133224
133225
|
cases2.forEach((c2) => registry$1.set(c2, importFn));
|
133225
133226
|
}
|
133226
|
-
addDecoder([void 0, 1], () => import("./raw-
|
133227
|
-
addDecoder(5, () => import("./lzw-
|
133227
|
+
addDecoder([void 0, 1], () => import("./raw-ee5f13d0.js").then((m2) => m2.default));
|
133228
|
+
addDecoder(5, () => import("./lzw-401bb3ee.js").then((m2) => m2.default));
|
133228
133229
|
addDecoder(6, () => {
|
133229
133230
|
throw new Error("old style JPEG compression is not supported.");
|
133230
133231
|
});
|
133231
|
-
addDecoder(7, () => import("./jpeg-
|
133232
|
-
addDecoder([8, 32946], () => import("./deflate-
|
133233
|
-
addDecoder(32773, () => import("./packbits-
|
133234
|
-
addDecoder(34887, () => import("./lerc-
|
133235
|
-
addDecoder(50001, () => import("./webimage-
|
133232
|
+
addDecoder(7, () => import("./jpeg-c60720b8.js").then((m2) => m2.default));
|
133233
|
+
addDecoder([8, 32946], () => import("./deflate-9412420e.js").then((m2) => m2.default));
|
133234
|
+
addDecoder(32773, () => import("./packbits-3219f1f5.js").then((m2) => m2.default));
|
133235
|
+
addDecoder(34887, () => import("./lerc-922b46fe.js").then((m2) => m2.default));
|
133236
|
+
addDecoder(50001, () => import("./webimage-9f8ff63a.js").then((m2) => m2.default));
|
133236
133237
|
function decodeRowAcc(row, stride) {
|
133237
133238
|
let length2 = row.length - stride;
|
133238
133239
|
let offset5 = 0;
|
@@ -153781,21 +153782,21 @@ function summarize(iterable, keepZeros) {
|
|
153781
153782
|
}
|
153782
153783
|
function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
|
153783
153784
|
const result = new InternMap([], JSON.stringify);
|
153784
|
-
Array.from(stratifiedResult.
|
153785
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
153785
153786
|
result.set(cellSetKey, new InternMap([], JSON.stringify));
|
153786
|
-
Array.from(
|
153787
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
153787
153788
|
result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
|
153788
|
-
|
153789
|
-
|
153790
|
-
|
153791
|
-
|
153792
|
-
|
153793
|
-
|
153794
|
-
|
153795
|
-
|
153796
|
-
|
153797
|
-
|
153798
|
-
|
153789
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values2]) => {
|
153790
|
+
if (values2) {
|
153791
|
+
const exprMean = mean$1(values2);
|
153792
|
+
const numPos = values2.reduce((acc, val) => val > posThreshold ? acc + 1 : acc, 0);
|
153793
|
+
const fracPos = numPos / values2.length;
|
153794
|
+
const dotSummary = {
|
153795
|
+
meanExpInGroup: exprMean,
|
153796
|
+
fracPosInGroup: fracPos
|
153797
|
+
};
|
153798
|
+
result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
|
153799
|
+
}
|
153799
153800
|
});
|
153800
153801
|
});
|
153801
153802
|
});
|
@@ -153803,10 +153804,10 @@ function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
|
|
153803
153804
|
}
|
153804
153805
|
function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
|
153805
153806
|
const summarizedResult = new InternMap([], JSON.stringify);
|
153806
|
-
Array.from(stratifiedResult.
|
153807
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
153807
153808
|
summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
|
153808
|
-
Array.from(
|
153809
|
-
const values2 =
|
153809
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
153810
|
+
const values2 = secondLevelInternMap;
|
153810
153811
|
const summary = summarize(values2, keepZeros);
|
153811
153812
|
summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
|
153812
153813
|
});
|
@@ -153814,11 +153815,11 @@ function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
|
|
153814
153815
|
return summarizedResult;
|
153815
153816
|
}
|
153816
153817
|
function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp) {
|
153817
|
-
const groupSummaries = Array.from(summarizedResult.
|
153818
|
+
const groupSummaries = Array.from(summarizedResult.entries()).map(([cellSetKey, firstLevelInternMap]) => ({
|
153818
153819
|
key: cellSetKey,
|
153819
|
-
value: Array.from(
|
153820
|
+
value: Array.from(firstLevelInternMap.entries()).map(([sampleSetKey, secondLevelInternMap]) => ({
|
153820
153821
|
key: sampleSetKey,
|
153821
|
-
value:
|
153822
|
+
value: secondLevelInternMap
|
153822
153823
|
}))
|
153823
153824
|
}));
|
153824
153825
|
const groupData = groupSummaries.map(({ key: key2, value: value2 }) => ({
|
@@ -153833,7 +153834,9 @@ function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp)
|
|
153833
153834
|
key: kv.key,
|
153834
153835
|
value: kv.value.map((subKv) => ({ key: subKv.key, value: histogram(subKv.value) }))
|
153835
153836
|
}));
|
153836
|
-
const groupBinsMax = max$3(
|
153837
|
+
const groupBinsMax = max$3(
|
153838
|
+
groupBins.flatMap((d) => d.value.flatMap((subKv) => subKv.value.map((v) => v.length)))
|
153839
|
+
);
|
153837
153840
|
return {
|
153838
153841
|
// Array of [{ key, value: [
|
153839
153842
|
// { key, value: {
|
@@ -205706,7 +205709,7 @@ function CellSetSizesPlot(props) {
|
|
205706
205709
|
field: "keyName",
|
205707
205710
|
type: "nominal",
|
205708
205711
|
axis: { labelExpr: `substring(datum.label, ${keyLength})` },
|
205709
|
-
title:
|
205712
|
+
title: `${captializedObsType} Set`,
|
205710
205713
|
sort: keys3
|
205711
205714
|
},
|
205712
205715
|
y: {
|
@@ -206243,10 +206246,9 @@ function useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
206243
206246
|
JSON.stringify
|
206244
206247
|
);
|
206245
206248
|
const result = [];
|
206246
|
-
Array.from(dotData.
|
206247
|
-
Array.from(
|
206248
|
-
Array.from(
|
206249
|
-
const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
|
206249
|
+
Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
206250
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
206251
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
|
206250
206252
|
const featureName = geneKey;
|
206251
206253
|
result.push({
|
206252
206254
|
key: v4$1(),
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-5a8190d9.js";
|
3
3
|
import "react";
|
4
4
|
import "@vitessce/vit-s";
|
5
5
|
import "react-dom";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dot-plot-hook.d.ts","sourceRoot":"","sources":["../src/dot-plot-hook.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iJAbW,MAAM,sBACN,MAAM,iBAEN,KAAK,oBACL,KAAK,gBACL,MAAM,EAAE,yBACR,MAAM,GAAC,IAAI,oCAEX,MAAM,
|
1
|
+
{"version":3,"file":"dot-plot-hook.d.ts","sourceRoot":"","sources":["../src/dot-plot-hook.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iJAbW,MAAM,sBACN,MAAM,iBAEN,KAAK,oBACL,KAAK,gBACL,MAAM,EAAE,yBACR,MAAM,GAAC,IAAI,oCAEX,MAAM,mDA6EhB"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable max-len */
|
1
2
|
import { useMemo } from 'react';
|
2
3
|
import { InternMap } from 'internmap';
|
3
4
|
import { v4 as uuidv4 } from 'uuid';
|
@@ -36,10 +37,9 @@ export function useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelecti
|
|
36
37
|
const cellSetToUuid = new InternMap(cellSetSelection?.map(sampleSet => ([sampleSet, uuidv4()])), JSON.stringify);
|
37
38
|
const sampleSetToUuid = new InternMap(sampleSetSelection?.map(sampleSet => ([sampleSet, uuidv4()])), JSON.stringify);
|
38
39
|
const result = [];
|
39
|
-
Array.from(dotData.
|
40
|
-
Array.from(
|
41
|
-
Array.from(
|
42
|
-
const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
|
40
|
+
Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
41
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
42
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
|
43
43
|
const featureName = geneKey;
|
44
44
|
result.push({
|
45
45
|
key: uuidv4(), // Unique key for this dot.
|
package/dist-tsc/expr-hooks.d.ts
CHANGED
@@ -42,10 +42,10 @@ export function histogramStratifiedExpressionData(summarizedResult: any, binCoun
|
|
42
42
|
key: any;
|
43
43
|
value: {
|
44
44
|
key: any;
|
45
|
-
value:
|
45
|
+
value: import("d3-array").Bin<number, number>[];
|
46
46
|
}[];
|
47
47
|
}[];
|
48
|
-
groupBinsMax:
|
48
|
+
groupBinsMax: number | undefined;
|
49
49
|
y: any;
|
50
50
|
};
|
51
51
|
//# sourceMappingURL=expr-hooks.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"expr-hooks.d.ts","sourceRoot":"","sources":["../src/expr-hooks.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"expr-hooks.d.ts","sourceRoot":"","sources":["../src/expr-hooks.js"],"names":[],"mappings":"AAiDA;;;;;;GAMG;AACH,8DAJW,GAAC,gBACD,GAAC,OA4BX;AAED;;;;;;GAMG;AACH,oEAJW,GAAC,aACD,GAAC,OAkBX;AAED;;;;;;;;GAQG;AACH,oEALW,GAAC,YACD,GAAC,YACD,GAAC;;;;;;;;;;;;;;;;;;;;;;;;EA4DX"}
|
package/dist-tsc/expr-hooks.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/* eslint-disable camelcase */
|
2
|
+
/* eslint-disable max-len */
|
2
3
|
import { InternMap } from 'internmap';
|
3
4
|
import { scaleLinear } from 'd3-scale';
|
4
5
|
import { bin, min, max, mean as d3_mean, deviation as d3_deviation, ascending as d3_ascending, quantileSorted, } from 'd3-array';
|
@@ -45,21 +46,21 @@ function summarize(iterable, keepZeros) {
|
|
45
46
|
*/
|
46
47
|
export function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
|
47
48
|
const result = new InternMap([], JSON.stringify);
|
48
|
-
Array.from(stratifiedResult.
|
49
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
49
50
|
result.set(cellSetKey, new InternMap([], JSON.stringify));
|
50
|
-
Array.from(
|
51
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
51
52
|
result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
53
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values]) => {
|
54
|
+
if (values) {
|
55
|
+
const exprMean = d3_mean(values);
|
56
|
+
const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
|
57
|
+
const fracPos = numPos / values.length;
|
58
|
+
const dotSummary = {
|
59
|
+
meanExpInGroup: exprMean,
|
60
|
+
fracPosInGroup: fracPos,
|
61
|
+
};
|
62
|
+
result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
|
63
|
+
}
|
63
64
|
});
|
64
65
|
});
|
65
66
|
});
|
@@ -74,10 +75,10 @@ export function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
|
|
74
75
|
*/
|
75
76
|
export function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
|
76
77
|
const summarizedResult = new InternMap([], JSON.stringify);
|
77
|
-
Array.from(stratifiedResult.
|
78
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
78
79
|
summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
|
79
|
-
Array.from(
|
80
|
-
const values =
|
80
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
81
|
+
const values = secondLevelInternMap;
|
81
82
|
const summary = summarize(values, keepZeros);
|
82
83
|
summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
|
83
84
|
});
|
@@ -94,11 +95,13 @@ export function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
|
|
94
95
|
* @returns
|
95
96
|
*/
|
96
97
|
export function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp) {
|
97
|
-
const groupSummaries = Array.from(summarizedResult.
|
98
|
+
const groupSummaries = Array.from(summarizedResult.entries())
|
99
|
+
.map(([cellSetKey, firstLevelInternMap]) => ({
|
98
100
|
key: cellSetKey,
|
99
|
-
value: Array.from(
|
101
|
+
value: Array.from(firstLevelInternMap.entries())
|
102
|
+
.map(([sampleSetKey, secondLevelInternMap]) => ({
|
100
103
|
key: sampleSetKey,
|
101
|
-
value:
|
104
|
+
value: secondLevelInternMap,
|
102
105
|
})),
|
103
106
|
}));
|
104
107
|
const groupData = groupSummaries
|
@@ -106,7 +109,9 @@ export function histogramStratifiedExpressionData(summarizedResult, binCount, yM
|
|
106
109
|
key,
|
107
110
|
value: value.map(({ key: subKey, value: subValue }) => ({ key: subKey, value: subValue.nonOutliers })),
|
108
111
|
}));
|
109
|
-
const trimmedData = groupData
|
112
|
+
const trimmedData = groupData
|
113
|
+
.map(kv => kv.value.map(subKv => subKv.value).flat())
|
114
|
+
.flat();
|
110
115
|
const yMin = (yMinProp === null ? Math.min(0, min(trimmedData)) : yMinProp);
|
111
116
|
// For the y domain, use the yMin prop
|
112
117
|
// to support a use case such as 'Aspect Ratio',
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitessce/statistical-plots",
|
3
|
-
"version": "3.
|
4
|
-
"author": "
|
3
|
+
"version": "3.5.0",
|
4
|
+
"author": "HIDIVE Lab at HMS",
|
5
5
|
"homepage": "http://vitessce.io",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -28,12 +28,12 @@
|
|
28
28
|
"react-aria": "^3.28.0",
|
29
29
|
"internmap": "^2.0.3",
|
30
30
|
"uuid": "^9.0.0",
|
31
|
-
"@vitessce/constants-internal": "3.
|
32
|
-
"@vitessce/sets-utils": "3.
|
33
|
-
"@vitessce/utils": "3.
|
34
|
-
"@vitessce/vega": "3.
|
35
|
-
"@vitessce/vit-s": "3.
|
36
|
-
"@vitessce/gl": "3.
|
31
|
+
"@vitessce/constants-internal": "3.5.0",
|
32
|
+
"@vitessce/sets-utils": "3.5.0",
|
33
|
+
"@vitessce/utils": "3.5.0",
|
34
|
+
"@vitessce/vega": "3.5.0",
|
35
|
+
"@vitessce/vit-s": "3.5.0",
|
36
|
+
"@vitessce/gl": "3.5.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"react": "^18.0.0",
|
package/src/CellSetSizesPlot.js
CHANGED
package/src/dot-plot-hook.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/* eslint-disable max-len */
|
2
2
|
import { useMemo } from 'react';
|
3
3
|
import { InternMap } from 'internmap';
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
@@ -68,10 +68,9 @@ export function useExpressionSummaries(
|
|
68
68
|
);
|
69
69
|
|
70
70
|
const result = [];
|
71
|
-
Array.from(dotData.
|
72
|
-
Array.from(
|
73
|
-
Array.from(
|
74
|
-
const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
|
71
|
+
Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
72
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
73
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
|
75
74
|
const featureName = geneKey;
|
76
75
|
result.push({
|
77
76
|
key: uuidv4(), // Unique key for this dot.
|
package/src/expr-hooks.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/* eslint-disable camelcase */
|
2
|
+
/* eslint-disable max-len */
|
2
3
|
import { InternMap } from 'internmap';
|
3
4
|
import { scaleLinear } from 'd3-scale';
|
4
5
|
import {
|
@@ -57,26 +58,23 @@ export function dotStratifiedExpressionData(
|
|
57
58
|
stratifiedResult, posThreshold,
|
58
59
|
) {
|
59
60
|
const result = new InternMap([], JSON.stringify);
|
60
|
-
Array.from(stratifiedResult.
|
61
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
61
62
|
result.set(cellSetKey, new InternMap([], JSON.stringify));
|
62
|
-
Array.from(
|
63
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
63
64
|
result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
};
|
78
|
-
|
79
|
-
result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
|
65
|
+
Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values]) => {
|
66
|
+
if (values) {
|
67
|
+
const exprMean = d3_mean(values);
|
68
|
+
const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
|
69
|
+
const fracPos = numPos / values.length;
|
70
|
+
|
71
|
+
const dotSummary = {
|
72
|
+
meanExpInGroup: exprMean,
|
73
|
+
fracPosInGroup: fracPos,
|
74
|
+
};
|
75
|
+
|
76
|
+
result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
|
77
|
+
}
|
80
78
|
});
|
81
79
|
});
|
82
80
|
});
|
@@ -95,10 +93,10 @@ export function summarizeStratifiedExpressionData(
|
|
95
93
|
) {
|
96
94
|
const summarizedResult = new InternMap([], JSON.stringify);
|
97
95
|
|
98
|
-
Array.from(stratifiedResult.
|
96
|
+
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
99
97
|
summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
|
100
|
-
Array.from(
|
101
|
-
const values =
|
98
|
+
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
99
|
+
const values = secondLevelInternMap;
|
102
100
|
const summary = summarize(values, keepZeros);
|
103
101
|
summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
|
104
102
|
});
|
@@ -119,13 +117,15 @@ export function summarizeStratifiedExpressionData(
|
|
119
117
|
export function histogramStratifiedExpressionData(
|
120
118
|
summarizedResult, binCount, yMinProp,
|
121
119
|
) {
|
122
|
-
const groupSummaries = Array.from(summarizedResult.
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
120
|
+
const groupSummaries = Array.from(summarizedResult.entries())
|
121
|
+
.map(([cellSetKey, firstLevelInternMap]) => ({
|
122
|
+
key: cellSetKey,
|
123
|
+
value: Array.from(firstLevelInternMap.entries())
|
124
|
+
.map(([sampleSetKey, secondLevelInternMap]) => ({
|
125
|
+
key: sampleSetKey,
|
126
|
+
value: secondLevelInternMap,
|
127
|
+
})),
|
128
|
+
}));
|
129
129
|
|
130
130
|
const groupData = groupSummaries
|
131
131
|
.map(({ key, value }) => ({
|
@@ -134,7 +134,9 @@ export function histogramStratifiedExpressionData(
|
|
134
134
|
{ key: subKey, value: subValue.nonOutliers }
|
135
135
|
)),
|
136
136
|
}));
|
137
|
-
const trimmedData = groupData
|
137
|
+
const trimmedData = groupData
|
138
|
+
.map(kv => kv.value.map(subKv => subKv.value).flat())
|
139
|
+
.flat();
|
138
140
|
|
139
141
|
const yMin = (yMinProp === null ? Math.min(0, min(trimmedData)) : yMinProp);
|
140
142
|
|
@@ -152,8 +154,10 @@ export function histogramStratifiedExpressionData(
|
|
152
154
|
value: kv.value.map(subKv => (
|
153
155
|
{ key: subKv.key, value: histogram(subKv.value) }
|
154
156
|
)) }));
|
155
|
-
const groupBinsMax = max(
|
156
|
-
|
157
|
+
const groupBinsMax = max(
|
158
|
+
groupBins
|
159
|
+
.flatMap(d => d.value.flatMap(subKv => subKv.value.map(v => v.length))),
|
160
|
+
);
|
157
161
|
|
158
162
|
return {
|
159
163
|
// Array of [{ key, value: [
|