@vitessce/biomarker-select 3.5.7 → 3.5.9
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/index.js +368 -19
- package/dist-tsc/BiomarkerSelectSubscriber.d.ts.map +1 -1
- package/dist-tsc/BiomarkerSelectSubscriber.js +65 -9
- package/dist-tsc/ComparativeHeadingSubscriber.d.ts +2 -0
- package/dist-tsc/ComparativeHeadingSubscriber.d.ts.map +1 -0
- package/dist-tsc/ComparativeHeadingSubscriber.js +45 -0
- package/dist-tsc/default-async-functions.d.ts.map +1 -1
- package/dist-tsc/default-async-functions.js +1 -0
- package/dist-tsc/index.d.ts +1 -0
- package/dist-tsc/index.js +1 -0
- package/dist-tsc/scmd-ui.d.ts.map +1 -1
- package/dist-tsc/scmd-ui.js +3 -2
- package/dist-tsc/{confirmatory-stepper.d.ts → stepper-confirmatory.d.ts} +1 -1
- package/dist-tsc/stepper-confirmatory.d.ts.map +1 -0
- package/dist-tsc/stepper-exploratory.d.ts +2 -0
- package/dist-tsc/stepper-exploratory.d.ts.map +1 -0
- package/dist-tsc/stepper-exploratory.js +61 -0
- package/package.json +4 -4
- package/src/BiomarkerSelectSubscriber.js +82 -8
- package/src/ComparativeHeadingSubscriber.js +87 -0
- package/src/default-async-functions.js +1 -0
- package/src/index.js +1 -0
- package/src/scmd-ui.js +18 -2
- package/src/stepper-exploratory.js +175 -0
- package/dist-tsc/confirmatory-stepper.d.ts.map +0 -1
- /package/dist-tsc/{confirmatory-stepper.js → stepper-confirmatory.js} +0 -0
- /package/src/{confirmatory-stepper.js → stepper-confirmatory.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import React__default, { Children, isValidElement, cloneElement, createElement, PureComponent, useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
3
|
-
import { useCoordination, useViewConfigStoreApi, useViewConfig, useSetViewConfig, useAsyncFunction } from "@vitessce/vit-s";
|
|
3
|
+
import { useLoaders, useCoordination, useViewConfigStoreApi, useViewConfig, useSetViewConfig, useMatchingLoader, useColumnNameMapping, useAsyncFunction, useComparisonMetadata } from "@vitessce/vit-s";
|
|
4
4
|
import * as ReactDOM from "react-dom";
|
|
5
5
|
import ReactDOM__default from "react-dom";
|
|
6
6
|
function getDefaultExportFromCjs(x) {
|
|
@@ -909,11 +909,36 @@ const ViewType = {
|
|
|
909
909
|
FEATURE_VALUE_HISTOGRAM: "featureValueHistogram",
|
|
910
910
|
DOT_PLOT: "dotPlot",
|
|
911
911
|
FEATURE_BAR_PLOT: "featureBarPlot",
|
|
912
|
+
VOLCANO_PLOT: "volcanoPlot",
|
|
913
|
+
OBS_SET_COMPOSITION_BAR_PLOT: "obsSetCompositionBarPlot",
|
|
914
|
+
FEATURE_SET_ENRICHMENT_BAR_PLOT: "featureSetEnrichmentBarPlot",
|
|
912
915
|
BIOMARKER_SELECT: "biomarkerSelect",
|
|
916
|
+
COMPARATIVE_HEADING: "comparativeHeading",
|
|
913
917
|
LINK_CONTROLLER: "linkController",
|
|
918
|
+
NEUROGLANCER: "neuroglancer",
|
|
914
919
|
DUAL_SCATTERPLOT: "dualScatterplot",
|
|
915
920
|
TREEMAP: "treemap"
|
|
916
921
|
};
|
|
922
|
+
const DataType = {
|
|
923
|
+
OBS_LABELS: "obsLabels",
|
|
924
|
+
OBS_EMBEDDING: "obsEmbedding",
|
|
925
|
+
OBS_FEATURE_MATRIX: "obsFeatureMatrix",
|
|
926
|
+
OBS_SETS: "obsSets",
|
|
927
|
+
FEATURE_LABELS: "featureLabels",
|
|
928
|
+
IMAGE: "image",
|
|
929
|
+
OBS_SEGMENTATIONS: "obsSegmentations",
|
|
930
|
+
NEIGHBORHOODS: "neighborhoods",
|
|
931
|
+
GENOMIC_PROFILES: "genomic-profiles",
|
|
932
|
+
OBS_SPOTS: "obsSpots",
|
|
933
|
+
OBS_POINTS: "obsPoints",
|
|
934
|
+
OBS_LOCATIONS: "obsLocations",
|
|
935
|
+
SAMPLE_SETS: "sampleSets",
|
|
936
|
+
SAMPLE_EDGES: "sampleEdges",
|
|
937
|
+
COMPARISON_METADATA: "comparisonMetadata",
|
|
938
|
+
FEATURE_STATS: "featureStats",
|
|
939
|
+
FEATURE_SET_STATS: "featureSetStats",
|
|
940
|
+
OBS_SET_STATS: "obsSetStats"
|
|
941
|
+
};
|
|
917
942
|
const AsyncFunctionType = {
|
|
918
943
|
// String input (rather than Node input)
|
|
919
944
|
AUTOCOMPLETE_FEATURE: "autocompleteFeature",
|
|
@@ -1073,10 +1098,18 @@ const CoordinationType = {
|
|
|
1073
1098
|
EMBEDDING_CONTOUR_PERCENTILES: "embeddingContourPercentiles",
|
|
1074
1099
|
CONTOUR_COLOR_ENCODING: "contourColorEncoding",
|
|
1075
1100
|
CONTOUR_COLOR: "contourColor",
|
|
1101
|
+
// For volcano plot:
|
|
1102
|
+
FEATURE_POINT_SIGNIFICANCE_THRESHOLD: "featurePointSignificanceThreshold",
|
|
1103
|
+
FEATURE_LABEL_SIGNIFICANCE_THRESHOLD: "featureLabelSignificanceThreshold",
|
|
1104
|
+
FEATURE_POINT_FOLD_CHANGE_THRESHOLD: "featurePointFoldChangeThreshold",
|
|
1105
|
+
FEATURE_LABEL_FOLD_CHANGE_THRESHOLD: "featureLabelFoldChangeThreshold",
|
|
1076
1106
|
// Treemap
|
|
1077
1107
|
HIERARCHY_LEVELS: "hierarchyLevels"
|
|
1078
1108
|
};
|
|
1079
1109
|
const COMPONENT_COORDINATION_TYPES = {
|
|
1110
|
+
[ViewType.NEUROGLANCER]: [
|
|
1111
|
+
CoordinationType.DATASET
|
|
1112
|
+
],
|
|
1080
1113
|
[ViewType.SCATTERPLOT]: [
|
|
1081
1114
|
CoordinationType.DATASET,
|
|
1082
1115
|
CoordinationType.OBS_TYPE,
|
|
@@ -1546,8 +1579,64 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1546
1579
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
1547
1580
|
CoordinationType.ADDITIONAL_OBS_SETS
|
|
1548
1581
|
],
|
|
1582
|
+
[ViewType.VOLCANO_PLOT]: [
|
|
1583
|
+
CoordinationType.DATASET,
|
|
1584
|
+
CoordinationType.OBS_TYPE,
|
|
1585
|
+
CoordinationType.FEATURE_TYPE,
|
|
1586
|
+
CoordinationType.SAMPLE_TYPE,
|
|
1587
|
+
// For selection of case-control sets of samples:
|
|
1588
|
+
CoordinationType.SAMPLE_SET_SELECTION,
|
|
1589
|
+
// For selection of one-vs-others sets of observations:
|
|
1590
|
+
CoordinationType.OBS_SET_SELECTION,
|
|
1591
|
+
// TODO: CoordinationType.FEATURE_SET_SELECTION,
|
|
1592
|
+
// TODO: CoordinationType.FEATURE_SET_HIGHLIGHT,
|
|
1593
|
+
// TODO: CoordinationType.FEATURE_SET_COLOR,
|
|
1594
|
+
CoordinationType.FEATURE_HIGHLIGHT,
|
|
1595
|
+
CoordinationType.FEATURE_SELECTION,
|
|
1596
|
+
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
1597
|
+
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
1598
|
+
// TODO: CoordinationType.FEATURE_COLOR_ENCODING,
|
|
1599
|
+
// TODO: CoordinationType.ADDITIONAL_FEATURE_SETS,
|
|
1600
|
+
CoordinationType.TOOLTIPS_VISIBLE,
|
|
1601
|
+
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
1602
|
+
CoordinationType.OBS_SET_COLOR,
|
|
1603
|
+
CoordinationType.SAMPLE_SET_COLOR,
|
|
1604
|
+
CoordinationType.FEATURE_POINT_SIGNIFICANCE_THRESHOLD,
|
|
1605
|
+
CoordinationType.FEATURE_LABEL_SIGNIFICANCE_THRESHOLD,
|
|
1606
|
+
CoordinationType.FEATURE_POINT_FOLD_CHANGE_THRESHOLD,
|
|
1607
|
+
CoordinationType.FEATURE_LABEL_FOLD_CHANGE_THRESHOLD
|
|
1608
|
+
],
|
|
1609
|
+
[ViewType.OBS_SET_COMPOSITION_BAR_PLOT]: [
|
|
1610
|
+
CoordinationType.DATASET,
|
|
1611
|
+
CoordinationType.OBS_TYPE,
|
|
1612
|
+
CoordinationType.SAMPLE_TYPE,
|
|
1613
|
+
// For selection of case-control sets of samples:
|
|
1614
|
+
CoordinationType.SAMPLE_SET_SELECTION,
|
|
1615
|
+
// For selection of one-vs-others sets of observations:
|
|
1616
|
+
CoordinationType.OBS_SET_SELECTION,
|
|
1617
|
+
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
1618
|
+
CoordinationType.OBS_SET_COLOR,
|
|
1619
|
+
CoordinationType.SAMPLE_SET_COLOR
|
|
1620
|
+
],
|
|
1621
|
+
[ViewType.FEATURE_SET_ENRICHMENT_BAR_PLOT]: [
|
|
1622
|
+
CoordinationType.DATASET,
|
|
1623
|
+
CoordinationType.OBS_TYPE,
|
|
1624
|
+
CoordinationType.FEATURE_TYPE,
|
|
1625
|
+
CoordinationType.SAMPLE_TYPE,
|
|
1626
|
+
// For selection of case-control sets of samples:
|
|
1627
|
+
CoordinationType.SAMPLE_SET_SELECTION,
|
|
1628
|
+
// For selection of one-vs-others sets of observations:
|
|
1629
|
+
CoordinationType.OBS_SET_SELECTION,
|
|
1630
|
+
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
1631
|
+
CoordinationType.OBS_SET_COLOR,
|
|
1632
|
+
CoordinationType.SAMPLE_SET_COLOR,
|
|
1633
|
+
CoordinationType.FEATURE_SELECTION
|
|
1634
|
+
],
|
|
1549
1635
|
[ViewType.LINK_CONTROLLER]: [],
|
|
1550
1636
|
[ViewType.BIOMARKER_SELECT]: [
|
|
1637
|
+
CoordinationType.DATASET,
|
|
1638
|
+
CoordinationType.OBS_TYPE,
|
|
1639
|
+
CoordinationType.SAMPLE_TYPE,
|
|
1551
1640
|
CoordinationType.FEATURE_SELECTION,
|
|
1552
1641
|
CoordinationType.SAMPLE_SET_SELECTION,
|
|
1553
1642
|
CoordinationType.SAMPLE_SET_FILTER,
|
|
@@ -1555,6 +1644,16 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1555
1644
|
CoordinationType.OBS_SET_FILTER
|
|
1556
1645
|
// TODO: create coordination types for internal state of the biomarker selection view?
|
|
1557
1646
|
],
|
|
1647
|
+
[ViewType.COMPARATIVE_HEADING]: [
|
|
1648
|
+
CoordinationType.DATASET,
|
|
1649
|
+
CoordinationType.OBS_TYPE,
|
|
1650
|
+
CoordinationType.SAMPLE_TYPE,
|
|
1651
|
+
CoordinationType.FEATURE_SELECTION,
|
|
1652
|
+
CoordinationType.SAMPLE_SET_SELECTION,
|
|
1653
|
+
CoordinationType.SAMPLE_SET_FILTER,
|
|
1654
|
+
CoordinationType.OBS_SET_SELECTION,
|
|
1655
|
+
CoordinationType.OBS_SET_FILTER
|
|
1656
|
+
],
|
|
1558
1657
|
[ViewType.TREEMAP]: [
|
|
1559
1658
|
CoordinationType.DATASET,
|
|
1560
1659
|
CoordinationType.OBS_TYPE,
|
|
@@ -22363,7 +22462,7 @@ const ExpandMoreIcon = createSvgIcon(/* @__PURE__ */ React.createElement("path",
|
|
|
22363
22462
|
const InfoIcon = createSvgIcon(/* @__PURE__ */ React.createElement("path", {
|
|
22364
22463
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
22365
22464
|
}), "Info");
|
|
22366
|
-
const useStyles = makeStyles(() => ({
|
|
22465
|
+
const useStyles$1 = makeStyles(() => ({
|
|
22367
22466
|
header: {
|
|
22368
22467
|
marginTop: "10px",
|
|
22369
22468
|
marginBottom: "10px"
|
|
@@ -22406,7 +22505,7 @@ function ConfirmatoryCart(props) {
|
|
|
22406
22505
|
// eslint-disable-next-line no-unused-vars
|
|
22407
22506
|
setCurrentStratificationSelection
|
|
22408
22507
|
} = props;
|
|
22409
|
-
const classes = useStyles();
|
|
22508
|
+
const classes = useStyles$1();
|
|
22410
22509
|
const [expandedAccordions, setExpandedAccordions] = React__default.useState([
|
|
22411
22510
|
"agnostic",
|
|
22412
22511
|
"specific",
|
|
@@ -24668,7 +24767,7 @@ function SelectAgnostic(props) {
|
|
|
24668
24767
|
currentModalityAgnosticSelection,
|
|
24669
24768
|
setCurrentModalityAgnosticSelection
|
|
24670
24769
|
} = props;
|
|
24671
|
-
const classes = useStyles();
|
|
24770
|
+
const classes = useStyles$1();
|
|
24672
24771
|
const [selectedItem, setSelectedItem] = React__default.useState(null);
|
|
24673
24772
|
const [potentialItems, setPotentialItems] = React__default.useState([]);
|
|
24674
24773
|
const handleChange = async (event) => {
|
|
@@ -30651,7 +30750,7 @@ function SelectSpecific(props) {
|
|
|
30651
30750
|
setCurrentModalitySpecificSelection,
|
|
30652
30751
|
getEdges
|
|
30653
30752
|
} = props;
|
|
30654
|
-
const classes = useStyles();
|
|
30753
|
+
const classes = useStyles$1();
|
|
30655
30754
|
const queries = useQueries({
|
|
30656
30755
|
queries: (currentModalityAgnosticSelection == null ? void 0 : currentModalityAgnosticSelection.map((item) => ({
|
|
30657
30756
|
queryKey: [item.nodeType, item.kgId],
|
|
@@ -30769,7 +30868,7 @@ function SelectStratification(props) {
|
|
|
30769
30868
|
) })
|
|
30770
30869
|
] });
|
|
30771
30870
|
}
|
|
30772
|
-
const steps = [
|
|
30871
|
+
const steps$1 = [
|
|
30773
30872
|
"Select biomarkers (modality-agnostic)",
|
|
30774
30873
|
"Derive modality-specific biomarker signature",
|
|
30775
30874
|
"Define case-control stratification"
|
|
@@ -30787,7 +30886,7 @@ function ConfirmatoryStepper(props) {
|
|
|
30787
30886
|
stratifications,
|
|
30788
30887
|
onFinish
|
|
30789
30888
|
} = props;
|
|
30790
|
-
const classes = useStyles();
|
|
30889
|
+
const classes = useStyles$1();
|
|
30791
30890
|
const [activeStep, setActiveStep] = React__default.useState(0);
|
|
30792
30891
|
const [skipped, setSkipped] = React__default.useState(/* @__PURE__ */ new Set());
|
|
30793
30892
|
const isStepOptional = (step) => step === 2;
|
|
@@ -30819,12 +30918,12 @@ function ConfirmatoryStepper(props) {
|
|
|
30819
30918
|
setActiveStep(0);
|
|
30820
30919
|
};
|
|
30821
30920
|
useEffect(() => {
|
|
30822
|
-
if (activeStep === steps.length) {
|
|
30921
|
+
if (activeStep === steps$1.length) {
|
|
30823
30922
|
onFinish();
|
|
30824
30923
|
}
|
|
30825
|
-
}, [activeStep, steps]);
|
|
30924
|
+
}, [activeStep, steps$1]);
|
|
30826
30925
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid$1, { item: true, container: true, xs: 12, children: [
|
|
30827
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { className: classes.fullWidthBox, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Stepper$1, { activeStep, children: steps.map((label, index) => {
|
|
30926
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { className: classes.fullWidthBox, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Stepper$1, { activeStep, children: steps$1.map((label, index) => {
|
|
30828
30927
|
const stepProps = {};
|
|
30829
30928
|
const labelProps = {};
|
|
30830
30929
|
if (isStepOptional(index)) {
|
|
@@ -30836,7 +30935,7 @@ function ConfirmatoryStepper(props) {
|
|
|
30836
30935
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Step$1, { ...stepProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StepLabel$1, { ...labelProps, children: label }) }, label);
|
|
30837
30936
|
}) }) }) }),
|
|
30838
30937
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Grid$1, { item: true, container: true, xs: 12, style: { marginTop: "20px" }, alignItems: "flex-start", children: [
|
|
30839
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 8, children: activeStep === steps.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1, { style: { marginTop: "20px", marginBottom: "10px" }, children: "All steps completed - you're finished" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
30938
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 8, children: activeStep === steps$1.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1, { style: { marginTop: "20px", marginBottom: "10px" }, children: "All steps completed - you're finished" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
30840
30939
|
activeStep === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30841
30940
|
SelectAgnostic,
|
|
30842
30941
|
{
|
|
@@ -30892,6 +30991,118 @@ function ConfirmatoryStepper(props) {
|
|
|
30892
30991
|
stratifications
|
|
30893
30992
|
}
|
|
30894
30993
|
) }),
|
|
30994
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { className: classes.fullWidthBox, children: activeStep === steps$1.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box$1, { style: { display: "flex", flexDirection: "row", paddingTop: "20px" }, children: [
|
|
30995
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { style: { flex: "1 1 auto" } }),
|
|
30996
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: handleReset, children: "Reset" })
|
|
30997
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Box$1, { style: { display: "flex", flexDirection: "row", paddingTop: "20px" }, children: [
|
|
30998
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30999
|
+
Button$1,
|
|
31000
|
+
{
|
|
31001
|
+
color: "inherit",
|
|
31002
|
+
disabled: activeStep === 0,
|
|
31003
|
+
onClick: handleBack,
|
|
31004
|
+
style: { mr: 1 },
|
|
31005
|
+
children: "Back"
|
|
31006
|
+
}
|
|
31007
|
+
),
|
|
31008
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { style: { flex: "1 1 auto" } }),
|
|
31009
|
+
isStepOptional(activeStep) && /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { color: "inherit", onClick: handleSkip, style: { marginRight: "10px" }, children: "Skip" }),
|
|
31010
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: handleNext, children: activeStep === steps$1.length - 1 ? "Finish" : "Next" })
|
|
31011
|
+
] }) })
|
|
31012
|
+
] })
|
|
31013
|
+
] });
|
|
31014
|
+
}
|
|
31015
|
+
const steps = [
|
|
31016
|
+
"Define case-control stratification"
|
|
31017
|
+
];
|
|
31018
|
+
function ExploratoryStepper(props) {
|
|
31019
|
+
const {
|
|
31020
|
+
autocompleteNode,
|
|
31021
|
+
currentModalityAgnosticSelection,
|
|
31022
|
+
setCurrentModalityAgnosticSelection,
|
|
31023
|
+
currentModalitySpecificSelection,
|
|
31024
|
+
setCurrentModalitySpecificSelection,
|
|
31025
|
+
currentStratificationSelection,
|
|
31026
|
+
setCurrentStratificationSelection,
|
|
31027
|
+
getEdges,
|
|
31028
|
+
stratifications,
|
|
31029
|
+
onFinish
|
|
31030
|
+
} = props;
|
|
31031
|
+
const classes = useStyles$1();
|
|
31032
|
+
const [activeStep, setActiveStep] = React__default.useState(0);
|
|
31033
|
+
const [skipped, setSkipped] = React__default.useState(/* @__PURE__ */ new Set());
|
|
31034
|
+
const isStepOptional = (step) => step === 2;
|
|
31035
|
+
const isStepSkipped = (step) => skipped.has(step);
|
|
31036
|
+
const handleNext = () => {
|
|
31037
|
+
let newSkipped = skipped;
|
|
31038
|
+
if (isStepSkipped(activeStep)) {
|
|
31039
|
+
newSkipped = new Set(newSkipped.values());
|
|
31040
|
+
newSkipped.delete(activeStep);
|
|
31041
|
+
}
|
|
31042
|
+
setActiveStep((prevActiveStep) => prevActiveStep + 1);
|
|
31043
|
+
setSkipped(newSkipped);
|
|
31044
|
+
};
|
|
31045
|
+
const handleBack = () => {
|
|
31046
|
+
setActiveStep((prevActiveStep) => prevActiveStep - 1);
|
|
31047
|
+
};
|
|
31048
|
+
const handleSkip = () => {
|
|
31049
|
+
if (!isStepOptional(activeStep)) {
|
|
31050
|
+
throw new Error("You can't skip a step that isn't optional.");
|
|
31051
|
+
}
|
|
31052
|
+
setActiveStep((prevActiveStep) => prevActiveStep + 1);
|
|
31053
|
+
setSkipped((prevSkipped) => {
|
|
31054
|
+
const newSkipped = new Set(prevSkipped.values());
|
|
31055
|
+
newSkipped.add(activeStep);
|
|
31056
|
+
return newSkipped;
|
|
31057
|
+
});
|
|
31058
|
+
};
|
|
31059
|
+
const handleReset = () => {
|
|
31060
|
+
setActiveStep(0);
|
|
31061
|
+
};
|
|
31062
|
+
useEffect(() => {
|
|
31063
|
+
if (activeStep === steps.length) {
|
|
31064
|
+
onFinish();
|
|
31065
|
+
}
|
|
31066
|
+
}, [activeStep, steps]);
|
|
31067
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid$1, { item: true, container: true, xs: 12, children: [
|
|
31068
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { className: classes.fullWidthBox, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Stepper$1, { activeStep, children: steps.map((label, index) => {
|
|
31069
|
+
const stepProps = {};
|
|
31070
|
+
const labelProps = {};
|
|
31071
|
+
if (isStepOptional(index)) {
|
|
31072
|
+
labelProps.optional = /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1, { variant: "caption", children: "Optional" });
|
|
31073
|
+
}
|
|
31074
|
+
if (isStepSkipped(index)) {
|
|
31075
|
+
stepProps.completed = false;
|
|
31076
|
+
}
|
|
31077
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Step$1, { ...stepProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StepLabel$1, { ...labelProps, children: label }) }, label);
|
|
31078
|
+
}) }) }) }),
|
|
31079
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Grid$1, { item: true, container: true, xs: 12, style: { marginTop: "20px" }, alignItems: "flex-start", children: [
|
|
31080
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 8, children: activeStep === steps.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography$1, { style: { marginTop: "20px", marginBottom: "10px" }, children: "All steps completed - you're finished" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: activeStep === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31081
|
+
SelectStratification,
|
|
31082
|
+
{
|
|
31083
|
+
autocompleteNode,
|
|
31084
|
+
currentModalityAgnosticSelection,
|
|
31085
|
+
setCurrentModalityAgnosticSelection,
|
|
31086
|
+
currentModalitySpecificSelection,
|
|
31087
|
+
setCurrentModalitySpecificSelection,
|
|
31088
|
+
currentStratificationSelection,
|
|
31089
|
+
setCurrentStratificationSelection,
|
|
31090
|
+
getEdges,
|
|
31091
|
+
stratifications
|
|
31092
|
+
}
|
|
31093
|
+
) : null }) }),
|
|
31094
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid$1, { item: true, container: true, xs: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31095
|
+
ConfirmatoryCart,
|
|
31096
|
+
{
|
|
31097
|
+
currentModalityAgnosticSelection,
|
|
31098
|
+
setCurrentModalityAgnosticSelection,
|
|
31099
|
+
currentModalitySpecificSelection,
|
|
31100
|
+
setCurrentModalitySpecificSelection,
|
|
31101
|
+
currentStratificationSelection,
|
|
31102
|
+
setCurrentStratificationSelection,
|
|
31103
|
+
stratifications
|
|
31104
|
+
}
|
|
31105
|
+
) }),
|
|
30895
31106
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { className: classes.fullWidthBox, children: activeStep === steps.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box$1, { style: { display: "flex", flexDirection: "row", paddingTop: "20px" }, children: [
|
|
30896
31107
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Box$1, { style: { flex: "1 1 auto" } }),
|
|
30897
31108
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: handleReset, children: "Reset" })
|
|
@@ -30930,7 +31141,7 @@ function ScmdUi(props) {
|
|
|
30930
31141
|
stratifications,
|
|
30931
31142
|
onFinish
|
|
30932
31143
|
} = props;
|
|
30933
|
-
const classes = useStyles();
|
|
31144
|
+
const classes = useStyles$1();
|
|
30934
31145
|
const mode = modeProp || "confirmatory";
|
|
30935
31146
|
const [tempIsVisible, setTempIsVisible] = useState(true);
|
|
30936
31147
|
const isConfirmatoryMode = mode === "confirmatory";
|
|
@@ -30958,22 +31169,60 @@ function ScmdUi(props) {
|
|
|
30958
31169
|
onFinish
|
|
30959
31170
|
}
|
|
30960
31171
|
) : null,
|
|
30961
|
-
mode === "exploratory" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31172
|
+
mode === "exploratory" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
31173
|
+
ExploratoryStepper,
|
|
31174
|
+
{
|
|
31175
|
+
autocompleteNode,
|
|
31176
|
+
currentModalityAgnosticSelection,
|
|
31177
|
+
setCurrentModalityAgnosticSelection,
|
|
31178
|
+
currentModalitySpecificSelection,
|
|
31179
|
+
setCurrentModalitySpecificSelection,
|
|
31180
|
+
currentStratificationSelection,
|
|
31181
|
+
setCurrentStratificationSelection,
|
|
31182
|
+
getEdges,
|
|
31183
|
+
stratifications,
|
|
31184
|
+
onFinish
|
|
31185
|
+
}
|
|
31186
|
+
) : null
|
|
30962
31187
|
] }) : null
|
|
30963
31188
|
] });
|
|
30964
31189
|
}
|
|
30965
31190
|
function BiomarkerSelectSubscriber(props) {
|
|
30966
31191
|
const {
|
|
30967
31192
|
coordinationScopes,
|
|
30968
|
-
stratificationOptions
|
|
31193
|
+
stratificationOptions: stratificationOptionsProp
|
|
31194
|
+
// TODO: Remove; Get from comparisonMetadata instead
|
|
30969
31195
|
} = props;
|
|
30970
|
-
|
|
31196
|
+
const loaders = useLoaders();
|
|
31197
|
+
const [{
|
|
31198
|
+
dataset,
|
|
31199
|
+
obsType,
|
|
31200
|
+
sampleType,
|
|
31201
|
+
sampleSetSelection,
|
|
31202
|
+
featureSelection
|
|
31203
|
+
}, {
|
|
31204
|
+
setSampleSetSelection,
|
|
31205
|
+
setFeatureSelection
|
|
31206
|
+
}] = useCoordination(
|
|
30971
31207
|
COMPONENT_COORDINATION_TYPES[ViewType.BIOMARKER_SELECT],
|
|
30972
31208
|
coordinationScopes
|
|
30973
31209
|
);
|
|
30974
31210
|
const viewConfigStoreApi = useViewConfigStoreApi();
|
|
30975
31211
|
const viewConfig = useViewConfig();
|
|
30976
31212
|
const setViewConfig = useSetViewConfig(viewConfigStoreApi);
|
|
31213
|
+
useMatchingLoader(
|
|
31214
|
+
loaders,
|
|
31215
|
+
dataset,
|
|
31216
|
+
DataType.OBS_SETS,
|
|
31217
|
+
{ obsType }
|
|
31218
|
+
);
|
|
31219
|
+
const sampleSetsLoader = useMatchingLoader(
|
|
31220
|
+
loaders,
|
|
31221
|
+
dataset,
|
|
31222
|
+
DataType.SAMPLE_SETS,
|
|
31223
|
+
{ sampleType }
|
|
31224
|
+
);
|
|
31225
|
+
const sampleSetsColumnNameMappingReversed = useColumnNameMapping(sampleSetsLoader, true);
|
|
30977
31226
|
const [isSelecting, setIsSelecting] = useState(true);
|
|
30978
31227
|
const [mode, setMode] = useState(null);
|
|
30979
31228
|
const [step, setStep] = useState(null);
|
|
@@ -30990,6 +31239,36 @@ function BiomarkerSelectSubscriber(props) {
|
|
|
30990
31239
|
async (node, targetModality) => transformFeature2(node, targetModality),
|
|
30991
31240
|
[transformFeature2]
|
|
30992
31241
|
);
|
|
31242
|
+
const [{ comparisonMetadata }, cmpMetadataStatus, cmpMetadataUrls] = useComparisonMetadata(
|
|
31243
|
+
loaders,
|
|
31244
|
+
dataset,
|
|
31245
|
+
false,
|
|
31246
|
+
{},
|
|
31247
|
+
{},
|
|
31248
|
+
{ obsType, sampleType }
|
|
31249
|
+
);
|
|
31250
|
+
const stratificationOptions = useMemo(() => {
|
|
31251
|
+
if (comparisonMetadata == null ? void 0 : comparisonMetadata.sample_group_pairs) {
|
|
31252
|
+
return comparisonMetadata.sample_group_pairs.map((sampleGroupPair) => {
|
|
31253
|
+
const [sampleGroupCol, sampleGroupValues] = sampleGroupPair;
|
|
31254
|
+
const [sampleGroupCtrl, sampleGroupCase] = sampleGroupValues;
|
|
31255
|
+
const groupName = sampleSetsColumnNameMappingReversed == null ? void 0 : sampleSetsColumnNameMappingReversed[sampleGroupCol];
|
|
31256
|
+
return {
|
|
31257
|
+
stratificationId: `${sampleGroupCol}_${sampleGroupCtrl}-vs-${sampleGroupCase}`,
|
|
31258
|
+
name: `${groupName}: ${sampleGroupCtrl} vs. ${sampleGroupCase}`,
|
|
31259
|
+
stratificationType: "sampleSet",
|
|
31260
|
+
sampleSets: [
|
|
31261
|
+
// With sampleSets coming from the comparison_metadata,
|
|
31262
|
+
// need to use loader options from obsSets and sampleSets to get mapping
|
|
31263
|
+
// from column name to group name.
|
|
31264
|
+
[groupName, sampleGroupCtrl],
|
|
31265
|
+
[groupName, sampleGroupCase]
|
|
31266
|
+
]
|
|
31267
|
+
};
|
|
31268
|
+
});
|
|
31269
|
+
}
|
|
31270
|
+
return null;
|
|
31271
|
+
}, [comparisonMetadata, sampleSetsColumnNameMappingReversed]);
|
|
30993
31272
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isSelecting ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30994
31273
|
ScmdUi,
|
|
30995
31274
|
{
|
|
@@ -31007,24 +31286,93 @@ function BiomarkerSelectSubscriber(props) {
|
|
|
31007
31286
|
getEdges,
|
|
31008
31287
|
stratifications: stratificationOptions,
|
|
31009
31288
|
onFinish: () => {
|
|
31010
|
-
|
|
31289
|
+
const newViewConfig = {
|
|
31011
31290
|
...viewConfig,
|
|
31012
31291
|
coordinationSpace: {
|
|
31013
31292
|
...viewConfig.coordinationSpace,
|
|
31014
31293
|
sampleSetFilter: {
|
|
31015
31294
|
...viewConfig.coordinationSpace.sampleSetFilter,
|
|
31016
|
-
|
|
31295
|
+
__comparison__: currentStratificationSelection == null ? void 0 : currentStratificationSelection.sampleSets
|
|
31017
31296
|
},
|
|
31018
31297
|
sampleSetSelection: {
|
|
31019
31298
|
...viewConfig.coordinationSpace.sampleSetSelection,
|
|
31020
|
-
|
|
31299
|
+
__comparison__: currentStratificationSelection == null ? void 0 : currentStratificationSelection.sampleSets
|
|
31300
|
+
},
|
|
31301
|
+
featureSelection: {
|
|
31302
|
+
...viewConfig.coordinationSpace.featureSelection,
|
|
31303
|
+
__comparison__: currentModalitySpecificSelection ? currentModalitySpecificSelection.map((d) => d.label) : null
|
|
31021
31304
|
}
|
|
31022
31305
|
}
|
|
31023
|
-
}
|
|
31306
|
+
};
|
|
31307
|
+
setViewConfig(newViewConfig);
|
|
31024
31308
|
}
|
|
31025
31309
|
}
|
|
31026
31310
|
) : null });
|
|
31027
31311
|
}
|
|
31312
|
+
const useStyles = makeStyles((theme) => ({
|
|
31313
|
+
buttonContainer: {
|
|
31314
|
+
position: "absolute",
|
|
31315
|
+
right: 0,
|
|
31316
|
+
display: "flex",
|
|
31317
|
+
flexDirection: "column",
|
|
31318
|
+
justifyContent: "center",
|
|
31319
|
+
height: "100%"
|
|
31320
|
+
},
|
|
31321
|
+
headingContainer: {
|
|
31322
|
+
backgroundColor: "transparent"
|
|
31323
|
+
},
|
|
31324
|
+
headingSectionContainer: {
|
|
31325
|
+
width: "100%",
|
|
31326
|
+
display: "flex",
|
|
31327
|
+
flexDirection: "row",
|
|
31328
|
+
position: "relative"
|
|
31329
|
+
},
|
|
31330
|
+
headingText: {
|
|
31331
|
+
margin: 0,
|
|
31332
|
+
color: theme.palette.primaryForeground
|
|
31333
|
+
}
|
|
31334
|
+
}));
|
|
31335
|
+
function ComparativeHeadingSubscriber(props) {
|
|
31336
|
+
var _a2, _b;
|
|
31337
|
+
const {
|
|
31338
|
+
coordinationScopes
|
|
31339
|
+
} = props;
|
|
31340
|
+
const [{
|
|
31341
|
+
sampleSetSelection,
|
|
31342
|
+
featureSelection
|
|
31343
|
+
}, {
|
|
31344
|
+
setSampleSetSelection
|
|
31345
|
+
// TODO: buttons for modification of featureSelection
|
|
31346
|
+
// setFeatureSelection,
|
|
31347
|
+
}] = useCoordination(
|
|
31348
|
+
COMPONENT_COORDINATION_TYPES[ViewType.COMPARATIVE_HEADING],
|
|
31349
|
+
coordinationScopes
|
|
31350
|
+
);
|
|
31351
|
+
const classes = useStyles();
|
|
31352
|
+
const swapSampleSets = useCallback(() => {
|
|
31353
|
+
if ((sampleSetSelection == null ? void 0 : sampleSetSelection.length) === 2) {
|
|
31354
|
+
setSampleSetSelection([
|
|
31355
|
+
sampleSetSelection[1],
|
|
31356
|
+
sampleSetSelection[0]
|
|
31357
|
+
]);
|
|
31358
|
+
}
|
|
31359
|
+
}, [sampleSetSelection, setSampleSetSelection]);
|
|
31360
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes.headingContainer, children: [
|
|
31361
|
+
sampleSetSelection && sampleSetSelection.length === 2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes.headingSectionContainer, children: [
|
|
31362
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "45%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: classes.headingText, children: (_a2 = sampleSetSelection == null ? void 0 : sampleSetSelection[0]) == null ? void 0 : _a2.at(-1) }) }),
|
|
31363
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "5%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: classes.headingText, style: { textAlign: "right" }, children: "vs. " }) }),
|
|
31364
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "50%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: classes.headingText, children: (_b = sampleSetSelection == null ? void 0 : sampleSetSelection[1]) == null ? void 0 : _b.at(-1) }) }),
|
|
31365
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes.buttonContainer, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: swapSampleSets, type: "button", children: "Swap" }) })
|
|
31366
|
+
] }) : null,
|
|
31367
|
+
featureSelection && featureSelection.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes.headingSectionContainer, children: [
|
|
31368
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: classes.headingText, children: "Selected Biomarkers: " }) }),
|
|
31369
|
+
featureSelection == null ? void 0 : featureSelection.map((featureName, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("h3", { className: classes.headingText, children: [
|
|
31370
|
+
featureName,
|
|
31371
|
+
i < featureSelection.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: ", " }) : null
|
|
31372
|
+
] }) }))
|
|
31373
|
+
] }) : null
|
|
31374
|
+
] });
|
|
31375
|
+
}
|
|
31028
31376
|
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
|
|
31029
31377
|
function objectConverter(columns2) {
|
|
31030
31378
|
return new Function("d", "return {" + columns2.map(function(name, i) {
|
|
@@ -32223,6 +32571,7 @@ async function getTermMapping({ queryClient }, keyCuriePrefix, valCuriePrefix) {
|
|
|
32223
32571
|
}
|
|
32224
32572
|
export {
|
|
32225
32573
|
BiomarkerSelectSubscriber,
|
|
32574
|
+
ComparativeHeadingSubscriber,
|
|
32226
32575
|
autocompleteFeature,
|
|
32227
32576
|
getAlternativeTerms,
|
|
32228
32577
|
getTermMapping,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiomarkerSelectSubscriber.d.ts","sourceRoot":"","sources":["../src/BiomarkerSelectSubscriber.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BiomarkerSelectSubscriber.d.ts","sourceRoot":"","sources":["../src/BiomarkerSelectSubscriber.js"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,iDAHG;IAA+F,qBAAqB,EAA5G;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;KAAC,EAAE;CACvF,eA0JF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
3
|
/* eslint-disable no-unused-vars */
|
|
4
|
-
import React, { useState, useCallback } from 'react';
|
|
5
|
-
import { useAsyncFunction, useViewConfigStoreApi, useSetViewConfig, useViewConfig, useCoordination, } from '@vitessce/vit-s';
|
|
6
|
-
import { AsyncFunctionType, ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-internal';
|
|
4
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
5
|
+
import { useAsyncFunction, useViewConfigStoreApi, useSetViewConfig, useViewConfig, useCoordination, useLoaders, useComparisonMetadata, useMatchingLoader, useColumnNameMapping, } from '@vitessce/vit-s';
|
|
6
|
+
import { AsyncFunctionType, ViewType, COMPONENT_COORDINATION_TYPES, DataType } from '@vitessce/constants-internal';
|
|
7
7
|
import { ScmdUi } from './scmd-ui.js';
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -12,11 +12,18 @@ import { ScmdUi } from './scmd-ui.js';
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
export function BiomarkerSelectSubscriber(props) {
|
|
15
|
-
const { coordinationScopes, stratificationOptions,
|
|
16
|
-
|
|
15
|
+
const { coordinationScopes, stratificationOptions: stratificationOptionsProp, // TODO: Remove; Get from comparisonMetadata instead
|
|
16
|
+
} = props;
|
|
17
|
+
const loaders = useLoaders();
|
|
18
|
+
const [{ dataset, obsType, sampleType, sampleSetSelection, featureSelection, }, { setSampleSetSelection, setFeatureSelection, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.BIOMARKER_SELECT], coordinationScopes);
|
|
17
19
|
const viewConfigStoreApi = useViewConfigStoreApi();
|
|
18
20
|
const viewConfig = useViewConfig();
|
|
19
21
|
const setViewConfig = useSetViewConfig(viewConfigStoreApi);
|
|
22
|
+
// Need obsSets and sampleSets options to obtain mapping between
|
|
23
|
+
// group names and column names.
|
|
24
|
+
const obsSetsLoader = useMatchingLoader(loaders, dataset, DataType.OBS_SETS, { obsType });
|
|
25
|
+
const sampleSetsLoader = useMatchingLoader(loaders, dataset, DataType.SAMPLE_SETS, { sampleType });
|
|
26
|
+
const sampleSetsColumnNameMappingReversed = useColumnNameMapping(sampleSetsLoader, true);
|
|
20
27
|
// TODO: make isSelecting a coordination type plugin.
|
|
21
28
|
// TODO: use store hooks from @vitessce/vit-s to update the view config based on the selections.
|
|
22
29
|
const [isSelecting, setIsSelecting] = useState(true);
|
|
@@ -29,20 +36,69 @@ export function BiomarkerSelectSubscriber(props) {
|
|
|
29
36
|
const transformFeature = useAsyncFunction(AsyncFunctionType.TRANSFORM_FEATURE);
|
|
30
37
|
const autocompleteNode = useCallback(async (inputValue) => autocompleteFeature(inputValue), [autocompleteFeature]);
|
|
31
38
|
const getEdges = useCallback(async (node, targetModality) => transformFeature(node, targetModality), [transformFeature]);
|
|
39
|
+
const [{ comparisonMetadata }, cmpMetadataStatus, cmpMetadataUrls] = useComparisonMetadata(loaders, dataset, false, {}, {}, { obsType, sampleType });
|
|
40
|
+
const stratificationOptions = useMemo(() => {
|
|
41
|
+
/*
|
|
42
|
+
return array of objects like {
|
|
43
|
+
stratificationId: 'aki-vs-hr',
|
|
44
|
+
name: 'Acute kidney injury (AKI) vs. Healthy reference',
|
|
45
|
+
stratificationType: 'sampleSet', // key changed from 'groupType'. value changed from 'clinical'
|
|
46
|
+
sampleSets: [
|
|
47
|
+
['Disease Type', 'AKI'],
|
|
48
|
+
['Disease Type', 'Reference'],
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
*/
|
|
52
|
+
if (comparisonMetadata?.sample_group_pairs) {
|
|
53
|
+
return comparisonMetadata.sample_group_pairs.map((sampleGroupPair) => {
|
|
54
|
+
const [sampleGroupCol, sampleGroupValues] = sampleGroupPair;
|
|
55
|
+
const [sampleGroupCtrl, sampleGroupCase] = sampleGroupValues;
|
|
56
|
+
const groupName = sampleSetsColumnNameMappingReversed?.[sampleGroupCol];
|
|
57
|
+
return {
|
|
58
|
+
stratificationId: `${sampleGroupCol}_${sampleGroupCtrl}-vs-${sampleGroupCase}`,
|
|
59
|
+
name: `${groupName}: ${sampleGroupCtrl} vs. ${sampleGroupCase}`,
|
|
60
|
+
stratificationType: 'sampleSet',
|
|
61
|
+
sampleSets: [
|
|
62
|
+
// With sampleSets coming from the comparison_metadata,
|
|
63
|
+
// need to use loader options from obsSets and sampleSets to get mapping
|
|
64
|
+
// from column name to group name.
|
|
65
|
+
[groupName, sampleGroupCtrl],
|
|
66
|
+
[groupName, sampleGroupCase],
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}, [comparisonMetadata, sampleSetsColumnNameMappingReversed]);
|
|
32
73
|
return (_jsx(_Fragment, { children: isSelecting ? (_jsx(ScmdUi, { mode: mode, setMode: setMode, step: step, setStep: setStep, currentModalityAgnosticSelection: currentModalityAgnosticSelection, setCurrentModalityAgnosticSelection: setCurrentModalityAgnosticSelection, currentModalitySpecificSelection: currentModalitySpecificSelection, setCurrentModalitySpecificSelection: setCurrentModalitySpecificSelection, currentStratificationSelection: currentStratificationSelection, setCurrentStratificationSelection: setCurrentStratificationSelection, autocompleteNode: autocompleteNode, getEdges: getEdges, stratifications: stratificationOptions, onFinish: () => {
|
|
33
|
-
|
|
74
|
+
if (mode === 'exploratory') {
|
|
75
|
+
// mode is exploratory, configure accordingly.
|
|
76
|
+
// TODO
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// mode is confirmatory, configure accordingly.
|
|
80
|
+
// TODO
|
|
81
|
+
}
|
|
82
|
+
const newViewConfig = {
|
|
34
83
|
...viewConfig,
|
|
35
84
|
coordinationSpace: {
|
|
36
85
|
...viewConfig.coordinationSpace,
|
|
37
86
|
sampleSetFilter: {
|
|
38
87
|
...viewConfig.coordinationSpace.sampleSetFilter,
|
|
39
|
-
|
|
88
|
+
__comparison__: currentStratificationSelection?.sampleSets,
|
|
40
89
|
},
|
|
41
90
|
sampleSetSelection: {
|
|
42
91
|
...viewConfig.coordinationSpace.sampleSetSelection,
|
|
43
|
-
|
|
92
|
+
__comparison__: currentStratificationSelection?.sampleSets,
|
|
93
|
+
},
|
|
94
|
+
featureSelection: {
|
|
95
|
+
...viewConfig.coordinationSpace.featureSelection,
|
|
96
|
+
__comparison__: currentModalitySpecificSelection ? currentModalitySpecificSelection.map(d => d.label) : null,
|
|
44
97
|
},
|
|
45
98
|
},
|
|
46
|
-
}
|
|
99
|
+
};
|
|
100
|
+
// TODO: can the normal coordination value setters be used instead?
|
|
101
|
+
// (e.g., setFeatureSelection, setSampleSetSelection)
|
|
102
|
+
setViewConfig(newViewConfig);
|
|
47
103
|
} })) : null }));
|
|
48
104
|
}
|