@jbrowse/plugin-variants 4.0.2 → 4.0.4

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.
Files changed (31) hide show
  1. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +9 -0
  2. package/esm/LinearVariantDisplay/model.d.ts +14 -1
  3. package/esm/MultiLinearVariantDisplay/model.d.ts +12 -27
  4. package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +12 -27
  5. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +14 -8
  6. package/esm/MultiLinearVariantRenderer/makeImageData.js +4 -2
  7. package/esm/VariantRPC/executeClusterGenotypeMatrix.d.ts +3 -1
  8. package/esm/VariantRPC/executeClusterGenotypeMatrix.js +8 -4
  9. package/esm/VariantRPC/getPhasedGenotypeMatrix.d.ts +20 -0
  10. package/esm/VariantRPC/getPhasedGenotypeMatrix.js +50 -0
  11. package/esm/shared/MultiVariantBaseModel.d.ts +12 -27
  12. package/esm/shared/MultiVariantBaseModel.js +13 -9
  13. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +19 -6
  14. package/esm/shared/components/MultiVariantClusterDialog/types.d.ts +4 -1
  15. package/esm/shared/components/MultiVariantColorLegend.js +4 -4
  16. package/esm/shared/components/MultiVariantLegendBar.js +1 -1
  17. package/esm/shared/components/MultiVariantTooltip.d.ts +1 -0
  18. package/esm/shared/components/MultiVariantTooltip.js +2 -2
  19. package/esm/shared/components/RectBg.js +1 -1
  20. package/esm/shared/components/SourcesDataGrid.js +4 -4
  21. package/esm/shared/components/TreeSidebar.js +11 -1
  22. package/esm/shared/getMultiVariantFeaturesAutorun.d.ts +1 -0
  23. package/esm/shared/getMultiVariantFeaturesAutorun.js +3 -0
  24. package/esm/shared/getMultiVariantSourcesAutorun.d.ts +1 -0
  25. package/esm/shared/getMultiVariantSourcesAutorun.js +3 -0
  26. package/esm/shared/getSources.d.ts +5 -9
  27. package/esm/shared/getSources.js +30 -25
  28. package/esm/shared/treeDrawingAutorun.d.ts +1 -0
  29. package/esm/shared/treeDrawingAutorun.js +7 -1
  30. package/esm/shared/types.d.ts +1 -2
  31. package/package.json +8 -8
@@ -58,6 +58,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
58
58
  }> | null;
59
59
  readonly adapterConfig: any;
60
60
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
61
+ readonly isMinimized: boolean;
61
62
  readonly parentDisplay: any;
62
63
  readonly effectiveRpcDriverName: any;
63
64
  } & {
@@ -114,6 +115,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
114
115
  }> | null;
115
116
  readonly adapterConfig: any;
116
117
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
118
+ readonly isMinimized: boolean;
117
119
  readonly parentDisplay: any;
118
120
  readonly effectiveRpcDriverName: any;
119
121
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -167,6 +169,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
167
169
  }> | null;
168
170
  readonly adapterConfig: any;
169
171
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
172
+ readonly isMinimized: boolean;
170
173
  readonly parentDisplay: any;
171
174
  readonly effectiveRpcDriverName: any;
172
175
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -258,6 +261,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
258
261
  }> | null;
259
262
  readonly adapterConfig: any;
260
263
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
264
+ readonly isMinimized: boolean;
261
265
  readonly parentDisplay: any;
262
266
  readonly effectiveRpcDriverName: any;
263
267
  } & {
@@ -314,6 +318,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
314
318
  }> | null;
315
319
  readonly adapterConfig: any;
316
320
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
321
+ readonly isMinimized: boolean;
317
322
  readonly parentDisplay: any;
318
323
  readonly effectiveRpcDriverName: any;
319
324
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -367,6 +372,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
367
372
  }> | null;
368
373
  readonly adapterConfig: any;
369
374
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
375
+ readonly isMinimized: boolean;
370
376
  readonly parentDisplay: any;
371
377
  readonly effectiveRpcDriverName: any;
372
378
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -447,6 +453,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
447
453
  }> | null;
448
454
  readonly adapterConfig: any;
449
455
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
456
+ readonly isMinimized: boolean;
450
457
  readonly parentDisplay: any;
451
458
  readonly effectiveRpcDriverName: any;
452
459
  } & {
@@ -503,6 +510,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
503
510
  }> | null;
504
511
  readonly adapterConfig: any;
505
512
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
513
+ readonly isMinimized: boolean;
506
514
  readonly parentDisplay: any;
507
515
  readonly effectiveRpcDriverName: any;
508
516
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -556,6 +564,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
556
564
  }> | null;
557
565
  readonly adapterConfig: any;
558
566
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
567
+ readonly isMinimized: boolean;
559
568
  readonly parentDisplay: any;
560
569
  readonly effectiveRpcDriverName: any;
561
570
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -143,6 +143,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
143
143
  }> | null;
144
144
  readonly adapterConfig: any;
145
145
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
146
+ readonly isMinimized: boolean;
146
147
  readonly parentDisplay: any;
147
148
  readonly effectiveRpcDriverName: any;
148
149
  } & {
@@ -199,6 +200,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
199
200
  }> | null;
200
201
  readonly adapterConfig: any;
201
202
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
203
+ readonly isMinimized: boolean;
202
204
  readonly parentDisplay: any;
203
205
  readonly effectiveRpcDriverName: any;
204
206
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -252,6 +254,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
252
254
  }> | null;
253
255
  readonly adapterConfig: any;
254
256
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
257
+ readonly isMinimized: boolean;
255
258
  readonly parentDisplay: any;
256
259
  readonly effectiveRpcDriverName: any;
257
260
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -533,6 +536,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
533
536
  }> | null;
534
537
  readonly adapterConfig: any;
535
538
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
539
+ readonly isMinimized: boolean;
536
540
  readonly parentDisplay: any;
537
541
  readonly effectiveRpcDriverName: any;
538
542
  } & {
@@ -589,6 +593,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
589
593
  }> | null;
590
594
  readonly adapterConfig: any;
591
595
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
596
+ readonly isMinimized: boolean;
592
597
  readonly parentDisplay: any;
593
598
  readonly effectiveRpcDriverName: any;
594
599
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -642,6 +647,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
642
647
  }> | null;
643
648
  readonly adapterConfig: any;
644
649
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
650
+ readonly isMinimized: boolean;
645
651
  readonly parentDisplay: any;
646
652
  readonly effectiveRpcDriverName: any;
647
653
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -868,6 +874,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
868
874
  }> | null;
869
875
  readonly adapterConfig: any;
870
876
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
877
+ readonly isMinimized: boolean;
871
878
  readonly parentDisplay: any;
872
879
  readonly effectiveRpcDriverName: any;
873
880
  } & {
@@ -924,6 +931,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
924
931
  }> | null;
925
932
  readonly adapterConfig: any;
926
933
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
934
+ readonly isMinimized: boolean;
927
935
  readonly parentDisplay: any;
928
936
  readonly effectiveRpcDriverName: any;
929
937
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -977,6 +985,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
977
985
  }> | null;
978
986
  readonly adapterConfig: any;
979
987
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
988
+ readonly isMinimized: boolean;
980
989
  readonly parentDisplay: any;
981
990
  readonly effectiveRpcDriverName: any;
982
991
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1083,7 +1092,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1083
1092
  } & {
1084
1093
  featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
1085
1094
  } & {
1086
- readonly activeFilters: any;
1095
+ readonly activeFilters: string[];
1087
1096
  readonly rendererTypeName: any;
1088
1097
  readonly sequenceAdapter: any;
1089
1098
  readonly showLabels: any;
@@ -1171,6 +1180,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1171
1180
  }> | null;
1172
1181
  readonly adapterConfig: any;
1173
1182
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1183
+ readonly isMinimized: boolean;
1174
1184
  readonly parentDisplay: any;
1175
1185
  readonly effectiveRpcDriverName: any;
1176
1186
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -1224,11 +1234,14 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1224
1234
  }> | null;
1225
1235
  readonly adapterConfig: any;
1226
1236
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1237
+ readonly isMinimized: boolean;
1227
1238
  readonly parentDisplay: any;
1228
1239
  readonly effectiveRpcDriverName: any;
1229
1240
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
1230
1241
  };
1231
1242
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
1243
+ } & {
1244
+ afterAttach(): void;
1232
1245
  } & {
1233
1246
  readonly featureWidgetType: {
1234
1247
  type: string;
@@ -153,6 +153,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
153
153
  }> | null;
154
154
  readonly adapterConfig: any;
155
155
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
156
+ readonly isMinimized: boolean;
156
157
  readonly parentDisplay: any;
157
158
  readonly effectiveRpcDriverName: any;
158
159
  } & {
@@ -209,6 +210,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
209
210
  }> | null;
210
211
  readonly adapterConfig: any;
211
212
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
213
+ readonly isMinimized: boolean;
212
214
  readonly parentDisplay: any;
213
215
  readonly effectiveRpcDriverName: any;
214
216
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -262,6 +264,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
262
264
  }> | null;
263
265
  readonly adapterConfig: any;
264
266
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
267
+ readonly isMinimized: boolean;
265
268
  readonly parentDisplay: any;
266
269
  readonly effectiveRpcDriverName: any;
267
270
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -543,6 +546,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
543
546
  }> | null;
544
547
  readonly adapterConfig: any;
545
548
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
549
+ readonly isMinimized: boolean;
546
550
  readonly parentDisplay: any;
547
551
  readonly effectiveRpcDriverName: any;
548
552
  } & {
@@ -599,6 +603,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
599
603
  }> | null;
600
604
  readonly adapterConfig: any;
601
605
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
606
+ readonly isMinimized: boolean;
602
607
  readonly parentDisplay: any;
603
608
  readonly effectiveRpcDriverName: any;
604
609
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -652,6 +657,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
652
657
  }> | null;
653
658
  readonly adapterConfig: any;
654
659
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
660
+ readonly isMinimized: boolean;
655
661
  readonly parentDisplay: any;
656
662
  readonly effectiveRpcDriverName: any;
657
663
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -878,6 +884,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
878
884
  }> | null;
879
885
  readonly adapterConfig: any;
880
886
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
887
+ readonly isMinimized: boolean;
881
888
  readonly parentDisplay: any;
882
889
  readonly effectiveRpcDriverName: any;
883
890
  } & {
@@ -934,6 +941,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
934
941
  }> | null;
935
942
  readonly adapterConfig: any;
936
943
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
944
+ readonly isMinimized: boolean;
937
945
  readonly parentDisplay: any;
938
946
  readonly effectiveRpcDriverName: any;
939
947
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -987,6 +995,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
987
995
  }> | null;
988
996
  readonly adapterConfig: any;
989
997
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
998
+ readonly isMinimized: boolean;
990
999
  readonly parentDisplay: any;
991
1000
  readonly effectiveRpcDriverName: any;
992
1001
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1139,36 +1148,12 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1139
1148
  } & {
1140
1149
  readonly autoHeight: boolean;
1141
1150
  readonly activeFilters: any;
1142
- readonly sourcesWithoutLayout: {
1143
- label: string;
1144
- id: string;
1145
- baseUri?: string;
1146
- name: string;
1147
- color?: string;
1148
- group?: string;
1149
- HP?: number;
1150
- }[] | undefined;
1151
- readonly sources: {
1152
- label: string;
1153
- id: string;
1154
- baseUri?: string;
1155
- name: string;
1156
- color?: string;
1157
- group?: string;
1158
- HP?: number;
1159
- }[] | undefined;
1151
+ readonly sourcesWithoutLayout: import("../shared/types.ts").Source[] | undefined;
1152
+ readonly sources: import("../shared/types.ts").Source[] | undefined;
1160
1153
  readonly root: any;
1161
1154
  } & {
1162
1155
  readonly sourceMap: {
1163
- [k: string]: {
1164
- label: string;
1165
- id: string;
1166
- baseUri?: string;
1167
- name: string;
1168
- color?: string;
1169
- group?: string;
1170
- HP?: number;
1171
- };
1156
+ [k: string]: import("../shared/types.ts").Source;
1172
1157
  } | undefined;
1173
1158
  readonly availableHeight: number;
1174
1159
  readonly nrow: number;
@@ -154,6 +154,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
154
154
  }> | null;
155
155
  readonly adapterConfig: any;
156
156
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
157
+ readonly isMinimized: boolean;
157
158
  readonly parentDisplay: any;
158
159
  readonly effectiveRpcDriverName: any;
159
160
  } & {
@@ -210,6 +211,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
210
211
  }> | null;
211
212
  readonly adapterConfig: any;
212
213
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
214
+ readonly isMinimized: boolean;
213
215
  readonly parentDisplay: any;
214
216
  readonly effectiveRpcDriverName: any;
215
217
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -263,6 +265,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
263
265
  }> | null;
264
266
  readonly adapterConfig: any;
265
267
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
268
+ readonly isMinimized: boolean;
266
269
  readonly parentDisplay: any;
267
270
  readonly effectiveRpcDriverName: any;
268
271
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -544,6 +547,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
544
547
  }> | null;
545
548
  readonly adapterConfig: any;
546
549
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
550
+ readonly isMinimized: boolean;
547
551
  readonly parentDisplay: any;
548
552
  readonly effectiveRpcDriverName: any;
549
553
  } & {
@@ -600,6 +604,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
600
604
  }> | null;
601
605
  readonly adapterConfig: any;
602
606
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
607
+ readonly isMinimized: boolean;
603
608
  readonly parentDisplay: any;
604
609
  readonly effectiveRpcDriverName: any;
605
610
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -653,6 +658,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
653
658
  }> | null;
654
659
  readonly adapterConfig: any;
655
660
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
661
+ readonly isMinimized: boolean;
656
662
  readonly parentDisplay: any;
657
663
  readonly effectiveRpcDriverName: any;
658
664
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -879,6 +885,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
879
885
  }> | null;
880
886
  readonly adapterConfig: any;
881
887
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
888
+ readonly isMinimized: boolean;
882
889
  readonly parentDisplay: any;
883
890
  readonly effectiveRpcDriverName: any;
884
891
  } & {
@@ -935,6 +942,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
935
942
  }> | null;
936
943
  readonly adapterConfig: any;
937
944
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
945
+ readonly isMinimized: boolean;
938
946
  readonly parentDisplay: any;
939
947
  readonly effectiveRpcDriverName: any;
940
948
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -988,6 +996,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
988
996
  }> | null;
989
997
  readonly adapterConfig: any;
990
998
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
999
+ readonly isMinimized: boolean;
991
1000
  readonly parentDisplay: any;
992
1001
  readonly effectiveRpcDriverName: any;
993
1002
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1140,36 +1149,12 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1140
1149
  } & {
1141
1150
  readonly autoHeight: boolean;
1142
1151
  readonly activeFilters: any;
1143
- readonly sourcesWithoutLayout: {
1144
- label: string;
1145
- id: string;
1146
- baseUri?: string;
1147
- name: string;
1148
- color?: string;
1149
- group?: string;
1150
- HP?: number;
1151
- }[] | undefined;
1152
- readonly sources: {
1153
- label: string;
1154
- id: string;
1155
- baseUri?: string;
1156
- name: string;
1157
- color?: string;
1158
- group?: string;
1159
- HP?: number;
1160
- }[] | undefined;
1152
+ readonly sourcesWithoutLayout: import("../shared/types.ts").Source[] | undefined;
1153
+ readonly sources: import("../shared/types.ts").Source[] | undefined;
1161
1154
  readonly root: any;
1162
1155
  } & {
1163
1156
  readonly sourceMap: {
1164
- [k: string]: {
1165
- label: string;
1166
- id: string;
1167
- baseUri?: string;
1168
- name: string;
1169
- color?: string;
1170
- group?: string;
1171
- HP?: number;
1172
- };
1157
+ [k: string]: import("../shared/types.ts").Source;
1173
1158
  } | undefined;
1174
1159
  readonly availableHeight: number;
1175
1160
  readonly nrow: number;
@@ -17,8 +17,10 @@ function drawPhasedMode(drawCtx, mafs) {
17
17
  const samp = feature.get('samples');
18
18
  for (let j = startRow; j < endRow; j++) {
19
19
  const y = j * h - scrollTop;
20
- const { name, HP } = sources[j];
21
- const s = samp[name];
20
+ const source = sources[j];
21
+ const { name, HP, baseName } = source;
22
+ const sampleName = baseName ?? name;
23
+ const s = samp[sampleName];
22
24
  if (s) {
23
25
  const genotype = s.GT?.[0];
24
26
  if (genotype) {
@@ -47,8 +49,10 @@ function drawPhasedMode(drawCtx, mafs) {
47
49
  }
48
50
  for (let j = startRow; j < endRow; j++) {
49
51
  const y = j * h - scrollTop;
50
- const { name, HP } = sources[j];
51
- const genotype = samp[name];
52
+ const source = sources[j];
53
+ const { name, HP, baseName } = source;
54
+ const sampleName = baseName ?? name;
55
+ const genotype = samp[sampleName];
52
56
  if (genotype) {
53
57
  arr2.push(genotype);
54
58
  const isPhased = genotype.includes('|');
@@ -82,8 +86,9 @@ function drawAlleleCountMode(drawCtx, mafs) {
82
86
  const samp = feature.get('samples');
83
87
  for (let j = startRow; j < endRow; j++) {
84
88
  const y = j * h - scrollTop;
85
- const { name } = sources[j];
86
- const s = samp[name];
89
+ const source = sources[j];
90
+ const sampleName = source.baseName ?? source.name;
91
+ const s = samp[sampleName];
87
92
  if (s) {
88
93
  const genotype = s.GT?.[0];
89
94
  if (genotype) {
@@ -105,8 +110,9 @@ function drawAlleleCountMode(drawCtx, mafs) {
105
110
  }
106
111
  for (let j = startRow; j < endRow; j++) {
107
112
  const y = j * h - scrollTop;
108
- const { name } = sources[j];
109
- const genotype = samp[name];
113
+ const source = sources[j];
114
+ const sampleName = source.baseName ?? source.name;
115
+ const genotype = samp[sampleName];
110
116
  if (genotype) {
111
117
  arr2.push(genotype);
112
118
  const c = getAlleleColor(genotype, mostFrequentAlt, colorCache, splitCache, true);
@@ -22,8 +22,10 @@ function drawPhasedMode(drawCtx, itemData, mafs) {
22
22
  }
23
23
  for (let j = startRow; j < endRow; j++) {
24
24
  const y = j * h - scrollTop;
25
- const { name, HP } = sources[j];
26
- const genotype = samp[name];
25
+ const source = sources[j];
26
+ const { name, HP, baseName } = source;
27
+ const sampleName = baseName ?? name;
28
+ const genotype = samp[sampleName];
27
29
  if (genotype) {
28
30
  const isPhased = genotype.includes('|');
29
31
  if (isPhased) {
@@ -1,4 +1,4 @@
1
- import type { Source } from '../shared/types.ts';
1
+ import type { SampleInfo, Source } from '../shared/types.ts';
2
2
  import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  import type { Region, StopToken } from '@jbrowse/core/util';
@@ -15,6 +15,8 @@ export declare function executeClusterGenotypeMatrix({ pluginManager, args, }: {
15
15
  lengthCutoffFilter: number;
16
16
  statusCallback: (arg: string) => void;
17
17
  sources: Source[];
18
+ renderingMode?: string;
19
+ sampleInfo?: Record<string, SampleInfo>;
18
20
  };
19
21
  }): Promise<{
20
22
  order: number[];
@@ -1,10 +1,14 @@
1
1
  import { clusterData, toNewick } from '@gmod/hclust';
2
2
  import { getGenotypeMatrix } from "./getGenotypeMatrix.js";
3
+ import { getPhasedGenotypeMatrix } from "./getPhasedGenotypeMatrix.js";
3
4
  export async function executeClusterGenotypeMatrix({ pluginManager, args, }) {
4
- const matrix = await getGenotypeMatrix({
5
- pluginManager,
6
- args,
7
- });
5
+ const { renderingMode, sampleInfo } = args;
6
+ const matrix = renderingMode === 'phased' && sampleInfo
7
+ ? await getPhasedGenotypeMatrix({
8
+ pluginManager,
9
+ args: { ...args, sampleInfo },
10
+ })
11
+ : await getGenotypeMatrix({ pluginManager, args });
8
12
  const sampleLabels = Object.keys(matrix);
9
13
  const result = await clusterData({
10
14
  data: Object.values(matrix),
@@ -0,0 +1,20 @@
1
+ import type { SampleInfo, Source } from '../shared/types.ts';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
+ import type { Region } from '@jbrowse/core/util';
5
+ import type { StopToken } from '@jbrowse/core/util/stopToken';
6
+ export declare function getPhasedGenotypeMatrix({ pluginManager, args, }: {
7
+ pluginManager: PluginManager;
8
+ args: {
9
+ adapterConfig: AnyConfigurationModel;
10
+ stopToken?: StopToken;
11
+ sessionId: string;
12
+ headers?: Record<string, string>;
13
+ regions: Region[];
14
+ sources: Source[];
15
+ bpPerPx: number;
16
+ minorAlleleFrequencyFilter: number;
17
+ lengthCutoffFilter: number;
18
+ sampleInfo: Record<string, SampleInfo>;
19
+ };
20
+ }): Promise<Record<string, number[]>>;
@@ -0,0 +1,50 @@
1
+ import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
+ import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
3
+ import { firstValueFrom, toArray } from 'rxjs';
4
+ import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
5
+ export async function getPhasedGenotypeMatrix({ pluginManager, args, }) {
6
+ const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopToken, sampleInfo, } = args;
7
+ const lastCheck = createStopTokenChecker(stopToken);
8
+ const adapter = await getAdapter(pluginManager, sessionId, adapterConfig);
9
+ const dataAdapter = adapter.dataAdapter;
10
+ const rows = {};
11
+ const splitCache = {};
12
+ for (const { name } of sources) {
13
+ const info = sampleInfo[name];
14
+ const ploidy = info?.maxPloidy ?? 2;
15
+ for (let hp = 0; hp < ploidy; hp++) {
16
+ rows[`${name} HP${hp}`] = [];
17
+ }
18
+ }
19
+ const mafs = getFeaturesThatPassMinorAlleleFrequencyFilter({
20
+ minorAlleleFrequencyFilter,
21
+ lengthCutoffFilter,
22
+ lastCheck,
23
+ splitCache,
24
+ features: await firstValueFrom(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe(toArray())),
25
+ });
26
+ for (const { feature } of mafs) {
27
+ const genotypes = feature.get('genotypes');
28
+ for (const { name } of sources) {
29
+ const val = genotypes[name];
30
+ const info = sampleInfo[name];
31
+ const ploidy = info?.maxPloidy ?? 2;
32
+ const isPhased = val.includes('|');
33
+ if (isPhased) {
34
+ const alleles = splitCache[val] ?? (splitCache[val] = val.split('|'));
35
+ for (let hp = 0; hp < ploidy; hp++) {
36
+ const allele = alleles[hp];
37
+ const value = allele === '.' || allele === undefined ? -1 : +allele;
38
+ rows[`${name} HP${hp}`].push(value);
39
+ }
40
+ }
41
+ else {
42
+ for (let hp = 0; hp < ploidy; hp++) {
43
+ rows[`${name} HP${hp}`].push(-1);
44
+ }
45
+ }
46
+ }
47
+ checkStopToken2(lastCheck);
48
+ }
49
+ return rows;
50
+ }
@@ -155,6 +155,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
155
155
  }> | null;
156
156
  readonly adapterConfig: any;
157
157
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
158
+ readonly isMinimized: boolean;
158
159
  readonly parentDisplay: any;
159
160
  readonly effectiveRpcDriverName: any;
160
161
  } & {
@@ -211,6 +212,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
211
212
  }> | null;
212
213
  readonly adapterConfig: any;
213
214
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
215
+ readonly isMinimized: boolean;
214
216
  readonly parentDisplay: any;
215
217
  readonly effectiveRpcDriverName: any;
216
218
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -264,6 +266,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
264
266
  }> | null;
265
267
  readonly adapterConfig: any;
266
268
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
269
+ readonly isMinimized: boolean;
267
270
  readonly parentDisplay: any;
268
271
  readonly effectiveRpcDriverName: any;
269
272
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -545,6 +548,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
545
548
  }> | null;
546
549
  readonly adapterConfig: any;
547
550
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
551
+ readonly isMinimized: boolean;
548
552
  readonly parentDisplay: any;
549
553
  readonly effectiveRpcDriverName: any;
550
554
  } & {
@@ -601,6 +605,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
601
605
  }> | null;
602
606
  readonly adapterConfig: any;
603
607
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
608
+ readonly isMinimized: boolean;
604
609
  readonly parentDisplay: any;
605
610
  readonly effectiveRpcDriverName: any;
606
611
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -654,6 +659,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
654
659
  }> | null;
655
660
  readonly adapterConfig: any;
656
661
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
662
+ readonly isMinimized: boolean;
657
663
  readonly parentDisplay: any;
658
664
  readonly effectiveRpcDriverName: any;
659
665
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -880,6 +886,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
880
886
  }> | null;
881
887
  readonly adapterConfig: any;
882
888
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
889
+ readonly isMinimized: boolean;
883
890
  readonly parentDisplay: any;
884
891
  readonly effectiveRpcDriverName: any;
885
892
  } & {
@@ -936,6 +943,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
936
943
  }> | null;
937
944
  readonly adapterConfig: any;
938
945
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
946
+ readonly isMinimized: boolean;
939
947
  readonly parentDisplay: any;
940
948
  readonly effectiveRpcDriverName: any;
941
949
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -989,6 +997,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
989
997
  }> | null;
990
998
  readonly adapterConfig: any;
991
999
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1000
+ readonly isMinimized: boolean;
992
1001
  readonly parentDisplay: any;
993
1002
  readonly effectiveRpcDriverName: any;
994
1003
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1141,36 +1150,12 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
1141
1150
  } & {
1142
1151
  readonly autoHeight: boolean;
1143
1152
  readonly activeFilters: any;
1144
- readonly sourcesWithoutLayout: {
1145
- label: string;
1146
- id: string;
1147
- baseUri?: string;
1148
- name: string;
1149
- color?: string;
1150
- group?: string;
1151
- HP?: number;
1152
- }[] | undefined;
1153
- readonly sources: {
1154
- label: string;
1155
- id: string;
1156
- baseUri?: string;
1157
- name: string;
1158
- color?: string;
1159
- group?: string;
1160
- HP?: number;
1161
- }[] | undefined;
1153
+ readonly sourcesWithoutLayout: Source[] | undefined;
1154
+ readonly sources: Source[] | undefined;
1162
1155
  readonly root: any;
1163
1156
  } & {
1164
1157
  readonly sourceMap: {
1165
- [k: string]: {
1166
- label: string;
1167
- id: string;
1168
- baseUri?: string;
1169
- name: string;
1170
- color?: string;
1171
- group?: string;
1172
- HP?: number;
1173
- };
1158
+ [k: string]: Source;
1174
1159
  } | undefined;
1175
1160
  readonly availableHeight: number;
1176
1161
  readonly nrow: number;
@@ -122,6 +122,10 @@ export default function MultiVariantBaseModelF(configSchema) {
122
122
  self.showTree = arg;
123
123
  },
124
124
  setPhasedMode(arg) {
125
+ if (self.renderingMode !== arg) {
126
+ self.layout = [];
127
+ self.clusterTree = undefined;
128
+ }
125
129
  self.renderingMode = arg;
126
130
  },
127
131
  setAutoHeight(auto) {
@@ -157,12 +161,10 @@ export default function MultiVariantBaseModelF(configSchema) {
157
161
  : undefined;
158
162
  },
159
163
  get sources() {
160
- const sourcesWithLayout = self.layout.length
161
- ? self.layout
162
- : self.sourcesVolatile;
163
- return sourcesWithLayout
164
+ return self.sourcesVolatile
164
165
  ? getSources({
165
- sources: sourcesWithLayout,
166
+ sources: self.sourcesVolatile,
167
+ layout: self.layout.length ? self.layout : undefined,
166
168
  renderingMode: self.renderingMode,
167
169
  sampleInfo: self.sampleInfo,
168
170
  })
@@ -237,7 +239,7 @@ export default function MultiVariantBaseModelF(configSchema) {
237
239
  },
238
240
  },
239
241
  {
240
- label: 'Show tree',
242
+ label: `Show tree${!self.clusterTree ? ' (run clustering first)' : ''}`,
241
243
  type: 'checkbox',
242
244
  checked: self.showTree,
243
245
  disabled: !self.clusterTree,
@@ -305,9 +307,11 @@ export default function MultiVariantBaseModelF(configSchema) {
305
307
  },
306
308
  },
307
309
  {
308
- label: `Phased${!self.hasPhased
309
- ? ' (disabled, no phased variants found)'
310
- : ''}`,
310
+ label: `Phased${self.hasPhased
311
+ ? ''
312
+ : !self.featuresVolatile
313
+ ? ' (checking for phased variants...)'
314
+ : ' (disabled, no phased variants found)'}`,
311
315
  helpText: 'Phased mode splits each sample into multiple rows representing each haplotype, and the phasing of the variants is used to color the variant in the individual haplotype rows. For example, a diploid sample SAMPLE1 will generate two rows SAMPLE1-HP0 and SAMPLE1 HP1 and a variant 1|0 will draw a box in the top row but not the bottom row',
312
316
  disabled: !self.hasPhased,
313
317
  checked: self.renderingMode === 'phased',
@@ -7,16 +7,18 @@ import { getRpcSessionId } from '@jbrowse/core/util/tracks';
7
7
  import { isAlive } from '@jbrowse/mobx-state-tree';
8
8
  import { Button, DialogActions, DialogContent } from '@mui/material';
9
9
  import { observer } from 'mobx-react';
10
+ import { expandSourcesToHaplotypes } from "../../getSources.js";
10
11
  const ClusterDialogAuto = observer(function ClusterDialogAuto({ model, children, handleClose, }) {
11
12
  const [progress, setProgress] = useState('');
12
13
  const [loading, setLoading] = useState(false);
13
14
  const [error, setError] = useState();
14
15
  const [stopToken, setStopToken] = useState();
15
16
  const { rpcManager } = getSession(model);
16
- const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
17
- return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, _jsxs("div", { children: [loading ? (_jsxs("div", { style: { padding: 50 }, children: [_jsx("span", { children: progress || 'Loading...' }), _jsx(Button, { onClick: () => {
17
+ const { sourcesVolatile, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, renderingMode, sampleInfo, } = model;
18
+ const isHaplotypeClustering = renderingMode === 'phased';
19
+ return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, isHaplotypeClustering ? (_jsx("div", { style: { marginTop: 8, fontStyle: 'italic' }, children: "Note: Clustering by individual haplotypes (phased mode)" })) : null, _jsxs("div", { children: [loading ? (_jsxs("div", { style: { padding: 50 }, children: [_jsx("span", { children: progress || 'Loading...' }), _jsx(Button, { onClick: () => {
18
20
  stopStopToken(stopToken);
19
- }, children: "Stop" })] })) : null, error ? _jsx(ErrorMessage, { error: error }) : null] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", disabled: loading || !model.sourcesWithoutLayout, onClick: async () => {
21
+ }, children: "Stop" })] })) : null, error ? _jsx(ErrorMessage, { error: error }) : null] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", disabled: loading || !sourcesVolatile, onClick: async () => {
20
22
  try {
21
23
  setError(undefined);
22
24
  setProgress('Initializing');
@@ -25,23 +27,34 @@ const ClusterDialogAuto = observer(function ClusterDialogAuto({ model, children,
25
27
  if (!view.initialized) {
26
28
  return;
27
29
  }
28
- if (sourcesWithoutLayout) {
30
+ if (sourcesVolatile) {
29
31
  const sessionId = getRpcSessionId(model);
30
32
  const stopToken = createStopToken();
31
33
  setStopToken(stopToken);
32
34
  const ret = (await rpcManager.call(sessionId, 'MultiVariantClusterGenotypeMatrix', {
33
35
  regions: view.dynamicBlocks.contentBlocks,
34
- sources: sourcesWithoutLayout,
36
+ sources: sourcesVolatile,
35
37
  minorAlleleFrequencyFilter,
36
38
  lengthCutoffFilter,
37
39
  sessionId,
38
40
  adapterConfig,
39
41
  stopToken,
42
+ renderingMode,
43
+ sampleInfo,
40
44
  statusCallback: (arg) => {
41
45
  setProgress(arg);
42
46
  },
43
47
  }));
44
- model.setLayout(ret.order.map(idx => sourcesWithoutLayout[idx]), false);
48
+ if (isHaplotypeClustering && sampleInfo) {
49
+ const expandedSources = expandSourcesToHaplotypes({
50
+ sources: sourcesVolatile,
51
+ sampleInfo,
52
+ });
53
+ model.setLayout(ret.order.map(idx => expandedSources[idx]), false);
54
+ }
55
+ else {
56
+ model.setLayout(ret.order.map(idx => sourcesVolatile[idx]), false);
57
+ }
45
58
  model.setClusterTree(ret.tree);
46
59
  }
47
60
  handleClose();
@@ -1,10 +1,13 @@
1
- import type { Source } from '../../types.ts';
1
+ import type { SampleInfo, Source } from '../../types.ts';
2
2
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
3
  export interface ReducedModel {
4
4
  sourcesWithoutLayout?: Source[];
5
+ sourcesVolatile?: Source[];
5
6
  minorAlleleFrequencyFilter?: number;
6
7
  lengthCutoffFilter: number;
7
8
  adapterConfig: AnyConfigurationModel;
9
+ renderingMode: string;
10
+ sampleInfo?: Record<string, SampleInfo>;
8
11
  setClusterTree: (arg?: string) => void;
9
12
  setLayout: (arg: Source[], clearTree?: boolean) => void;
10
13
  clearLayout: () => void;
@@ -10,10 +10,10 @@ const LegendItem = function ({ source, idx, rowHeight, }) {
10
10
  return color ? (_jsx(RectBg, { y: idx * rowHeight, x: 0, width: colorBoxWidth + 0.5, height: rowHeight + 0.5, color: color })) : null;
11
11
  };
12
12
  const LegendItemText = function ({ source, idx, rowHeight, textFillProps, }) {
13
- const { color, name, label } = source;
13
+ const { color, name } = source;
14
14
  const svgFontSize = Math.min(rowHeight, 12);
15
15
  const colorBoxWidth = 15;
16
- return (_jsx("text", { y: idx * rowHeight + svgFontSize, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, ...textFillProps, children: label || name }));
16
+ return (_jsx("text", { y: (idx + 0.5) * rowHeight, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, dominantBaseline: "central", ...textFillProps, children: name }));
17
17
  };
18
18
  const MultiVariantColorLegend = observer(function MultiVariantColorLegend({ model, labelWidth, }) {
19
19
  const { canDisplayLabels, rowHeight, sources } = model;
@@ -22,8 +22,8 @@ const MultiVariantColorLegend = observer(function MultiVariantColorLegend({ mode
22
22
  const hasColors = useMemo(() => sources?.some(s => s.color) ?? false, [sources]);
23
23
  const legendWidth = labelWidth + (hasColors ? colorBoxWidth + 5 : 0);
24
24
  const textFillProps = useMemo(() => getFillProps(theme.palette.text.primary), [theme.palette.text.primary]);
25
- return sources ? (_jsxs(_Fragment, { children: [canDisplayLabels ? (_jsx(RectBg, { y: 0, x: 0, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, rowHeight: rowHeight }, `${source.label}-${idx}`))), canDisplayLabels
26
- ? sources.map((source, idx) => (_jsx(LegendItemText, { source: source, idx: idx, rowHeight: rowHeight, textFillProps: textFillProps }, `${source.label}-text-${idx}`)))
25
+ return sources ? (_jsxs(_Fragment, { children: [canDisplayLabels ? (_jsx(RectBg, { y: 0, x: 0, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, rowHeight: rowHeight }, `${source.name}-${idx}`))), canDisplayLabels
26
+ ? sources.map((source, idx) => (_jsx(LegendItemText, { source: source, idx: idx, rowHeight: rowHeight, textFillProps: textFillProps }, `${source.name}-text-${idx}`)))
27
27
  : null] })) : null;
28
28
  });
29
29
  export default MultiVariantColorLegend;
@@ -15,7 +15,7 @@ const MultiVariantLegendBar = observer(function MultiVariantLegendBar(props) {
15
15
  let maxWidth = 0;
16
16
  for (const s of sources) {
17
17
  const width = canDisplayLabels
18
- ? measureText(s.label, svgFontSize) + 10
18
+ ? measureText(s.name, svgFontSize) + 10
19
19
  : 20;
20
20
  if (width > maxWidth) {
21
21
  maxWidth = width;
@@ -1,6 +1,7 @@
1
1
  declare const MultiVariantTooltip: import("react").NamedExoticComponent<{
2
2
  source: {
3
3
  color?: string;
4
+ name?: string;
4
5
  [key: string]: unknown;
5
6
  };
6
7
  x: number;
@@ -28,9 +28,9 @@ const useStyles = makeStyles()(theme => ({
28
28
  marginRight: 4,
29
29
  },
30
30
  }));
31
- const EXCLUDE_KEYS = new Set(['color', 'HP', 'name', 'id']);
31
+ const EXCLUDE_KEYS = new Set(['color', 'HP', 'name', 'baseName', 'id']);
32
32
  const MultiVariantTooltip = memo(function MultiVariantTooltip({ source, x, y, }) {
33
33
  const { classes } = useStyles();
34
- return (_jsx(Portal, { children: _jsxs("div", { className: classes.tooltip, style: { transform: `translate(${x + 10}px, ${y + 10}px)` }, children: [source.color ? (_jsx("div", { className: classes.colorBox, style: { backgroundColor: source.color } })) : null, Object.entries(source).map(([key, value]) => !EXCLUDE_KEYS.has(key) && value !== undefined ? (_jsxs("div", { className: classes.row, children: [key, ": ", String(value)] }, key)) : null)] }) }));
34
+ return (_jsx(Portal, { children: _jsxs("div", { className: classes.tooltip, style: { transform: `translate(${x + 10}px, ${y + 10}px)` }, children: [source.color ? (_jsx("div", { className: classes.colorBox, style: { backgroundColor: source.color } })) : null, source.name ? _jsx("div", { className: classes.row, children: source.name }) : null, Object.entries(source).map(([key, value]) => !EXCLUDE_KEYS.has(key) && value !== undefined ? (_jsxs("div", { className: classes.row, children: [key, ": ", String(value)] }, key)) : null)] }) }));
35
35
  });
36
36
  export default MultiVariantTooltip;
@@ -3,6 +3,6 @@ import { getFillProps } from '@jbrowse/core/util';
3
3
  import { alpha, useTheme } from '@mui/material';
4
4
  const RectBg = ({ x, y, width, height, color, }) => {
5
5
  const theme = useTheme();
6
- return (_jsx("rect", { pointerEvents: "auto", x: x, y: y, width: width, height: height, ...getFillProps(color || alpha(theme.palette.background.paper, 0.3)) }));
6
+ return (_jsx("rect", { pointerEvents: "auto", x: x, y: y, width: width, height: height, ...getFillProps(color || alpha(theme.palette.background.paper, 0.8)) }));
7
7
  };
8
8
  export default RectBg;
@@ -14,12 +14,12 @@ const useStyles = makeStyles()({
14
14
  });
15
15
  export default function SourcesDataGrid({ rows, onChange, setSelected, }) {
16
16
  const { classes } = useStyles();
17
- const { id: _id, name: _name, label: _label, color: _color, baseUri: _baseUri, HP: _HP, ...rest } = rows[0];
17
+ const { name: _name, color: _color, baseUri: _baseUri, baseName: _baseName, HP: _HP, ...rest } = rows[0];
18
18
  const [currSort, setCurrSort] = useState({
19
19
  idx: 0,
20
20
  field: null,
21
21
  });
22
- return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, disableRowSelectionOnClick: true, onRowSelectionModelChange: arg => {
22
+ return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, disableRowSelectionOnClick: true, getRowId: row => row.name, onRowSelectionModelChange: arg => {
23
23
  setSelected([...arg.ids]);
24
24
  }, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
25
25
  {
@@ -37,9 +37,9 @@ export default function SourcesDataGrid({ rows, onChange, setSelected, }) {
37
37
  },
38
38
  },
39
39
  {
40
- field: 'label',
40
+ field: 'name',
41
41
  headerName: 'Name',
42
- width: measureGridWidth(rows.map(r => r.label)),
42
+ width: measureGridWidth(rows.map(r => r.name)),
43
43
  },
44
44
  ...Object.keys(rest).map(val => ({
45
45
  field: val,
@@ -4,6 +4,7 @@ import { ResizeHandle } from '@jbrowse/core/ui';
4
4
  import { getContainingView } from '@jbrowse/core/util';
5
5
  import Flatbush from '@jbrowse/core/util/flatbush';
6
6
  import { makeStyles } from '@jbrowse/core/util/tss-react';
7
+ import { alpha } from '@mui/material';
7
8
  import { autorun } from 'mobx';
8
9
  import { observer } from 'mobx-react';
9
10
  const useStyles = makeStyles()(theme => ({
@@ -18,6 +19,12 @@ const useStyles = makeStyles()(theme => ({
18
19
  background: theme.palette.divider,
19
20
  },
20
21
  },
22
+ treeBackground: {
23
+ position: 'absolute',
24
+ top: 0,
25
+ left: 0,
26
+ background: alpha(theme.palette.background.paper, 0.8),
27
+ },
21
28
  }));
22
29
  function getDescendantNames(node) {
23
30
  if (!node.children?.length) {
@@ -90,7 +97,10 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
90
97
  left: 0,
91
98
  height: 0,
92
99
  zIndex: 100,
93
- }, children: [_jsx("canvas", { ref: treeCanvasRef, width: treeAreaWidth * 2, height: height * 2, style: {
100
+ }, children: [_jsx("div", { className: classes.treeBackground, style: {
101
+ width: treeAreaWidth,
102
+ height,
103
+ } }), _jsx("canvas", { ref: treeCanvasRef, width: treeAreaWidth * 2, height: height * 2, style: {
94
104
  width: treeAreaWidth,
95
105
  height,
96
106
  position: 'absolute',
@@ -9,6 +9,7 @@ export declare function getMultiVariantFeaturesAutorun(self: {
9
9
  minorAlleleFrequencyFilter: number;
10
10
  lengthCutoffFilter: number;
11
11
  featureDensityStatsReadyAndRegionNotTooLarge: boolean;
12
+ isMinimized: boolean;
12
13
  adapterProps: () => Record<string, unknown>;
13
14
  setError: (error: unknown) => void;
14
15
  setFeatures: (f: Feature[]) => void;
@@ -7,6 +7,9 @@ import { autorun } from 'mobx';
7
7
  export function getMultiVariantFeaturesAutorun(self) {
8
8
  addDisposer(self, autorun(async () => {
9
9
  try {
10
+ if (!isAlive(self) || self.isMinimized) {
11
+ return;
12
+ }
10
13
  const view = getContainingView(self);
11
14
  if (!view.initialized ||
12
15
  !self.featureDensityStatsReadyAndRegionNotTooLarge) {
@@ -4,6 +4,7 @@ import type { StopToken } from '@jbrowse/core/util/stopToken';
4
4
  export declare function getMultiVariantSourcesAutorun(self: {
5
5
  configuration: AnyConfigurationModel;
6
6
  adapterConfig: AnyConfigurationModel;
7
+ isMinimized: boolean;
7
8
  adapterProps: () => Record<string, unknown>;
8
9
  setSourcesLoading: (aborter: StopToken) => void;
9
10
  setError: (error: unknown) => void;
@@ -7,6 +7,9 @@ import { autorun } from 'mobx';
7
7
  export function getMultiVariantSourcesAutorun(self) {
8
8
  addDisposer(self, autorun(async () => {
9
9
  try {
10
+ if (!isAlive(self) || self.isMinimized) {
11
+ return;
12
+ }
10
13
  const view = getContainingView(self);
11
14
  if (!view.initialized) {
12
15
  return;
@@ -1,15 +1,11 @@
1
1
  import type { SampleInfo, Source } from './types.ts';
2
+ export declare function expandSourcesToHaplotypes({ sources, sampleInfo, }: {
3
+ sources: Source[];
4
+ sampleInfo: Record<string, SampleInfo>;
5
+ }): Source[];
2
6
  export declare function getSources({ sources, layout, renderingMode, sampleInfo, }: {
3
7
  sources: Source[];
4
8
  layout?: Source[];
5
9
  renderingMode: string;
6
10
  sampleInfo?: Record<string, SampleInfo>;
7
- }): {
8
- label: string;
9
- id: string;
10
- baseUri?: string;
11
- name: string;
12
- color?: string;
13
- group?: string;
14
- HP?: number;
15
- }[];
11
+ }): Source[];
@@ -1,31 +1,36 @@
1
+ function makeHaplotypeSources(source, ploidy) {
2
+ const results = [];
3
+ for (let i = 0; i < ploidy; i++) {
4
+ const name = `${source.name} HP${i}`;
5
+ results.push({ ...source, name, baseName: source.name, HP: i });
6
+ }
7
+ return results;
8
+ }
9
+ export function expandSourcesToHaplotypes({ sources, sampleInfo, }) {
10
+ return sources.flatMap(source => {
11
+ const ploidy = sampleInfo[source.name]?.maxPloidy ?? 2;
12
+ return makeHaplotypeSources(source, ploidy);
13
+ });
14
+ }
1
15
  export function getSources({ sources, layout = sources, renderingMode, sampleInfo, }) {
2
- const rows = [];
3
16
  const sourceMap = Object.fromEntries(sources.map(s => [s.name, s]));
4
- for (const row of layout) {
17
+ return layout.flatMap(row => {
18
+ const sampleName = row.baseName ?? row.name;
19
+ const baseSource = sourceMap[sampleName];
20
+ if (!baseSource) {
21
+ return [];
22
+ }
23
+ const merged = { ...baseSource, ...row };
5
24
  if (renderingMode === 'phased') {
6
- const info = sampleInfo?.[row.name];
7
- if (info?.isPhased) {
8
- const ploidy = info.maxPloidy;
9
- for (let i = 0; i < ploidy; i++) {
10
- const id = `${row.name} HP${i}`;
11
- rows.push({
12
- ...sourceMap[row.name],
13
- ...row,
14
- label: id,
15
- HP: i,
16
- id: id,
17
- });
18
- }
25
+ if (row.HP !== undefined) {
26
+ return [{ ...merged, baseName: sampleName }];
19
27
  }
28
+ const ploidy = sampleInfo?.[row.name]?.maxPloidy;
29
+ if (ploidy) {
30
+ return makeHaplotypeSources(merged, ploidy);
31
+ }
32
+ return [];
20
33
  }
21
- else {
22
- rows.push({
23
- ...sourceMap[row.name],
24
- ...row,
25
- label: row.name,
26
- id: row.name,
27
- });
28
- }
29
- }
30
- return rows;
34
+ return [merged];
35
+ });
31
36
  }
@@ -11,6 +11,7 @@ interface TreeDrawingModel {
11
11
  totalHeight: number;
12
12
  hoveredTreeNode?: HoveredTreeNode;
13
13
  sources?: Source[];
14
+ isMinimized: boolean;
14
15
  }
15
16
  export declare function setupTreeDrawingAutorun(self: TreeDrawingModel): void;
16
17
  export {};
@@ -1,8 +1,11 @@
1
1
  import { getContainingView } from '@jbrowse/core/util';
2
- import { addDisposer } from '@jbrowse/mobx-state-tree';
2
+ import { addDisposer, isAlive } from '@jbrowse/mobx-state-tree';
3
3
  import { autorun } from 'mobx';
4
4
  export function setupTreeDrawingAutorun(self) {
5
5
  addDisposer(self, autorun(function treeDrawAutorun() {
6
+ if (!isAlive(self) || self.isMinimized) {
7
+ return;
8
+ }
6
9
  const { treeCanvas, hierarchy, treeAreaWidth, height, scrollTop, totalHeight: _totalHeight, } = self;
7
10
  if (!treeCanvas || !hierarchy) {
8
11
  return;
@@ -34,6 +37,9 @@ export function setupTreeDrawingAutorun(self) {
34
37
  name: 'TreeDraw',
35
38
  }));
36
39
  addDisposer(self, autorun(function treeHoverAutorun() {
40
+ if (!isAlive(self) || self.isMinimized) {
41
+ return;
42
+ }
37
43
  const { mouseoverCanvas, hierarchy, rowHeight, hoveredTreeNode, height, scrollTop, sources, totalHeight, } = self;
38
44
  if (!mouseoverCanvas) {
39
45
  return;
@@ -3,11 +3,10 @@ import type { Feature } from '@jbrowse/core/util';
3
3
  export interface Source {
4
4
  baseUri?: string;
5
5
  name: string;
6
- label?: string;
6
+ baseName?: string;
7
7
  color?: string;
8
8
  group?: string;
9
9
  HP?: number;
10
- id?: string;
11
10
  [key: string]: unknown;
12
11
  }
13
12
  export interface SampleInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -27,20 +27,20 @@
27
27
  "@jbrowse/mobx-state-tree": "^5.5.0",
28
28
  "@mui/icons-material": "^7.3.6",
29
29
  "@mui/material": "^7.3.6",
30
- "@mui/x-charts-vendor": "^8.23.0",
31
- "@mui/x-data-grid": "^8.23.0",
30
+ "@mui/x-charts-vendor": "^8.25.0",
31
+ "@mui/x-data-grid": "^8.25.0",
32
+ "@types/file-saver-es": "^2.0.3",
32
33
  "copy-to-clipboard": "^3.3.3",
33
34
  "escape-html": "^1.0.3",
34
35
  "fast-deep-equal": "^3.1.3",
35
- "@types/file-saver-es": "^2.0.3",
36
36
  "file-saver-es": "^2.0.5",
37
37
  "mobx": "^6.15.0",
38
38
  "mobx-react": "^9.2.1",
39
39
  "rxjs": "^7.8.2",
40
- "@jbrowse/plugin-circular-view": "^4.0.2",
41
- "@jbrowse/sv-core": "^4.0.2",
42
- "@jbrowse/core": "^4.0.2",
43
- "@jbrowse/plugin-linear-genome-view": "^4.0.2"
40
+ "@jbrowse/plugin-circular-view": "^4.0.4",
41
+ "@jbrowse/plugin-linear-genome-view": "^4.0.4",
42
+ "@jbrowse/sv-core": "^4.0.4",
43
+ "@jbrowse/core": "^4.0.4"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=18.0.0"