@vitessce/statistical-plots 3.5.9 → 3.5.11
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-19841f78.js → deflate-b8c6daae.js} +1 -1
- package/dist/{index-dc733355.js → index-134a71c6.js} +33739 -15506
- package/dist/index.js +6 -5
- package/dist/{jpeg-a83077be.js → jpeg-1b818d11.js} +1 -1
- package/dist/{lerc-1edd075a.js → lerc-f38cbdfc.js} +1 -1
- package/dist/{lzw-9572eac3.js → lzw-1120aba9.js} +1 -1
- package/dist/{packbits-cce11fbc.js → packbits-2d02b5e3.js} +1 -1
- package/dist/{raw-f7587aff.js → raw-0887baec.js} +1 -1
- package/dist/{webimage-8d38cd8b.js → webimage-533922a5.js} +1 -1
- package/dist-tsc/CellSetCompositionBarPlot.d.ts.map +1 -1
- package/dist-tsc/CellSetCompositionBarPlot.js +31 -10
- package/dist-tsc/CellSetCompositionBarPlotSubscriber.js +1 -1
- package/dist-tsc/CellSetExpressionPlot.d.ts.map +1 -1
- package/dist-tsc/CellSetExpressionPlot.js +26 -10
- package/dist-tsc/CellSetExpressionPlotOptions.d.ts.map +1 -1
- package/dist-tsc/CellSetExpressionPlotOptions.js +11 -4
- package/dist-tsc/CellSetExpressionPlotSubscriber.d.ts.map +1 -1
- package/dist-tsc/CellSetExpressionPlotSubscriber.js +46 -11
- package/dist-tsc/DotPlot.d.ts.map +1 -1
- package/dist-tsc/DotPlot.js +59 -6
- package/dist-tsc/DotPlotSubscriber.d.ts.map +1 -1
- package/dist-tsc/DotPlotSubscriber.js +1 -1
- package/dist-tsc/FeatureSetEnrichmentBarPlot.d.ts.map +1 -1
- package/dist-tsc/FeatureSetEnrichmentBarPlot.js +7 -6
- package/dist-tsc/FeatureSetEnrichmentBarPlotSubscriber.d.ts.map +1 -1
- package/dist-tsc/FeatureSetEnrichmentBarPlotSubscriber.js +5 -2
- package/dist-tsc/FeatureStatsTable.d.ts +2 -0
- package/dist-tsc/FeatureStatsTable.d.ts.map +1 -0
- package/dist-tsc/FeatureStatsTable.js +81 -0
- package/dist-tsc/FeatureStatsTableSubscriber.d.ts +2 -0
- package/dist-tsc/FeatureStatsTableSubscriber.d.ts.map +1 -0
- package/dist-tsc/FeatureStatsTableSubscriber.js +28 -0
- package/dist-tsc/Treemap.d.ts.map +1 -1
- package/dist-tsc/Treemap.js +17 -3
- package/dist-tsc/TreemapSubscriber.d.ts.map +1 -1
- package/dist-tsc/TreemapSubscriber.js +15 -9
- package/dist-tsc/VolcanoPlot.d.ts.map +1 -1
- package/dist-tsc/VolcanoPlot.js +15 -46
- package/dist-tsc/VolcanoPlotSubscriber.d.ts.map +1 -1
- package/dist-tsc/VolcanoPlotSubscriber.js +4 -2
- package/dist-tsc/expr-hooks.d.ts.map +1 -1
- package/dist-tsc/expr-hooks.test.js +2 -1
- package/dist-tsc/index.d.ts +1 -0
- package/dist-tsc/index.js +1 -0
- package/dist-tsc/utils.d.ts +1 -0
- package/dist-tsc/utils.d.ts.map +1 -1
- package/dist-tsc/utils.js +56 -0
- package/package.json +8 -7
- package/src/CellSetCompositionBarPlot.js +38 -12
- package/src/CellSetCompositionBarPlotSubscriber.js +1 -1
- package/src/CellSetExpressionPlot.js +33 -10
- package/src/CellSetExpressionPlotOptions.js +39 -2
- package/src/CellSetExpressionPlotSubscriber.js +56 -13
- package/src/DotPlot.js +81 -11
- package/src/DotPlotSubscriber.js +3 -1
- package/src/FeatureSetEnrichmentBarPlot.js +7 -6
- package/src/FeatureSetEnrichmentBarPlotSubscriber.js +5 -2
- package/src/FeatureStatsTable.js +116 -0
- package/src/FeatureStatsTableSubscriber.js +133 -0
- package/src/Treemap.js +21 -3
- package/src/TreemapSubscriber.js +26 -11
- package/src/VolcanoPlot.js +16 -64
- package/src/VolcanoPlotSubscriber.js +6 -1
- package/src/expr-hooks.js +0 -1
- package/src/expr-hooks.test.js +2 -1
- package/src/index.js +1 -0
- package/src/utils.js +82 -1
package/src/utils.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
/* eslint-disable camelcase */
|
1
2
|
import { useMemo } from 'react';
|
2
3
|
import { isEqual } from 'lodash-es';
|
3
4
|
import { colorArrayToString } from '@vitessce/sets-utils';
|
4
5
|
import { getDefaultColor } from '@vitessce/utils';
|
5
6
|
|
6
|
-
|
7
7
|
function createOrdinalScale(domainArr, rangeArr) {
|
8
8
|
return (queryVal) => {
|
9
9
|
const i = domainArr.findIndex(domainVal => isEqual(domainVal, queryVal));
|
@@ -45,3 +45,84 @@ export function useRawSetPaths(columnNameMapping, setPaths) {
|
|
45
45
|
return newSetPath;
|
46
46
|
}), [columnNameMapping, setPaths]);
|
47
47
|
}
|
48
|
+
|
49
|
+
// Data transformation hook function that is used both here
|
50
|
+
// and in the FeatureStatsTable view.
|
51
|
+
export function useFilteredVolcanoData(props) {
|
52
|
+
const {
|
53
|
+
data,
|
54
|
+
obsSetsColumnNameMappingReversed,
|
55
|
+
sampleSetsColumnNameMappingReversed,
|
56
|
+
featurePointFoldChangeThreshold,
|
57
|
+
featurePointSignificanceThreshold,
|
58
|
+
sampleSetSelection,
|
59
|
+
} = props;
|
60
|
+
|
61
|
+
|
62
|
+
const computedData = useMemo(() => data.map((d) => {
|
63
|
+
const { metadata } = d;
|
64
|
+
|
65
|
+
const coordinationValues = metadata.coordination_values;
|
66
|
+
|
67
|
+
const rawObsSetPath = coordinationValues.obsSetFilter
|
68
|
+
? coordinationValues.obsSetFilter[0]
|
69
|
+
: coordinationValues.obsSetSelection[0];
|
70
|
+
const obsSetPath = [...rawObsSetPath];
|
71
|
+
obsSetPath[0] = obsSetsColumnNameMappingReversed[rawObsSetPath[0]];
|
72
|
+
|
73
|
+
// Swap the foldchange direction if backwards with
|
74
|
+
// respect to the current sampleSetSelection pair.
|
75
|
+
// TODO: move this swapping into the computedData useMemo?
|
76
|
+
let shouldSwapFoldChangeDirection = false;
|
77
|
+
if (
|
78
|
+
coordinationValues.sampleSetFilter
|
79
|
+
&& coordinationValues.sampleSetFilter.length === 2
|
80
|
+
) {
|
81
|
+
const rawSampleSetPathA = coordinationValues.sampleSetFilter[0];
|
82
|
+
const sampleSetPathA = [...rawSampleSetPathA];
|
83
|
+
sampleSetPathA[0] = sampleSetsColumnNameMappingReversed[rawSampleSetPathA[0]];
|
84
|
+
|
85
|
+
const rawSampleSetPathB = coordinationValues.sampleSetFilter[1];
|
86
|
+
const sampleSetPathB = [...rawSampleSetPathB];
|
87
|
+
sampleSetPathB[0] = sampleSetsColumnNameMappingReversed[rawSampleSetPathB[0]];
|
88
|
+
|
89
|
+
if (
|
90
|
+
isEqual(sampleSetPathA, sampleSetSelection[1])
|
91
|
+
&& isEqual(sampleSetPathB, sampleSetSelection[0])
|
92
|
+
) {
|
93
|
+
shouldSwapFoldChangeDirection = true;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
return ({
|
98
|
+
...d,
|
99
|
+
df: {
|
100
|
+
...d.df,
|
101
|
+
minusLog10p: d.df.featureSignificance.map(v => -Math.log10(v)),
|
102
|
+
logFoldChange: d.df.featureFoldChange.map(v => (
|
103
|
+
Math.log2(v) * (shouldSwapFoldChangeDirection ? -1 : 1)
|
104
|
+
)),
|
105
|
+
},
|
106
|
+
});
|
107
|
+
}), [
|
108
|
+
data, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMappingReversed,
|
109
|
+
sampleSetSelection,
|
110
|
+
]);
|
111
|
+
|
112
|
+
const filteredData = useMemo(() => computedData.map(obj => ({
|
113
|
+
...obj,
|
114
|
+
// Instead of an object of one array per column,
|
115
|
+
// this is now an array of one object per row.
|
116
|
+
df: obj.df.featureId.map((featureId, i) => ({
|
117
|
+
featureId,
|
118
|
+
logFoldChange: obj.df.logFoldChange[i],
|
119
|
+
featureSignificance: obj.df.featureSignificance[i],
|
120
|
+
minusLog10p: obj.df.minusLog10p[i],
|
121
|
+
})).filter(d => (
|
122
|
+
(Math.abs(d.logFoldChange) >= (featurePointFoldChangeThreshold ?? 1.0))
|
123
|
+
&& (d.featureSignificance <= (featurePointSignificanceThreshold ?? 0.05))
|
124
|
+
)),
|
125
|
+
})), [computedData, featurePointFoldChangeThreshold, featurePointSignificanceThreshold]);
|
126
|
+
|
127
|
+
return [computedData, filteredData];
|
128
|
+
}
|