@genspectrum/dashboard-components 1.12.0 → 1.14.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/README.md +0 -7
- package/custom-elements.json +399 -27
- package/dist/components.d.ts +144 -33
- package/dist/components.js +2126 -1402
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +177 -26
- package/package.json +1 -5
- package/src/lapisApi/lapisApi.ts +21 -1
- package/src/lapisApi/lapisTypes.ts +36 -0
- package/src/preact/components/annotated-mutation.tsx +2 -2
- package/src/preact/{mutationsOverTime/mutations-over-time-grid.tsx → components/features-over-time-grid.tsx} +45 -52
- package/src/preact/genomeViewer/genome-data-viewer.tsx +2 -2
- package/src/preact/mutationsOverTime/MutationOverTimeData.ts +6 -4
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutations.json +5482 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutationsOverTime.json +5496 -0
- package/src/preact/mutationsOverTime/__mockData__/byWeek/mutationsOverTime.json +7100 -0
- package/src/preact/mutationsOverTime/__mockData__/byWeek/nucleotideMutations.json +10122 -0
- package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTime.json +12646 -0
- package/src/preact/mutationsOverTime/__mockData__/defaultMockData/nucleotideMutations.json +12632 -0
- package/src/preact/mutationsOverTime/__mockData__/request1800s/mutationsOverTime.json +16 -0
- package/src/preact/mutationsOverTime/__mockData__/request1800s/nucleotideMutations.json +11 -0
- package/src/preact/mutationsOverTime/__mockData__/withDisplayMutations/mutationsOverTime.json +52 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +3 -3
- package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.tsx +3 -6
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +199 -12
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +30 -35
- package/src/preact/queriesOverTime/__mockData__/defaultMockData/queriesOverTime.json +32 -0
- package/src/preact/queriesOverTime/__mockData__/manyQueries.json +128 -0
- package/src/preact/queriesOverTime/__mockData__/request1800s.json +16 -0
- package/src/preact/queriesOverTime/__mockData__/withGaps.json +52 -0
- package/src/preact/queriesOverTime/getFilteredQueriesOverTimeData.ts +85 -0
- package/src/preact/queriesOverTime/queries-over-time-filter.tsx +25 -0
- package/src/preact/queriesOverTime/queries-over-time-grid-tooltip.stories.tsx +134 -0
- package/src/preact/queriesOverTime/queries-over-time-grid-tooltip.tsx +123 -0
- package/src/preact/queriesOverTime/queries-over-time.stories.tsx +481 -0
- package/src/preact/queriesOverTime/queries-over-time.tsx +304 -0
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +30 -3
- package/src/query/queryDatesInDataset.ts +89 -0
- package/src/query/queryMutationsOverTime.spec.ts +526 -548
- package/src/query/queryMutationsOverTime.ts +21 -232
- package/src/query/queryQueriesOverTime.spec.ts +432 -0
- package/src/query/queryQueriesOverTime.ts +125 -0
- package/src/utilEntrypoint.ts +4 -1
- package/src/utils/mutations.spec.ts +6 -0
- package/src/utils/mutations.ts +1 -1
- package/src/utils/temporalClass.ts +4 -0
- package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +2 -2
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +283 -17
- package/src/web-components/visualization/gs-mutations-over-time.tsx +1 -10
- package/src/web-components/visualization/gs-queries-over-time.spec-d.ts +38 -0
- package/src/web-components/visualization/gs-queries-over-time.stories.ts +288 -0
- package/src/web-components/visualization/gs-queries-over-time.tsx +154 -0
- package/src/web-components/visualization/index.ts +1 -0
- package/standalone-bundle/dashboard-components.js +10393 -9798
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/dist/assets/mutationOverTimeWorker-f8Kp0S6V.js.map +0 -1
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +0 -47170
- package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +0 -54026
- package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +0 -108385
- package/src/preact/mutationsOverTime/__mockData__/mockConversion.ts +0 -54
- package/src/preact/mutationsOverTime/__mockData__/noDataWhenNoMutationsAreInFilter.ts +0 -23
- package/src/preact/mutationsOverTime/__mockData__/noDataWhenThereAreNoDatesInFilter.ts +0 -23
- package/src/preact/mutationsOverTime/__mockData__/showsMessageWhenTooManyMutations.ts +0 -65527
- package/src/preact/mutationsOverTime/__mockData__/withDisplayMutations.ts +0 -352
- package/src/preact/mutationsOverTime/__mockData__/withGaps.ts +0 -298
- package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +0 -33
- package/src/preact/mutationsOverTime/mutationOverTimeWorker.ts +0 -29
- package/src/preact/webWorkers/useWebWorker.ts +0 -74
- package/src/preact/webWorkers/workerFunction.ts +0 -30
- package/src/query/queryMutationsOverTimeNewEndpoint.spec.ts +0 -988
- package/standalone-bundle/assets/mutationOverTimeWorker-AhhjjklP.js.map +0 -1
package/dist/util.d.ts
CHANGED
|
@@ -734,6 +734,141 @@ export declare type PrevalenceOverTimeView = default_2.infer<typeof prevalenceOv
|
|
|
734
734
|
|
|
735
735
|
declare const prevalenceOverTimeViewSchema: default_2.ZodUnion<[default_2.ZodLiteral<"table">, default_2.ZodLiteral<"bar">, default_2.ZodLiteral<"line">, default_2.ZodLiteral<"bubble">]>;
|
|
736
736
|
|
|
737
|
+
export declare type QueriesOverTimeProps = default_2.infer<typeof queriesOverTimeSchema>;
|
|
738
|
+
|
|
739
|
+
declare const queriesOverTimeSchema: default_2.ZodObject<{
|
|
740
|
+
lapisFilter: default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
|
|
741
|
+
nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
|
|
742
|
+
aminoAcidMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
|
|
743
|
+
nucleotideInsertions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
|
|
744
|
+
aminoAcidInsertions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
|
|
745
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
746
|
+
nucleotideMutations?: string[] | undefined;
|
|
747
|
+
aminoAcidMutations?: string[] | undefined;
|
|
748
|
+
nucleotideInsertions?: string[] | undefined;
|
|
749
|
+
aminoAcidInsertions?: string[] | undefined;
|
|
750
|
+
}, {
|
|
751
|
+
nucleotideMutations?: string[] | undefined;
|
|
752
|
+
aminoAcidMutations?: string[] | undefined;
|
|
753
|
+
nucleotideInsertions?: string[] | undefined;
|
|
754
|
+
aminoAcidInsertions?: string[] | undefined;
|
|
755
|
+
}>>;
|
|
756
|
+
queries: default_2.ZodArray<default_2.ZodObject<{
|
|
757
|
+
displayLabel: default_2.ZodString;
|
|
758
|
+
countQuery: default_2.ZodString;
|
|
759
|
+
coverageQuery: default_2.ZodString;
|
|
760
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
761
|
+
displayLabel: string;
|
|
762
|
+
countQuery: string;
|
|
763
|
+
coverageQuery: string;
|
|
764
|
+
}, {
|
|
765
|
+
displayLabel: string;
|
|
766
|
+
countQuery: string;
|
|
767
|
+
coverageQuery: string;
|
|
768
|
+
}>, "many">;
|
|
769
|
+
views: default_2.ZodArray<default_2.ZodLiteral<"grid">, "many">;
|
|
770
|
+
granularity: default_2.ZodUnion<[default_2.ZodLiteral<"day">, default_2.ZodLiteral<"week">, default_2.ZodLiteral<"month">, default_2.ZodLiteral<"year">]>;
|
|
771
|
+
lapisDateField: default_2.ZodString;
|
|
772
|
+
initialMeanProportionInterval: default_2.ZodObject<{
|
|
773
|
+
min: default_2.ZodNumber;
|
|
774
|
+
max: default_2.ZodNumber;
|
|
775
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
776
|
+
min: number;
|
|
777
|
+
max: number;
|
|
778
|
+
}, {
|
|
779
|
+
min: number;
|
|
780
|
+
max: number;
|
|
781
|
+
}>;
|
|
782
|
+
hideGaps: default_2.ZodOptional<default_2.ZodBoolean>;
|
|
783
|
+
width: default_2.ZodString;
|
|
784
|
+
height: default_2.ZodOptional<default_2.ZodString>;
|
|
785
|
+
pageSizes: default_2.ZodUnion<[default_2.ZodArray<default_2.ZodNumber, "many">, default_2.ZodNumber]>;
|
|
786
|
+
customColumns: default_2.ZodOptional<default_2.ZodArray<default_2.ZodObject<{
|
|
787
|
+
header: default_2.ZodString;
|
|
788
|
+
values: default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodNumber]>>;
|
|
789
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
790
|
+
values: Record<string, string | number>;
|
|
791
|
+
header: string;
|
|
792
|
+
}, {
|
|
793
|
+
values: Record<string, string | number>;
|
|
794
|
+
header: string;
|
|
795
|
+
}>, "many">>;
|
|
796
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
797
|
+
lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
|
|
798
|
+
nucleotideMutations?: string[] | undefined;
|
|
799
|
+
aminoAcidMutations?: string[] | undefined;
|
|
800
|
+
nucleotideInsertions?: string[] | undefined;
|
|
801
|
+
aminoAcidInsertions?: string[] | undefined;
|
|
802
|
+
};
|
|
803
|
+
queries: {
|
|
804
|
+
displayLabel: string;
|
|
805
|
+
countQuery: string;
|
|
806
|
+
coverageQuery: string;
|
|
807
|
+
}[];
|
|
808
|
+
width: string;
|
|
809
|
+
views: "grid"[];
|
|
810
|
+
granularity: "day" | "week" | "month" | "year";
|
|
811
|
+
lapisDateField: string;
|
|
812
|
+
pageSizes: number | number[];
|
|
813
|
+
initialMeanProportionInterval: {
|
|
814
|
+
min: number;
|
|
815
|
+
max: number;
|
|
816
|
+
};
|
|
817
|
+
height?: string | undefined;
|
|
818
|
+
hideGaps?: boolean | undefined;
|
|
819
|
+
customColumns?: {
|
|
820
|
+
values: Record<string, string | number>;
|
|
821
|
+
header: string;
|
|
822
|
+
}[] | undefined;
|
|
823
|
+
}, {
|
|
824
|
+
lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
|
|
825
|
+
nucleotideMutations?: string[] | undefined;
|
|
826
|
+
aminoAcidMutations?: string[] | undefined;
|
|
827
|
+
nucleotideInsertions?: string[] | undefined;
|
|
828
|
+
aminoAcidInsertions?: string[] | undefined;
|
|
829
|
+
};
|
|
830
|
+
queries: {
|
|
831
|
+
displayLabel: string;
|
|
832
|
+
countQuery: string;
|
|
833
|
+
coverageQuery: string;
|
|
834
|
+
}[];
|
|
835
|
+
width: string;
|
|
836
|
+
views: "grid"[];
|
|
837
|
+
granularity: "day" | "week" | "month" | "year";
|
|
838
|
+
lapisDateField: string;
|
|
839
|
+
pageSizes: number | number[];
|
|
840
|
+
initialMeanProportionInterval: {
|
|
841
|
+
min: number;
|
|
842
|
+
max: number;
|
|
843
|
+
};
|
|
844
|
+
height?: string | undefined;
|
|
845
|
+
hideGaps?: boolean | undefined;
|
|
846
|
+
customColumns?: {
|
|
847
|
+
values: Record<string, string | number>;
|
|
848
|
+
header: string;
|
|
849
|
+
}[] | undefined;
|
|
850
|
+
}>;
|
|
851
|
+
|
|
852
|
+
export declare type QueriesOverTimeView = default_2.infer<typeof queriesOverTimeViewSchema>;
|
|
853
|
+
|
|
854
|
+
declare const queriesOverTimeViewSchema: default_2.ZodLiteral<"grid">;
|
|
855
|
+
|
|
856
|
+
export declare type QueryDefinition = default_2.infer<typeof queryDefinition>;
|
|
857
|
+
|
|
858
|
+
declare const queryDefinition: default_2.ZodObject<{
|
|
859
|
+
displayLabel: default_2.ZodString;
|
|
860
|
+
countQuery: default_2.ZodString;
|
|
861
|
+
coverageQuery: default_2.ZodString;
|
|
862
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
863
|
+
displayLabel: string;
|
|
864
|
+
countQuery: string;
|
|
865
|
+
coverageQuery: string;
|
|
866
|
+
}, {
|
|
867
|
+
displayLabel: string;
|
|
868
|
+
countQuery: string;
|
|
869
|
+
coverageQuery: string;
|
|
870
|
+
}>;
|
|
871
|
+
|
|
737
872
|
export declare type RelativeGrowthAdvantageProps = default_2.infer<typeof relativeGrowthAdvantagePropsSchema>;
|
|
738
873
|
|
|
739
874
|
declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
|
|
@@ -987,7 +1122,7 @@ declare global {
|
|
|
987
1122
|
|
|
988
1123
|
declare global {
|
|
989
1124
|
interface HTMLElementTagNameMap {
|
|
990
|
-
'gs-
|
|
1125
|
+
'gs-mutations': MutationsComponent;
|
|
991
1126
|
}
|
|
992
1127
|
}
|
|
993
1128
|
|
|
@@ -995,7 +1130,7 @@ declare global {
|
|
|
995
1130
|
declare global {
|
|
996
1131
|
namespace JSX {
|
|
997
1132
|
interface IntrinsicElements {
|
|
998
|
-
'gs-
|
|
1133
|
+
'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
999
1134
|
}
|
|
1000
1135
|
}
|
|
1001
1136
|
}
|
|
@@ -1003,7 +1138,7 @@ declare global {
|
|
|
1003
1138
|
|
|
1004
1139
|
declare global {
|
|
1005
1140
|
interface HTMLElementTagNameMap {
|
|
1006
|
-
'gs-
|
|
1141
|
+
'gs-mutation-comparison': MutationComparisonComponent;
|
|
1007
1142
|
}
|
|
1008
1143
|
}
|
|
1009
1144
|
|
|
@@ -1011,7 +1146,7 @@ declare global {
|
|
|
1011
1146
|
declare global {
|
|
1012
1147
|
namespace JSX {
|
|
1013
1148
|
interface IntrinsicElements {
|
|
1014
|
-
'gs-
|
|
1149
|
+
'gs-mutation-comparison': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1015
1150
|
}
|
|
1016
1151
|
}
|
|
1017
1152
|
}
|
|
@@ -1019,7 +1154,7 @@ declare global {
|
|
|
1019
1154
|
|
|
1020
1155
|
declare global {
|
|
1021
1156
|
interface HTMLElementTagNameMap {
|
|
1022
|
-
'gs-
|
|
1157
|
+
'gs-prevalence-over-time': PrevalenceOverTimeComponent;
|
|
1023
1158
|
}
|
|
1024
1159
|
}
|
|
1025
1160
|
|
|
@@ -1027,7 +1162,7 @@ declare global {
|
|
|
1027
1162
|
declare global {
|
|
1028
1163
|
namespace JSX {
|
|
1029
1164
|
interface IntrinsicElements {
|
|
1030
|
-
'gs-
|
|
1165
|
+
'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1031
1166
|
}
|
|
1032
1167
|
}
|
|
1033
1168
|
}
|
|
@@ -1035,7 +1170,7 @@ declare global {
|
|
|
1035
1170
|
|
|
1036
1171
|
declare global {
|
|
1037
1172
|
interface HTMLElementTagNameMap {
|
|
1038
|
-
'gs-
|
|
1173
|
+
'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
|
|
1039
1174
|
}
|
|
1040
1175
|
}
|
|
1041
1176
|
|
|
@@ -1043,7 +1178,7 @@ declare global {
|
|
|
1043
1178
|
declare global {
|
|
1044
1179
|
namespace JSX {
|
|
1045
1180
|
interface IntrinsicElements {
|
|
1046
|
-
'gs-
|
|
1181
|
+
'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1047
1182
|
}
|
|
1048
1183
|
}
|
|
1049
1184
|
}
|
|
@@ -1083,7 +1218,7 @@ declare global {
|
|
|
1083
1218
|
|
|
1084
1219
|
declare global {
|
|
1085
1220
|
interface HTMLElementTagNameMap {
|
|
1086
|
-
'gs-
|
|
1221
|
+
'gs-mutations-over-time': MutationsOverTimeComponent;
|
|
1087
1222
|
}
|
|
1088
1223
|
}
|
|
1089
1224
|
|
|
@@ -1091,7 +1226,23 @@ declare global {
|
|
|
1091
1226
|
declare global {
|
|
1092
1227
|
namespace JSX {
|
|
1093
1228
|
interface IntrinsicElements {
|
|
1094
|
-
'gs-
|
|
1229
|
+
'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
declare global {
|
|
1236
|
+
interface HTMLElementTagNameMap {
|
|
1237
|
+
'gs-queries-over-time': QueriesOverTimeComponent;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
declare global {
|
|
1243
|
+
namespace JSX {
|
|
1244
|
+
interface IntrinsicElements {
|
|
1245
|
+
'gs-queries-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1095
1246
|
}
|
|
1096
1247
|
}
|
|
1097
1248
|
}
|
|
@@ -1115,7 +1266,7 @@ declare global {
|
|
|
1115
1266
|
|
|
1116
1267
|
declare global {
|
|
1117
1268
|
interface HTMLElementTagNameMap {
|
|
1118
|
-
'gs-
|
|
1269
|
+
'gs-statistics': StatisticsComponent;
|
|
1119
1270
|
}
|
|
1120
1271
|
}
|
|
1121
1272
|
|
|
@@ -1123,7 +1274,7 @@ declare global {
|
|
|
1123
1274
|
declare global {
|
|
1124
1275
|
namespace JSX {
|
|
1125
1276
|
interface IntrinsicElements {
|
|
1126
|
-
'gs-
|
|
1277
|
+
'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1127
1278
|
}
|
|
1128
1279
|
}
|
|
1129
1280
|
}
|
|
@@ -1151,10 +1302,10 @@ declare global {
|
|
|
1151
1302
|
|
|
1152
1303
|
declare global {
|
|
1153
1304
|
interface HTMLElementTagNameMap {
|
|
1154
|
-
'gs-
|
|
1305
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1155
1306
|
}
|
|
1156
1307
|
interface HTMLElementEventMap {
|
|
1157
|
-
[gsEventNames.
|
|
1308
|
+
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
1158
1309
|
}
|
|
1159
1310
|
}
|
|
1160
1311
|
|
|
@@ -1162,7 +1313,7 @@ declare global {
|
|
|
1162
1313
|
declare global {
|
|
1163
1314
|
namespace JSX {
|
|
1164
1315
|
interface IntrinsicElements {
|
|
1165
|
-
'gs-
|
|
1316
|
+
'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1166
1317
|
}
|
|
1167
1318
|
}
|
|
1168
1319
|
}
|
|
@@ -1170,10 +1321,10 @@ declare global {
|
|
|
1170
1321
|
|
|
1171
1322
|
declare global {
|
|
1172
1323
|
interface HTMLElementTagNameMap {
|
|
1173
|
-
'gs-
|
|
1324
|
+
'gs-text-filter': TextFilterComponent;
|
|
1174
1325
|
}
|
|
1175
1326
|
interface HTMLElementEventMap {
|
|
1176
|
-
[gsEventNames.
|
|
1327
|
+
[gsEventNames.textFilterChanged]: TextFilterChangedEvent;
|
|
1177
1328
|
}
|
|
1178
1329
|
}
|
|
1179
1330
|
|
|
@@ -1181,7 +1332,7 @@ declare global {
|
|
|
1181
1332
|
declare global {
|
|
1182
1333
|
namespace JSX {
|
|
1183
1334
|
interface IntrinsicElements {
|
|
1184
|
-
'gs-
|
|
1335
|
+
'gs-text-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1185
1336
|
}
|
|
1186
1337
|
}
|
|
1187
1338
|
}
|
|
@@ -1208,11 +1359,11 @@ declare global {
|
|
|
1208
1359
|
|
|
1209
1360
|
declare global {
|
|
1210
1361
|
interface HTMLElementTagNameMap {
|
|
1211
|
-
'gs-
|
|
1362
|
+
'gs-lineage-filter': LineageFilterComponent;
|
|
1212
1363
|
}
|
|
1213
1364
|
interface HTMLElementEventMap {
|
|
1214
|
-
[gsEventNames.
|
|
1215
|
-
[gsEventNames.
|
|
1365
|
+
[gsEventNames.lineageFilterChanged]: LineageFilterChangedEvent;
|
|
1366
|
+
[gsEventNames.lineageFilterMultiChanged]: LineageMultiFilterChangedEvent;
|
|
1216
1367
|
}
|
|
1217
1368
|
}
|
|
1218
1369
|
|
|
@@ -1220,7 +1371,7 @@ declare global {
|
|
|
1220
1371
|
declare global {
|
|
1221
1372
|
namespace JSX {
|
|
1222
1373
|
interface IntrinsicElements {
|
|
1223
|
-
'gs-
|
|
1374
|
+
'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1224
1375
|
}
|
|
1225
1376
|
}
|
|
1226
1377
|
}
|
|
@@ -1228,11 +1379,11 @@ declare global {
|
|
|
1228
1379
|
|
|
1229
1380
|
declare global {
|
|
1230
1381
|
interface HTMLElementTagNameMap {
|
|
1231
|
-
'gs-
|
|
1382
|
+
'gs-number-range-filter': NumberRangeFilterComponent;
|
|
1232
1383
|
}
|
|
1233
1384
|
interface HTMLElementEventMap {
|
|
1234
|
-
[gsEventNames.
|
|
1235
|
-
[gsEventNames.
|
|
1385
|
+
[gsEventNames.numberRangeFilterChanged]: NumberRangeFilterChangedEvent;
|
|
1386
|
+
[gsEventNames.numberRangeValueChanged]: NumberRangeValueChangedEvent;
|
|
1236
1387
|
}
|
|
1237
1388
|
}
|
|
1238
1389
|
|
|
@@ -1240,7 +1391,7 @@ declare global {
|
|
|
1240
1391
|
declare global {
|
|
1241
1392
|
namespace JSX {
|
|
1242
1393
|
interface IntrinsicElements {
|
|
1243
|
-
'gs-
|
|
1394
|
+
'gs-number-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1244
1395
|
}
|
|
1245
1396
|
}
|
|
1246
1397
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genspectrum/dashboard-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "GenSpectrum web components for building dashboards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"imports": {
|
|
19
|
-
"#mutationOverTime": {
|
|
20
|
-
"storybook": "./src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts",
|
|
21
|
-
"default": "./src/preact/mutationsOverTime/mutationOverTimeWorker.ts"
|
|
22
|
-
},
|
|
23
19
|
"#*": [
|
|
24
20
|
"./*",
|
|
25
21
|
"./*.ts",
|
package/src/lapisApi/lapisApi.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lineageDefinitionResponseSchema } from './LineageDefinition';
|
|
1
2
|
import { referenceGenomeResponse } from './ReferenceGenome';
|
|
2
3
|
import {
|
|
3
4
|
aggregatedResponse,
|
|
@@ -11,9 +12,10 @@ import {
|
|
|
11
12
|
type ProblemDetail,
|
|
12
13
|
type MutationsOverTimeRequest,
|
|
13
14
|
mutationsOverTimeResponse,
|
|
15
|
+
type QueriesOverTimeRequest,
|
|
16
|
+
queriesOverTimeResponse,
|
|
14
17
|
} from './lapisTypes';
|
|
15
18
|
import { type SequenceType } from '../types';
|
|
16
|
-
import { lineageDefinitionResponseSchema } from './LineageDefinition';
|
|
17
19
|
|
|
18
20
|
export class UnknownLapisError extends Error {
|
|
19
21
|
constructor(
|
|
@@ -136,6 +138,23 @@ export async function fetchMutationsOverTime(
|
|
|
136
138
|
return mutationsOverTimeResponse.parse(await response.json());
|
|
137
139
|
}
|
|
138
140
|
|
|
141
|
+
export async function fetchQueriesOverTime(lapisUrl: string, body: QueriesOverTimeRequest, signal?: AbortSignal) {
|
|
142
|
+
const response = await callLapis(
|
|
143
|
+
queriesOverTimeEndpoint(lapisUrl),
|
|
144
|
+
{
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers: {
|
|
147
|
+
'Content-Type': 'application/json',
|
|
148
|
+
},
|
|
149
|
+
body: JSON.stringify(body),
|
|
150
|
+
signal,
|
|
151
|
+
},
|
|
152
|
+
'queries over time',
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
return queriesOverTimeResponse.parse(await response.json());
|
|
156
|
+
}
|
|
157
|
+
|
|
139
158
|
export async function fetchReferenceGenome(lapisUrl: string, signal?: AbortSignal) {
|
|
140
159
|
const response = await callLapis(
|
|
141
160
|
referenceGenomeEndpoint(lapisUrl),
|
|
@@ -244,6 +263,7 @@ export const mutationsOverTimeEndpoint = (lapisUrl: string, sequenceType: Sequen
|
|
|
244
263
|
? `${lapisUrl}/component/aminoAcidMutationsOverTime`
|
|
245
264
|
: `${lapisUrl}/component/nucleotideMutationsOverTime`;
|
|
246
265
|
};
|
|
266
|
+
export const queriesOverTimeEndpoint = (lapisUrl: string) => `${lapisUrl}/component/queriesOverTime`;
|
|
247
267
|
export const referenceGenomeEndpoint = (lapisUrl: string) => `${lapisUrl}/sample/referenceGenome`;
|
|
248
268
|
export const lineageDefinitionEndpoint = (lapisUrl: string, lapisField: string) =>
|
|
249
269
|
`${lapisUrl}/sample/lineageDefinition/${lapisField}`;
|
|
@@ -67,6 +67,42 @@ export const mutationsOverTimeResponse = makeLapisResponse(
|
|
|
67
67
|
);
|
|
68
68
|
export type MutationsOverTimeResponse = z.infer<typeof mutationsOverTimeResponse>;
|
|
69
69
|
|
|
70
|
+
const queryDefinition = z.object({
|
|
71
|
+
displayLabel: z.string(),
|
|
72
|
+
countQuery: z.string(),
|
|
73
|
+
coverageQuery: z.string(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export type QueryDefinition = z.infer<typeof queryDefinition>;
|
|
77
|
+
|
|
78
|
+
export const queriesOverTimeRequest = z.object({
|
|
79
|
+
filters: z.record(filterValue),
|
|
80
|
+
queries: z.array(queryDefinition),
|
|
81
|
+
dateRanges: z.array(dateRange),
|
|
82
|
+
dateField: z.string(),
|
|
83
|
+
downloadAsFile: z.boolean().optional(),
|
|
84
|
+
downloadFileBasename: z.string().optional(),
|
|
85
|
+
compression: z.enum(['gzip', 'none']).optional(),
|
|
86
|
+
});
|
|
87
|
+
export type QueriesOverTimeRequest = z.infer<typeof queriesOverTimeRequest>;
|
|
88
|
+
|
|
89
|
+
export const queriesOverTimeResponse = makeLapisResponse(
|
|
90
|
+
z.object({
|
|
91
|
+
queries: z.array(z.string()),
|
|
92
|
+
dateRanges: z.array(dateRange),
|
|
93
|
+
data: z.array(
|
|
94
|
+
z.array(
|
|
95
|
+
z.object({
|
|
96
|
+
count: z.number(),
|
|
97
|
+
coverage: z.number(),
|
|
98
|
+
}),
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
totalCountsByDateRange: z.array(z.number()),
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
104
|
+
export type QueriesOverTimeResponse = z.infer<typeof queriesOverTimeResponse>;
|
|
105
|
+
|
|
70
106
|
const insertionCount = z.object({
|
|
71
107
|
insertion: z.string(),
|
|
72
108
|
count: z.number(),
|
|
@@ -2,11 +2,11 @@ import DOMPurify from 'dompurify';
|
|
|
2
2
|
import { useRef } from 'gridjs';
|
|
3
3
|
import { Fragment, type FunctionComponent, type RefObject } from 'preact';
|
|
4
4
|
|
|
5
|
+
import { InfoHeadline1, InfoHeadline2, InfoParagraph } from './info';
|
|
6
|
+
import { ButtonWithModalDialog, useModalRef } from './modal';
|
|
5
7
|
import type { SequenceType } from '../../types';
|
|
6
8
|
import type { Deletion, Substitution } from '../../utils/mutations';
|
|
7
9
|
import { useMutationAnnotationsProvider } from '../MutationAnnotationsContext';
|
|
8
|
-
import { InfoHeadline1, InfoHeadline2, InfoParagraph } from './info';
|
|
9
|
-
import { ButtonWithModalDialog, useModalRef } from './modal';
|
|
10
10
|
import { useMutationLinkProvider } from '../MutationLinkTemplateContext';
|
|
11
11
|
|
|
12
12
|
export type AnnotatedMutationProps = {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { type FunctionComponent } from 'preact';
|
|
1
|
+
import { type FunctionComponent, type JSX } from 'preact';
|
|
2
2
|
import { useMemo } from 'preact/hooks';
|
|
3
3
|
import z from 'zod';
|
|
4
4
|
|
|
5
|
-
import { type
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { type
|
|
9
|
-
import { type Deletion, type Substitution } from '../../utils/mutations';
|
|
5
|
+
import { type ColorScale, getColorWithinScale, getTextColorForScale } from './color-scale-selector';
|
|
6
|
+
import PortalTooltip from './portal-tooltip';
|
|
7
|
+
import { type TooltipPosition } from './tooltip';
|
|
8
|
+
import { getProportion, type ProportionValue } from '../../query/queryMutationsOverTime';
|
|
10
9
|
import { type Temporal } from '../../utils/temporalClass';
|
|
11
|
-
import {
|
|
12
|
-
import { type ColorScale, getColorWithinScale, getTextColorForScale } from '../components/color-scale-selector';
|
|
13
|
-
import PortalTooltip from '../components/portal-tooltip';
|
|
14
|
-
import { type TooltipPosition } from '../components/tooltip';
|
|
10
|
+
import { type TemporalDataMap } from '../mutationsOverTime/MutationOverTimeData';
|
|
15
11
|
import { formatProportion } from '../shared/table/formatProportion';
|
|
16
12
|
import { type PageSizes, Pagination } from '../shared/tanstackTable/pagination';
|
|
17
13
|
import { usePageSizeContext } from '../shared/tanstackTable/pagination-context';
|
|
@@ -31,55 +27,56 @@ export const customColumnSchema = z.object({
|
|
|
31
27
|
});
|
|
32
28
|
export type CustomColumn = z.infer<typeof customColumnSchema>;
|
|
33
29
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
30
|
+
export interface FeatureRenderer<D> {
|
|
31
|
+
asString(value: D): string;
|
|
32
|
+
renderRowLabel(value: D): JSX.Element;
|
|
33
|
+
renderTooltip(value: D, temporal: Temporal, proportionValue: ProportionValue | undefined): JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface FeaturesOverTimeGridProps<F> {
|
|
37
|
+
rowLabelHeader: string;
|
|
38
|
+
data: TemporalDataMap<F>;
|
|
36
39
|
colorScale: ColorScale;
|
|
37
|
-
sequenceType: SequenceType;
|
|
38
40
|
pageSizes: PageSizes;
|
|
39
41
|
customColumns?: CustomColumn[];
|
|
42
|
+
featureRenderer: FeatureRenderer<F>;
|
|
40
43
|
tooltipPortalTarget: HTMLElement | null;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
type RowType = {
|
|
44
|
-
|
|
45
|
-
values: (
|
|
46
|
+
type RowType<F> = {
|
|
47
|
+
feature: F;
|
|
48
|
+
values: (ProportionValue | undefined)[];
|
|
46
49
|
customValues: (string | number | undefined)[];
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
const EMPTY_COLUMNS: CustomColumn[] = [];
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
function FeaturesOverTimeGrid<F>({
|
|
55
|
+
rowLabelHeader,
|
|
52
56
|
data,
|
|
53
57
|
colorScale,
|
|
54
|
-
sequenceType,
|
|
55
58
|
pageSizes,
|
|
56
59
|
customColumns = EMPTY_COLUMNS,
|
|
60
|
+
featureRenderer,
|
|
57
61
|
tooltipPortalTarget,
|
|
58
|
-
})
|
|
62
|
+
}: FeaturesOverTimeGridProps<F>) {
|
|
59
63
|
const tableData = useMemo(() => {
|
|
60
|
-
const
|
|
61
|
-
return data.getAsArray().map((row, index): RowType => {
|
|
62
|
-
const
|
|
63
|
-
const customValues = customColumns.map((col) => col.values[
|
|
64
|
-
return {
|
|
64
|
+
const firstAxisKeys = data.getFirstAxisKeys();
|
|
65
|
+
return data.getAsArray().map((row, index): RowType<F> => {
|
|
66
|
+
const firstAxisKey = firstAxisKeys[index];
|
|
67
|
+
const customValues = customColumns.map((col) => col.values[featureRenderer.asString(firstAxisKey)]);
|
|
68
|
+
return { feature: firstAxisKey, values: [...row], customValues };
|
|
65
69
|
});
|
|
66
|
-
}, [data, customColumns]);
|
|
70
|
+
}, [data, customColumns, featureRenderer]);
|
|
67
71
|
|
|
68
72
|
const columns = useMemo(() => {
|
|
69
|
-
const columnHelper = createColumnHelper<RowType
|
|
73
|
+
const columnHelper = createColumnHelper<RowType<F>>();
|
|
70
74
|
const dates = data.getSecondAxisKeys();
|
|
71
75
|
|
|
72
|
-
const
|
|
73
|
-
id: '
|
|
74
|
-
header: () => <span>
|
|
75
|
-
cell: ({ getValue }) =>
|
|
76
|
-
const value = getValue();
|
|
77
|
-
return (
|
|
78
|
-
<div className={'text-center'}>
|
|
79
|
-
<AnnotatedMutation mutation={value} sequenceType={sequenceType} />
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
},
|
|
76
|
+
const featureHeader = columnHelper.accessor((row) => row.feature, {
|
|
77
|
+
id: 'feature',
|
|
78
|
+
header: () => <span>{rowLabelHeader}</span>,
|
|
79
|
+
cell: ({ getValue }) => featureRenderer.renderRowLabel(getValue()),
|
|
83
80
|
});
|
|
84
81
|
|
|
85
82
|
const customColumnHeaders = customColumns.map((customCol, index) => {
|
|
@@ -108,12 +105,13 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
108
105
|
const numberOfRows = table.getRowModel().rows.length;
|
|
109
106
|
const numberOfColumns = table.getAllColumns().length;
|
|
110
107
|
|
|
108
|
+
const tooltip = featureRenderer.renderTooltip(row.original.feature, date, value);
|
|
109
|
+
|
|
111
110
|
return (
|
|
112
111
|
<div className={'text-center'}>
|
|
113
112
|
<ProportionCell
|
|
114
113
|
value={value ?? null}
|
|
115
|
-
|
|
116
|
-
mutation={row.original.mutation}
|
|
114
|
+
tooltip={tooltip}
|
|
117
115
|
tooltipPosition={getTooltipPosition(
|
|
118
116
|
rowIndex -
|
|
119
117
|
table.getState().pagination.pageIndex * table.getState().pagination.pageSize,
|
|
@@ -130,8 +128,8 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
130
128
|
});
|
|
131
129
|
});
|
|
132
130
|
|
|
133
|
-
return [
|
|
134
|
-
}, [colorScale, data,
|
|
131
|
+
return [featureHeader, ...customColumnHeaders, ...dateHeaders];
|
|
132
|
+
}, [colorScale, data, customColumns, tooltipPortalTarget, featureRenderer, rowLabelHeader]);
|
|
135
133
|
|
|
136
134
|
const { pageSize } = usePageSizeContext();
|
|
137
135
|
const table = usePreactTable({
|
|
@@ -183,7 +181,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
183
181
|
</div>
|
|
184
182
|
</div>
|
|
185
183
|
);
|
|
186
|
-
}
|
|
184
|
+
}
|
|
187
185
|
|
|
188
186
|
function styleGridHeader(columnIndex: number, numDateColumns: number) {
|
|
189
187
|
if (columnIndex === 0) {
|
|
@@ -204,22 +202,17 @@ function getTooltipPosition(rowIndex: number, rows: number, columnIndex: number,
|
|
|
204
202
|
}
|
|
205
203
|
|
|
206
204
|
const ProportionCell: FunctionComponent<{
|
|
207
|
-
value:
|
|
208
|
-
|
|
209
|
-
mutation: Substitution | Deletion;
|
|
205
|
+
value: ProportionValue;
|
|
206
|
+
tooltip: JSX.Element;
|
|
210
207
|
tooltipPosition: TooltipPosition;
|
|
211
208
|
colorScale: ColorScale;
|
|
212
209
|
tooltipPortalTarget: HTMLElement | null;
|
|
213
|
-
}> = ({ value,
|
|
210
|
+
}> = ({ value, tooltip, tooltipPosition, colorScale, tooltipPortalTarget }) => {
|
|
214
211
|
const proportion = getProportion(value);
|
|
215
212
|
|
|
216
213
|
return (
|
|
217
214
|
<div className={'py-1 w-full h-full'}>
|
|
218
|
-
<PortalTooltip
|
|
219
|
-
content={<MutationsOverTimeGridTooltip mutation={mutation} date={date} value={value} />}
|
|
220
|
-
position={tooltipPosition}
|
|
221
|
-
portalTarget={tooltipPortalTarget}
|
|
222
|
-
>
|
|
215
|
+
<PortalTooltip content={tooltip} position={tooltipPosition} portalTarget={tooltipPortalTarget}>
|
|
223
216
|
<div
|
|
224
217
|
style={{
|
|
225
218
|
backgroundColor: getColorWithinScale(proportion, colorScale),
|
|
@@ -240,4 +233,4 @@ const ProportionCell: FunctionComponent<{
|
|
|
240
233
|
);
|
|
241
234
|
};
|
|
242
235
|
|
|
243
|
-
export default
|
|
236
|
+
export default FeaturesOverTimeGrid;
|
|
@@ -2,12 +2,12 @@ import type { FunctionComponent } from 'preact';
|
|
|
2
2
|
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
3
3
|
import z from 'zod';
|
|
4
4
|
|
|
5
|
+
import CDSPlot from './CDSPlot';
|
|
6
|
+
import { loadGff3 } from './loadGff3';
|
|
5
7
|
import { ErrorBoundary } from '../components/error-boundary';
|
|
6
8
|
import { LoadingDisplay } from '../components/loading-display';
|
|
7
9
|
import { ResizeContainer } from '../components/resize-container';
|
|
8
10
|
import { useQuery } from '../useQuery';
|
|
9
|
-
import CDSPlot from './CDSPlot';
|
|
10
|
-
import { loadGff3 } from './loadGff3';
|
|
11
11
|
|
|
12
12
|
const genomeDataViewerPropsSchema = z.object({
|
|
13
13
|
gff3Source: z.string().min(1, 'gff3Source cannot be empty'),
|