@jbrowse/plugin-variants 3.1.0 → 3.3.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.
Files changed (237) hide show
  1. package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
  2. package/dist/MultiLinearVariantDisplay/index.js +1 -1
  3. package/dist/MultiLinearVariantDisplay/model.d.ts +58 -3
  4. package/dist/MultiLinearVariantDisplay/model.js +0 -1
  5. package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -2
  6. package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -5
  7. package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +3 -3
  8. package/dist/MultiLinearVariantMatrixDisplay/index.js +1 -1
  9. package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
  10. package/dist/MultiLinearVariantMatrixDisplay/model.js +5 -1
  11. package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +2 -2
  12. package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
  13. package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
  14. package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +41 -0
  15. package/dist/MultiLinearVariantMatrixRenderer/index.js +4 -4
  16. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
  17. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +15 -8
  18. package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
  19. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
  20. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
  21. package/dist/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
  22. package/dist/MultiLinearVariantRenderer/{MultiVariantRendering.js → components/MultiLinearVariantRendering.js} +25 -7
  23. package/dist/MultiLinearVariantRenderer/components/util.d.ts +1 -0
  24. package/dist/MultiLinearVariantRenderer/components/util.js +15 -0
  25. package/dist/MultiLinearVariantRenderer/index.js +2 -2
  26. package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
  27. package/dist/MultiLinearVariantRenderer/makeImageData.js +63 -23
  28. package/dist/MultiLinearVariantRenderer/types.d.ts +1 -0
  29. package/dist/SplitVcfTabixAdapter/configSchema.js +4 -2
  30. package/dist/VariantFeatureWidget/AltFormatter.d.ts +4 -0
  31. package/dist/VariantFeatureWidget/AltFormatter.js +13 -0
  32. package/dist/VariantFeatureWidget/Checkbox2.js +1 -8
  33. package/dist/VariantFeatureWidget/Formatter.d.ts +3 -0
  34. package/dist/VariantFeatureWidget/Formatter.js +23 -0
  35. package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +3 -5
  36. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
  37. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
  38. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +80 -0
  39. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
  40. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +41 -20
  41. package/dist/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
  42. package/dist/VariantFeatureWidget/VariantSampleGrid/types.js +2 -0
  43. package/dist/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
  44. package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
  45. package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
  46. package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.js +30 -0
  47. package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
  48. package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
  49. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
  50. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
  51. package/dist/VariantRPC/getGenotypeMatrix.d.ts +6 -0
  52. package/dist/VariantRPC/getGenotypeMatrix.js +60 -0
  53. package/dist/VariantRPC/types.d.ts +36 -0
  54. package/dist/VariantRPC/types.js +2 -0
  55. package/dist/VcfAdapter/VcfAdapter.js +6 -3
  56. package/dist/VcfFeature/index.js +0 -1
  57. package/dist/VcfFeature/util.d.ts +2 -0
  58. package/dist/VcfFeature/util.js +125 -27
  59. package/dist/VcfTabixAdapter/VcfTabixAdapter.js +17 -7
  60. package/dist/getMultiVariantFeaturesAutorun.d.ts +2 -0
  61. package/dist/getMultiVariantFeaturesAutorun.js +9 -2
  62. package/dist/getMultiVariantSourcesAutorun.js +3 -2
  63. package/dist/index.js +2 -0
  64. package/dist/shared/MultiVariantBaseModel.d.ts +59 -3
  65. package/dist/shared/MultiVariantBaseModel.js +95 -37
  66. package/dist/shared/components/AddFiltersDialog.d.ts +9 -0
  67. package/dist/shared/components/AddFiltersDialog.js +61 -0
  68. package/dist/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
  69. package/dist/shared/components/MultiVariantBaseDisplayComponent.js +29 -0
  70. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
  71. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.js +29 -0
  72. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
  73. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +74 -0
  74. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
  75. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +145 -0
  76. package/dist/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
  77. package/dist/shared/components/MultiVariantClusterDialog/types.js +2 -0
  78. package/{esm/shared/components/ColorLegend.d.ts → dist/shared/components/MultiVariantColorLegend.d.ts} +2 -2
  79. package/dist/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +5 -3
  80. package/dist/shared/components/MultiVariantCrosshairs.d.ts +7 -0
  81. package/dist/shared/components/MultiVariantCrosshairs.js +40 -0
  82. package/dist/shared/components/MultiVariantLegendBar.d.ts +7 -0
  83. package/dist/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +2 -2
  84. package/dist/shared/components/MultiVariantTooltip.d.ts +4 -0
  85. package/dist/shared/components/MultiVariantTooltip.js +3 -2
  86. package/dist/shared/components/RectBg.js +4 -2
  87. package/dist/shared/components/SetColorDialog.js +1 -1
  88. package/dist/shared/components/SourcesDataGrid.d.ts +2 -1
  89. package/dist/shared/components/SourcesDataGrid.js +2 -2
  90. package/dist/shared/components/SourcesGrid.js +1 -1
  91. package/dist/shared/components/SourcesGridHeader.d.ts +2 -1
  92. package/dist/shared/components/SourcesGridHeader.js +2 -2
  93. package/dist/shared/drawAlleleCount.d.ts +1 -1
  94. package/dist/shared/drawAlleleCount.js +29 -5
  95. package/dist/shared/drawPhased.d.ts +1 -1
  96. package/dist/shared/drawPhased.js +14 -10
  97. package/dist/shared/getSources.d.ts +15 -0
  98. package/dist/shared/getSources.js +34 -0
  99. package/dist/shared/minorAlleleFrequencyUtils.d.ts +6 -1
  100. package/dist/shared/minorAlleleFrequencyUtils.js +4 -5
  101. package/dist/shared/sourcesGridUtils.d.ts +3 -2
  102. package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +2 -2
  103. package/esm/MultiLinearVariantDisplay/index.js +1 -1
  104. package/esm/MultiLinearVariantDisplay/model.d.ts +58 -3
  105. package/esm/MultiLinearVariantDisplay/model.js +0 -1
  106. package/esm/MultiLinearVariantDisplay/renderSvg.js +1 -1
  107. package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -8
  108. package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +2 -2
  109. package/esm/MultiLinearVariantMatrixDisplay/index.js +1 -1
  110. package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
  111. package/esm/MultiLinearVariantMatrixDisplay/model.js +5 -1
  112. package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +1 -1
  113. package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
  114. package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
  115. package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +39 -0
  116. package/esm/MultiLinearVariantMatrixRenderer/index.js +4 -4
  117. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
  118. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +16 -9
  119. package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
  120. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
  121. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
  122. package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
  123. package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.js → MultiLinearVariantRendering.js} +25 -7
  124. package/esm/MultiLinearVariantRenderer/components/util.d.ts +1 -0
  125. package/esm/MultiLinearVariantRenderer/components/util.js +12 -0
  126. package/esm/MultiLinearVariantRenderer/index.js +1 -1
  127. package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
  128. package/esm/MultiLinearVariantRenderer/makeImageData.js +64 -24
  129. package/esm/MultiLinearVariantRenderer/types.d.ts +1 -0
  130. package/esm/SplitVcfTabixAdapter/configSchema.js +4 -2
  131. package/esm/VariantFeatureWidget/AltFormatter.d.ts +4 -0
  132. package/esm/VariantFeatureWidget/AltFormatter.js +10 -0
  133. package/esm/VariantFeatureWidget/Checkbox2.js +2 -9
  134. package/esm/VariantFeatureWidget/Formatter.d.ts +3 -0
  135. package/esm/VariantFeatureWidget/Formatter.js +17 -0
  136. package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +4 -6
  137. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
  138. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
  139. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +74 -0
  140. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
  141. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +43 -22
  142. package/esm/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
  143. package/esm/VariantFeatureWidget/VariantSampleGrid/types.js +1 -0
  144. package/esm/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
  145. package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
  146. package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
  147. package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.js +23 -0
  148. package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
  149. package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
  150. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
  151. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
  152. package/esm/VariantRPC/getGenotypeMatrix.d.ts +6 -0
  153. package/esm/VariantRPC/getGenotypeMatrix.js +57 -0
  154. package/esm/VariantRPC/types.d.ts +36 -0
  155. package/esm/VariantRPC/types.js +1 -0
  156. package/esm/VcfAdapter/VcfAdapter.js +7 -4
  157. package/esm/VcfFeature/index.js +0 -1
  158. package/esm/VcfFeature/util.d.ts +2 -0
  159. package/esm/VcfFeature/util.js +123 -27
  160. package/esm/VcfTabixAdapter/VcfTabixAdapter.js +18 -8
  161. package/esm/getMultiVariantFeaturesAutorun.d.ts +2 -0
  162. package/esm/getMultiVariantFeaturesAutorun.js +9 -2
  163. package/esm/getMultiVariantSourcesAutorun.js +3 -2
  164. package/esm/index.js +2 -0
  165. package/esm/shared/MultiVariantBaseModel.d.ts +59 -3
  166. package/esm/shared/MultiVariantBaseModel.js +97 -39
  167. package/esm/shared/components/AddFiltersDialog.d.ts +9 -0
  168. package/esm/shared/components/AddFiltersDialog.js +59 -0
  169. package/esm/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
  170. package/esm/shared/components/MultiVariantBaseDisplayComponent.js +24 -0
  171. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
  172. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.js +24 -0
  173. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
  174. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +72 -0
  175. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
  176. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +140 -0
  177. package/esm/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
  178. package/esm/shared/components/MultiVariantClusterDialog/types.js +1 -0
  179. package/{dist/shared/components/ColorLegend.d.ts → esm/shared/components/MultiVariantColorLegend.d.ts} +2 -2
  180. package/esm/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +6 -4
  181. package/esm/shared/components/MultiVariantCrosshairs.d.ts +7 -0
  182. package/esm/shared/components/MultiVariantCrosshairs.js +35 -0
  183. package/esm/shared/components/MultiVariantLegendBar.d.ts +7 -0
  184. package/esm/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +1 -1
  185. package/esm/shared/components/MultiVariantTooltip.d.ts +4 -0
  186. package/esm/shared/components/MultiVariantTooltip.js +3 -2
  187. package/esm/shared/components/RectBg.js +4 -2
  188. package/esm/shared/components/SetColorDialog.js +1 -1
  189. package/esm/shared/components/SourcesDataGrid.d.ts +2 -1
  190. package/esm/shared/components/SourcesDataGrid.js +2 -2
  191. package/esm/shared/components/SourcesGrid.js +1 -1
  192. package/esm/shared/components/SourcesGridHeader.d.ts +2 -1
  193. package/esm/shared/components/SourcesGridHeader.js +2 -2
  194. package/esm/shared/drawAlleleCount.d.ts +1 -1
  195. package/esm/shared/drawAlleleCount.js +29 -5
  196. package/esm/shared/drawPhased.d.ts +1 -1
  197. package/esm/shared/drawPhased.js +14 -10
  198. package/esm/shared/getSources.d.ts +15 -0
  199. package/esm/shared/getSources.js +31 -0
  200. package/esm/shared/minorAlleleFrequencyUtils.d.ts +6 -1
  201. package/esm/shared/minorAlleleFrequencyUtils.js +5 -6
  202. package/esm/shared/sourcesGridUtils.d.ts +3 -2
  203. package/package.json +10 -9
  204. package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
  205. package/dist/MultiLinearVariantDisplay/components/Crosshair.js +0 -35
  206. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
  207. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -28
  208. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
  209. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -38
  210. package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
  211. package/dist/MultiLinearVariantRenderer/components/MultiVariantRendering.js +0 -52
  212. package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
  213. package/dist/VariantFeatureWidget/VariantConsequencePanel.js +0 -15
  214. package/dist/shared/components/ClusterDialog.d.ts +0 -11
  215. package/dist/shared/components/ClusterDialog.js +0 -113
  216. package/dist/shared/components/LegendBar.d.ts +0 -18
  217. package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
  218. package/esm/MultiLinearVariantDisplay/components/Crosshair.js +0 -30
  219. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
  220. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -23
  221. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
  222. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -36
  223. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
  224. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +0 -47
  225. package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
  226. package/esm/VariantFeatureWidget/VariantConsequencePanel.js +0 -9
  227. package/esm/shared/components/ClusterDialog.d.ts +0 -11
  228. package/esm/shared/components/ClusterDialog.js +0 -107
  229. package/esm/shared/components/LegendBar.d.ts +0 -18
  230. /package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
  231. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
  232. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
  233. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
  234. /package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
  235. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
  236. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
  237. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
@@ -39,18 +39,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.default = MultiVariantBaseModelF;
40
40
  const react_1 = require("react");
41
41
  const configuration_1 = require("@jbrowse/core/configuration");
42
+ const serializableFilterChain_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain"));
42
43
  const util_1 = require("@jbrowse/core/util");
43
44
  const stopToken_1 = require("@jbrowse/core/util/stopToken");
44
45
  const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
46
+ const Category_1 = __importDefault(require("@mui/icons-material/Category"));
45
47
  const FilterList_1 = __importDefault(require("@mui/icons-material/FilterList"));
46
48
  const Height_1 = __importDefault(require("@mui/icons-material/Height"));
47
49
  const Splitscreen_1 = __importDefault(require("@mui/icons-material/Splitscreen"));
48
50
  const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
49
51
  const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
50
52
  const mobx_state_tree_1 = require("mobx-state-tree");
53
+ const getSources_1 = require("./getSources");
51
54
  const SetColorDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetColorDialog'))));
52
55
  const MAFFilterDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/MAFFilterDialog'))));
53
- const ClusterDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ClusterDialog'))));
56
+ const AddFiltersDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/AddFiltersDialog'))));
57
+ const ClusterDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/MultiVariantClusterDialog/ClusterDialog'))));
54
58
  const SetRowHeightDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetRowHeightDialog'))));
55
59
  function MultiVariantBaseModelF(configSchema) {
56
60
  return mobx_state_tree_1.types
@@ -58,14 +62,18 @@ function MultiVariantBaseModelF(configSchema) {
58
62
  type: mobx_state_tree_1.types.literal('LinearVariantMatrixDisplay'),
59
63
  layout: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.frozen(), []),
60
64
  configuration: (0, configuration_1.ConfigurationReference)(configSchema),
61
- minorAlleleFrequencyFilter: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0.1),
65
+ minorAlleleFrequencyFilter: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
62
66
  showSidebarLabelsSetting: true,
63
67
  renderingMode: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, 'alleleCount'),
64
68
  rowHeightSetting: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 8),
65
69
  autoHeight: true,
70
+ lengthCutoffFilter: Number.MAX_SAFE_INTEGER,
71
+ jexlFilters: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.array(mobx_state_tree_1.types.string)),
72
+ referenceDrawingMode: 'skip',
66
73
  }))
67
74
  .volatile(() => ({
68
75
  sourcesLoadingStopToken: undefined,
76
+ simplifiedFeaturesStopToken: undefined,
69
77
  featureUnderMouseVolatile: undefined,
70
78
  sourcesVolatile: undefined,
71
79
  featuresVolatile: undefined,
@@ -74,6 +82,9 @@ function MultiVariantBaseModelF(configSchema) {
74
82
  hoveredGenotype: undefined,
75
83
  }))
76
84
  .actions(self => ({
85
+ setJexlFilters(f) {
86
+ self.jexlFilters = (0, mobx_state_tree_1.cast)(f);
87
+ },
77
88
  setRowHeight(arg) {
78
89
  self.rowHeightSetting = arg;
79
90
  },
@@ -95,6 +106,12 @@ function MultiVariantBaseModelF(configSchema) {
95
106
  }
96
107
  self.sourcesLoadingStopToken = str;
97
108
  },
109
+ setSimplifiedFeaturesLoading(str) {
110
+ if (self.simplifiedFeaturesStopToken) {
111
+ (0, stopToken_1.stopStopToken)(self.simplifiedFeaturesStopToken);
112
+ }
113
+ self.simplifiedFeaturesStopToken = str;
114
+ },
98
115
  setSources(sources) {
99
116
  if (!(0, fast_deep_equal_1.default)(sources, self.sourcesVolatile)) {
100
117
  self.sourcesVolatile = sources;
@@ -120,50 +137,48 @@ function MultiVariantBaseModelF(configSchema) {
120
137
  self.sampleInfo = arg;
121
138
  }
122
139
  },
140
+ setReferenceDrawingMode(arg) {
141
+ self.referenceDrawingMode = arg;
142
+ },
123
143
  }))
124
144
  .views(self => ({
145
+ get activeFilters() {
146
+ var _a;
147
+ return ((_a = self.jexlFilters) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'jexlFilters').map((r) => `jexl:${r}`));
148
+ },
125
149
  get preSources() {
126
150
  return self.layout.length ? self.layout : self.sourcesVolatile;
127
151
  },
152
+ get sourcesWithoutLayout() {
153
+ return self.sourcesVolatile
154
+ ? (0, getSources_1.getSources)({
155
+ sources: self.sourcesVolatile,
156
+ renderingMode: self.renderingMode,
157
+ sampleInfo: self.sampleInfo,
158
+ })
159
+ : undefined;
160
+ },
128
161
  get sources() {
129
- var _a, _b;
130
- if (this.preSources) {
131
- const rows = [];
132
- const sources = Object.fromEntries(((_a = self.sourcesVolatile) === null || _a === void 0 ? void 0 : _a.map(s => [s.name, s])) || []);
133
- for (const row of this.preSources) {
134
- if (self.renderingMode === 'phased') {
135
- const info = (_b = self.sampleInfo) === null || _b === void 0 ? void 0 : _b[row.name];
136
- if (info === null || info === void 0 ? void 0 : info.isPhased) {
137
- const ploidy = info.maxPloidy;
138
- for (let i = 0; i < ploidy; i++) {
139
- const id = `${row.name} HP${i}`;
140
- rows.push({
141
- ...sources[row.name],
142
- ...row,
143
- label: id,
144
- HP: i,
145
- id: id,
146
- });
147
- }
148
- }
149
- }
150
- else {
151
- rows.push({
152
- ...sources[row.name],
153
- ...row,
154
- label: row.name,
155
- id: row.name,
156
- });
157
- }
158
- }
159
- return rows;
160
- }
161
- return undefined;
162
+ const sourcesWithLayout = self.layout.length
163
+ ? self.layout
164
+ : self.sourcesVolatile;
165
+ return sourcesWithLayout
166
+ ? (0, getSources_1.getSources)({
167
+ sources: sourcesWithLayout,
168
+ renderingMode: self.renderingMode,
169
+ sampleInfo: self.sampleInfo,
170
+ })
171
+ : undefined;
162
172
  },
163
173
  }))
164
174
  .views(self => {
165
175
  const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
166
176
  return {
177
+ get sourceMap() {
178
+ return self.sources
179
+ ? Object.fromEntries(self.sources.map(source => [source.name, source]))
180
+ : undefined;
181
+ },
167
182
  get rowHeight() {
168
183
  const { sources, autoHeight, rowHeightSetting, height } = self;
169
184
  return autoHeight ? height / ((sources === null || sources === void 0 ? void 0 : sources.length) || 1) : rowHeightSetting;
@@ -241,6 +256,28 @@ function MultiVariantBaseModelF(configSchema) {
241
256
  },
242
257
  ],
243
258
  },
259
+ {
260
+ label: 'Reference mode',
261
+ type: 'subMenu',
262
+ subMenu: [
263
+ {
264
+ label: 'Fill background grey, skip reference allele mouseovers (helps with large overlapping SVs)',
265
+ type: 'radio',
266
+ checked: self.referenceDrawingMode === 'skip',
267
+ onClick: () => {
268
+ self.setReferenceDrawingMode('skip');
269
+ },
270
+ },
271
+ {
272
+ label: "Don't fill background grey, only draw actual reference alleles as grey",
273
+ type: 'radio',
274
+ checked: self.referenceDrawingMode === 'draw',
275
+ onClick: () => {
276
+ self.setReferenceDrawingMode('draw');
277
+ },
278
+ },
279
+ ],
280
+ },
244
281
  {
245
282
  label: 'Filter by',
246
283
  icon: FilterList_1.default,
@@ -257,10 +294,23 @@ function MultiVariantBaseModelF(configSchema) {
257
294
  ]);
258
295
  },
259
296
  },
297
+ {
298
+ label: 'Edit filters',
299
+ onClick: () => {
300
+ (0, util_1.getSession)(self).queueDialog(handleClose => [
301
+ AddFiltersDialog,
302
+ {
303
+ model: self,
304
+ handleClose,
305
+ },
306
+ ]);
307
+ },
308
+ },
260
309
  ],
261
310
  },
262
311
  {
263
312
  label: 'Cluster by genotype',
313
+ icon: Category_1.default,
264
314
  onClick: () => {
265
315
  (0, util_1.getSession)(self).queueDialog(handleClose => [
266
316
  ClusterDialog,
@@ -289,26 +339,34 @@ function MultiVariantBaseModelF(configSchema) {
289
339
  })
290
340
  .views(self => ({
291
341
  get canDisplayLabels() {
292
- return self.rowHeight > 8 && self.showSidebarLabelsSetting;
342
+ return self.rowHeight >= 8 && self.showSidebarLabelsSetting;
293
343
  },
294
344
  get totalHeight() {
295
345
  var _a;
296
346
  return self.rowHeight * (((_a = self.sources) === null || _a === void 0 ? void 0 : _a.length) || 1);
297
347
  },
348
+ get featuresReady() {
349
+ return !!self.featuresVolatile;
350
+ },
298
351
  }))
299
352
  .views(self => ({
300
353
  renderProps() {
301
354
  const superProps = self.adapterProps();
302
355
  return {
303
356
  ...superProps,
304
- notReady: superProps.notReady || !self.sources || !self.featuresVolatile,
357
+ notReady: superProps.notReady || !self.sources || !self.featuresReady,
305
358
  height: self.height,
306
359
  totalHeight: self.totalHeight,
307
360
  renderingMode: self.renderingMode,
308
361
  minorAlleleFrequencyFilter: self.minorAlleleFrequencyFilter,
362
+ lengthCutoffFilter: self.lengthCutoffFilter,
309
363
  rowHeight: self.rowHeight,
310
364
  sources: self.sources,
311
365
  scrollTop: self.scrollTop,
366
+ referenceDrawingMode: self.referenceDrawingMode,
367
+ filters: new serializableFilterChain_1.default({
368
+ filters: self.activeFilters,
369
+ }),
312
370
  };
313
371
  },
314
372
  }));
@@ -0,0 +1,9 @@
1
+ declare const AddFiltersDialog: ({ model, handleClose, }: {
2
+ model: {
3
+ jexlFilters?: string[];
4
+ activeFilters: string[];
5
+ setJexlFilters: (arg?: string[]) => void;
6
+ };
7
+ handleClose: () => void;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ export default AddFiltersDialog;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const ui_1 = require("@jbrowse/core/ui");
6
+ const jexlStrings_1 = require("@jbrowse/core/util/jexlStrings");
7
+ const material_1 = require("@mui/material");
8
+ const mobx_react_1 = require("mobx-react");
9
+ const mui_1 = require("tss-react/mui");
10
+ const useStyles = (0, mui_1.makeStyles)()({
11
+ dialogContent: {
12
+ width: '80em',
13
+ },
14
+ textAreaFont: {
15
+ fontFamily: 'Courier New',
16
+ },
17
+ error: {
18
+ color: 'red',
19
+ fontSize: '0.8em',
20
+ },
21
+ });
22
+ function checkJexl(code) {
23
+ (0, jexlStrings_1.stringToJexlExpression)(code);
24
+ }
25
+ const AddFiltersDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
26
+ const { classes } = useStyles();
27
+ const { activeFilters } = model;
28
+ const [data, setData] = (0, react_1.useState)(activeFilters.join('\n'));
29
+ const [error, setError] = (0, react_1.useState)();
30
+ (0, react_1.useEffect)(() => {
31
+ try {
32
+ data
33
+ .split('\n')
34
+ .map(line => line.trim())
35
+ .filter(line => !!line)
36
+ .map(line => {
37
+ checkJexl(line.trim());
38
+ });
39
+ setError(undefined);
40
+ }
41
+ catch (e) {
42
+ console.error(e);
43
+ setError(e);
44
+ }
45
+ }, [data]);
46
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters", children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsxs)("div", { children: ["Add filters, in jexl format, one per line, starting with the string jexl:. Examples:", ' ', (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("code", { children: "jexl:get(feature,'name')=='BRCA1'" }), " - show only feature where the name attribute is BRCA1"] }), (0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("code", { children: "jexl:get(feature,'type')=='gene'" }), " - show only gene type features in a GFF that has many other feature types"] }), (0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("code", { children: "jexl:get(feature,'score') > 400" }), " - show only features that have a score greater than 400"] }), (0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("code", { children: "jexl:get(feature,'end') - get(feature,'start') < 1000000" }), ' ', "- show only features with length less than 1Mbp"] })] })] }), error ? (0, jsx_runtime_1.jsx)("p", { className: classes.error, children: `${error}` }) : null, (0, jsx_runtime_1.jsx)(material_1.TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => {
47
+ setData(event.target.value);
48
+ }, slotProps: {
49
+ input: {
50
+ classes: {
51
+ input: classes.textAreaFont,
52
+ },
53
+ },
54
+ } })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !!error, onClick: () => {
55
+ model.setJexlFilters(data.split('\n'));
56
+ handleClose();
57
+ }, children: "Submit" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
58
+ handleClose();
59
+ }, children: "Cancel" })] })] }));
60
+ });
61
+ exports.default = AddFiltersDialog;
@@ -0,0 +1,5 @@
1
+ import type { MultiVariantBaseModel } from '../MultiVariantBaseModel';
2
+ declare const MultiVariantBaseDisplayComponent: (props: {
3
+ model: MultiVariantBaseModel;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default MultiVariantBaseDisplayComponent;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
9
+ const mobx_react_1 = require("mobx-react");
10
+ const MultiVariantCrosshairs_1 = __importDefault(require("./MultiVariantCrosshairs"));
11
+ const MultiVariantLegendBar_1 = __importDefault(require("./MultiVariantLegendBar"));
12
+ const MultiVariantBaseDisplayComponent = (0, mobx_react_1.observer)(function (props) {
13
+ const { model } = props;
14
+ const ref = (0, react_1.useRef)(null);
15
+ const [mouseY, setMouseY] = (0, react_1.useState)();
16
+ const [mouseX, setMouseX] = (0, react_1.useState)();
17
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, onMouseMove: event => {
18
+ var _a;
19
+ const rect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
20
+ const top = (rect === null || rect === void 0 ? void 0 : rect.top) || 0;
21
+ const left = (rect === null || rect === void 0 ? void 0 : rect.left) || 0;
22
+ setMouseY(event.clientY - top);
23
+ setMouseX(event.clientX - left);
24
+ }, onMouseLeave: () => {
25
+ setMouseY(undefined);
26
+ setMouseX(undefined);
27
+ }, children: [(0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.BaseLinearDisplayComponent, { ...props }), (0, jsx_runtime_1.jsx)(MultiVariantLegendBar_1.default, { model: model }), mouseX && mouseY ? ((0, jsx_runtime_1.jsx)(MultiVariantCrosshairs_1.default, { mouseX: mouseX, mouseY: mouseY, model: model })) : null] }));
28
+ });
29
+ exports.default = MultiVariantBaseDisplayComponent;
@@ -0,0 +1,6 @@
1
+ import type { ReducedModel } from './types';
2
+ declare const ClusterDialog: ({ model, handleClose, }: {
3
+ model: ReducedModel;
4
+ handleClose: () => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default ClusterDialog;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const ui_1 = require("@jbrowse/core/ui");
9
+ const material_1 = require("@mui/material");
10
+ const mobx_react_1 = require("mobx-react");
11
+ const ClusterDialogAuto_1 = __importDefault(require("./ClusterDialogAuto"));
12
+ const ClusterDialogManual_1 = __importDefault(require("./ClusterDialogManual"));
13
+ function Header({ activeMode, setActiveMode, }) {
14
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { style: { marginBottom: 30 }, children: "This procedure will cluster the visible genotype data using hierarchical clustering" }), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { children: Object.entries({
15
+ auto: ((0, jsx_runtime_1.jsx)("div", { children: "Run in-app clustering (slower, particularly for large numbers of samples, uses JS implementation of hclust)" })),
16
+ manual: ((0, jsx_runtime_1.jsx)("div", { children: "Download R script to run clustering (faster, uses R implementation of hclust)" })),
17
+ }).map(([key, val]) => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Radio, { checked: activeMode === key, onChange: () => {
18
+ setActiveMode(key);
19
+ } }), label: val }, key))) })] }));
20
+ }
21
+ const ClusterDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
22
+ const [activeMode, setActiveMode] = (0, react_1.useState)('auto');
23
+ return ((0, jsx_runtime_1.jsx)(ui_1.Dialog, { open: true, title: "Cluster by genotype", onClose: (_, reason) => {
24
+ if (reason !== 'backdropClick') {
25
+ handleClose();
26
+ }
27
+ }, children: activeMode === 'auto' ? ((0, jsx_runtime_1.jsx)(ClusterDialogAuto_1.default, { model: model, handleClose: handleClose, children: (0, jsx_runtime_1.jsx)(Header, { activeMode: activeMode, setActiveMode: setActiveMode }) })) : ((0, jsx_runtime_1.jsx)(ClusterDialogManual_1.default, { model: model, handleClose: handleClose, children: (0, jsx_runtime_1.jsx)(Header, { activeMode: activeMode, setActiveMode: setActiveMode }) })) }));
28
+ });
29
+ exports.default = ClusterDialog;
@@ -0,0 +1,7 @@
1
+ import type { ReducedModel } from './types';
2
+ declare const ClusterDialogAuto: ({ model, children, handleClose, }: {
3
+ model: ReducedModel;
4
+ children: React.ReactNode;
5
+ handleClose: () => void;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default ClusterDialogAuto;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const ui_1 = require("@jbrowse/core/ui");
6
+ const util_1 = require("@jbrowse/core/util");
7
+ const stopToken_1 = require("@jbrowse/core/util/stopToken");
8
+ const tracks_1 = require("@jbrowse/core/util/tracks");
9
+ const material_1 = require("@mui/material");
10
+ const mobx_react_1 = require("mobx-react");
11
+ const mobx_state_tree_1 = require("mobx-state-tree");
12
+ const ClusterDialogAuto = (0, mobx_react_1.observer)(function ({ model, children, handleClose, }) {
13
+ const [progress, setProgress] = (0, react_1.useState)('');
14
+ const [loading, setLoading] = (0, react_1.useState)(false);
15
+ const [error, setError] = (0, react_1.useState)();
16
+ const [stopToken, setStopToken] = (0, react_1.useState)('');
17
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [children, (0, jsx_runtime_1.jsxs)("div", { children: [loading ? ((0, jsx_runtime_1.jsxs)("div", { style: { padding: 50 }, children: [(0, jsx_runtime_1.jsx)("span", { children: progress || 'Loading...' }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => {
18
+ (0, stopToken_1.stopStopToken)(stopToken);
19
+ }, children: "Stop" })] })) : null, error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null] })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", disabled: loading, onClick: async () => {
20
+ try {
21
+ setError(undefined);
22
+ setProgress('Initializing');
23
+ setLoading(true);
24
+ const view = (0, util_1.getContainingView)(model);
25
+ if (!view.initialized) {
26
+ return;
27
+ }
28
+ const { rpcManager } = (0, util_1.getSession)(model);
29
+ const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
30
+ if (sourcesWithoutLayout) {
31
+ const sessionId = (0, tracks_1.getRpcSessionId)(model);
32
+ const stopToken = (0, stopToken_1.createStopToken)();
33
+ setStopToken(stopToken);
34
+ const ret = (await rpcManager.call(sessionId, 'MultiVariantClusterGenotypeMatrix', {
35
+ regions: view.dynamicBlocks.contentBlocks,
36
+ sources: sourcesWithoutLayout,
37
+ minorAlleleFrequencyFilter,
38
+ lengthCutoffFilter,
39
+ sessionId,
40
+ adapterConfig,
41
+ stopToken,
42
+ statusCallback: (arg) => {
43
+ setProgress(arg);
44
+ },
45
+ }));
46
+ model.setLayout(ret.order.map(idx => {
47
+ const ret = sourcesWithoutLayout[idx];
48
+ if (!ret) {
49
+ throw new Error(`out of bounds at ${idx}`);
50
+ }
51
+ return ret;
52
+ }));
53
+ }
54
+ handleClose();
55
+ }
56
+ catch (e) {
57
+ if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(model)) {
58
+ console.error(e);
59
+ setError(e);
60
+ }
61
+ }
62
+ finally {
63
+ setLoading(false);
64
+ setProgress('');
65
+ setStopToken('');
66
+ }
67
+ }, children: "Run clustering" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
68
+ handleClose();
69
+ if (stopToken) {
70
+ (0, stopToken_1.stopStopToken)(stopToken);
71
+ }
72
+ }, children: "Cancel" })] })] }));
73
+ });
74
+ exports.default = ClusterDialogAuto;
@@ -0,0 +1,7 @@
1
+ import type { ReducedModel } from './types';
2
+ declare const ClusterDialogManuals: ({ model, handleClose, children, }: {
3
+ model: ReducedModel;
4
+ handleClose: () => void;
5
+ children: React.ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default ClusterDialogManuals;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const ui_1 = require("@jbrowse/core/ui");
9
+ const util_1 = require("@jbrowse/core/util");
10
+ const tracks_1 = require("@jbrowse/core/util/tracks");
11
+ const material_1 = require("@mui/material");
12
+ const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
13
+ const file_saver_1 = require("file-saver");
14
+ const mobx_react_1 = require("mobx-react");
15
+ const mobx_state_tree_1 = require("mobx-state-tree");
16
+ const mui_1 = require("tss-react/mui");
17
+ const useStyles = (0, mui_1.makeStyles)()(theme => ({
18
+ textAreaFont: {
19
+ fontFamily: 'Courier New',
20
+ },
21
+ mgap: {
22
+ display: 'flex',
23
+ flexDirection: 'column',
24
+ gap: theme.spacing(4),
25
+ },
26
+ }));
27
+ const ClusterDialogManuals = (0, mobx_react_1.observer)(function ({ model, handleClose, children, }) {
28
+ const { classes } = useStyles();
29
+ const [paste, setPaste] = (0, react_1.useState)('');
30
+ const [ret, setRet] = (0, react_1.useState)();
31
+ const [error, setError] = (0, react_1.useState)();
32
+ const [loading, setLoading] = (0, react_1.useState)(false);
33
+ const [showAdvanced, setShowAdvanced] = (0, util_1.useLocalStorage)('cluster-showAdvanced', false);
34
+ const [clusterMethod, setClusterMethod] = (0, react_1.useState)('single');
35
+ (0, react_1.useEffect)(() => {
36
+ ;
37
+ (async () => {
38
+ try {
39
+ setError(undefined);
40
+ setRet(undefined);
41
+ setLoading(true);
42
+ const view = (0, util_1.getContainingView)(model);
43
+ if (!view.initialized) {
44
+ return;
45
+ }
46
+ const { rpcManager } = (0, util_1.getSession)(model);
47
+ const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
48
+ const sessionId = (0, tracks_1.getRpcSessionId)(model);
49
+ const ret = (await rpcManager.call(sessionId, 'MultiVariantGetGenotypeMatrix', {
50
+ regions: view.dynamicBlocks.contentBlocks,
51
+ sources: sourcesWithoutLayout,
52
+ minorAlleleFrequencyFilter,
53
+ lengthCutoffFilter,
54
+ sessionId,
55
+ adapterConfig,
56
+ }));
57
+ setRet(ret);
58
+ }
59
+ catch (e) {
60
+ if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(model)) {
61
+ console.error(e);
62
+ setError(e);
63
+ }
64
+ }
65
+ finally {
66
+ setLoading(false);
67
+ }
68
+ })();
69
+ }, [model]);
70
+ const results = ret
71
+ ? `inputMatrix<-matrix(c(${Object.values(ret)
72
+ .map(val => val.join(','))
73
+ .join(',\n')}
74
+ ),nrow=${Object.values(ret).length},byrow=TRUE)
75
+ rownames(inputMatrix)<-c(${Object.keys(ret)
76
+ .map(key => `'${key}'`)
77
+ .join(',')})
78
+ resultClusters<-hclust(dist(inputMatrix), method='${clusterMethod}')
79
+ cat(resultClusters$order,sep='\\n')`
80
+ : undefined;
81
+ const resultsTsv = ret
82
+ ? Object.entries(ret)
83
+ .map(([key, val]) => [key, ...val].join('\t'))
84
+ .join('\n')
85
+ : undefined;
86
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [children, (0, jsx_runtime_1.jsxs)(material_1.Paper, { style: { padding: 16 }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
87
+ display: 'flex',
88
+ gap: '8px',
89
+ flexWrap: 'wrap',
90
+ marginBottom: '16px',
91
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
92
+ (0, file_saver_1.saveAs)(new Blob([results || ''], {
93
+ type: 'text/plain;charset=utf-8',
94
+ }), 'cluster.R');
95
+ }, children: "Download Rscript" }), ' ', "or", ' ', (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
96
+ (0, copy_to_clipboard_1.default)(results || '');
97
+ }, children: "Copy Rscript to clipboard" }), ' ', "or", ' ', (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
98
+ (0, file_saver_1.saveAs)(new Blob([resultsTsv || ''], {
99
+ type: 'text/plain;charset=utf-8',
100
+ }), 'genotypes.tsv');
101
+ }, children: "Download TSV" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
102
+ setShowAdvanced(!showAdvanced);
103
+ }, children: showAdvanced
104
+ ? 'Hide advanced options'
105
+ : 'Show advanced options' }) })] }), showAdvanced ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: "Advanced options" }), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { children: Object.entries({
106
+ single: 'Single',
107
+ complete: 'Complete',
108
+ }).map(([key, val]) => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Radio, { checked: clusterMethod === key, onChange: () => {
109
+ setClusterMethod(key);
110
+ } }), label: val }, key))) })] })) : null, results ? ((0, jsx_runtime_1.jsx)("div", {})) : loading ? ((0, jsx_runtime_1.jsx)(ui_1.LoadingEllipses, { variant: "h6", title: "Generating genotype matrix" })) : error ? ((0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error })) : null] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true, variant: "outlined", placeholder: "Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)", rows: 10, value: paste, onChange: event => {
111
+ setPaste(event.target.value);
112
+ }, slotProps: {
113
+ input: {
114
+ classes: {
115
+ input: classes.textAreaFont,
116
+ },
117
+ },
118
+ } })] })] })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
119
+ const { sourcesWithoutLayout } = model;
120
+ if (sourcesWithoutLayout) {
121
+ try {
122
+ model.setLayout(paste
123
+ .split('\n')
124
+ .map(t => t.trim())
125
+ .filter(f => !!f)
126
+ .map(r => +r)
127
+ .map(idx => {
128
+ const ret = sourcesWithoutLayout[idx - 1];
129
+ if (!ret) {
130
+ throw new Error(`out of bounds at ${idx}`);
131
+ }
132
+ return ret;
133
+ }));
134
+ }
135
+ catch (e) {
136
+ console.error(e);
137
+ (0, util_1.getSession)(model).notifyError(`${e}`, e);
138
+ }
139
+ }
140
+ handleClose();
141
+ }, children: "Apply clustering" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
142
+ handleClose();
143
+ }, children: "Cancel" })] })] }));
144
+ });
145
+ exports.default = ClusterDialogManuals;
@@ -0,0 +1,10 @@
1
+ import type { Source } from '../../types';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ export interface ReducedModel {
4
+ sourcesWithoutLayout?: Source[];
5
+ minorAlleleFrequencyFilter?: number;
6
+ lengthCutoffFilter: number;
7
+ adapterConfig: AnyConfigurationModel;
8
+ setLayout: (arg: Source[]) => void;
9
+ clearLayout: () => void;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });