@jbrowse/plugin-variants 2.4.2 → 2.5.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 (57) hide show
  1. package/dist/ChordVariantDisplay/models/configSchema.d.ts +13 -1
  2. package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +9 -1
  3. package/dist/LinearVariantDisplay/configSchema.d.ts +25 -1
  4. package/dist/LinearVariantDisplay/model.d.ts +40 -11
  5. package/dist/StructuralVariantChordRenderer/Chord.d.ts +0 -1
  6. package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +0 -1
  7. package/dist/StructuralVariantChordRenderer/configSchema.d.ts +29 -1
  8. package/dist/VariantFeatureWidget/AnnotGrid.d.ts +3 -3
  9. package/dist/VariantFeatureWidget/AnnotGrid.js +38 -13
  10. package/dist/VariantFeatureWidget/AnnotGrid.js.map +1 -1
  11. package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -4
  12. package/dist/VariantFeatureWidget/BreakendOptionDialog.js +4 -5
  13. package/dist/VariantFeatureWidget/BreakendOptionDialog.js.map +1 -1
  14. package/dist/VariantFeatureWidget/BreakendPanel.d.ts +0 -1
  15. package/dist/VariantFeatureWidget/VariantAnnPanel.d.ts +0 -1
  16. package/dist/VariantFeatureWidget/VariantCsqPanel.d.ts +0 -1
  17. package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +0 -1
  18. package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +0 -1
  19. package/dist/VariantFeatureWidget/VariantSampleGrid.js +12 -11
  20. package/dist/VariantFeatureWidget/VariantSampleGrid.js.map +1 -1
  21. package/dist/VariantFeatureWidget/index.d.ts +4 -1
  22. package/dist/VariantTrack/configSchema.d.ts +73 -1
  23. package/dist/VcfAdapter/VcfAdapter.js +1 -1
  24. package/dist/VcfAdapter/VcfAdapter.js.map +1 -1
  25. package/dist/VcfAdapter/configSchema.d.ts +12 -1
  26. package/dist/VcfTabixAdapter/configSchema.d.ts +32 -1
  27. package/esm/ChordVariantDisplay/models/configSchema.d.ts +13 -1
  28. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +9 -1
  29. package/esm/LinearVariantDisplay/configSchema.d.ts +25 -1
  30. package/esm/LinearVariantDisplay/model.d.ts +40 -11
  31. package/esm/StructuralVariantChordRenderer/Chord.d.ts +0 -1
  32. package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +0 -1
  33. package/esm/StructuralVariantChordRenderer/configSchema.d.ts +29 -1
  34. package/esm/VariantFeatureWidget/AnnotGrid.d.ts +3 -3
  35. package/esm/VariantFeatureWidget/AnnotGrid.js +17 -12
  36. package/esm/VariantFeatureWidget/AnnotGrid.js.map +1 -1
  37. package/esm/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -4
  38. package/esm/VariantFeatureWidget/BreakendOptionDialog.js +4 -5
  39. package/esm/VariantFeatureWidget/BreakendOptionDialog.js.map +1 -1
  40. package/esm/VariantFeatureWidget/BreakendPanel.d.ts +0 -1
  41. package/esm/VariantFeatureWidget/VariantAnnPanel.d.ts +0 -1
  42. package/esm/VariantFeatureWidget/VariantCsqPanel.d.ts +0 -1
  43. package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +0 -1
  44. package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +0 -1
  45. package/esm/VariantFeatureWidget/VariantSampleGrid.js +13 -12
  46. package/esm/VariantFeatureWidget/VariantSampleGrid.js.map +1 -1
  47. package/esm/VariantFeatureWidget/index.d.ts +4 -1
  48. package/esm/VariantTrack/configSchema.d.ts +73 -1
  49. package/esm/VcfAdapter/VcfAdapter.js +2 -1
  50. package/esm/VcfAdapter/VcfAdapter.js.map +1 -1
  51. package/esm/VcfAdapter/configSchema.d.ts +12 -1
  52. package/esm/VcfTabixAdapter/configSchema.d.ts +32 -1
  53. package/package.json +3 -3
  54. package/src/VariantFeatureWidget/AnnotGrid.tsx +41 -17
  55. package/src/VariantFeatureWidget/BreakendOptionDialog.tsx +4 -5
  56. package/src/VariantFeatureWidget/VariantSampleGrid.tsx +51 -46
  57. package/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap +1 -2
@@ -1,2 +1,13 @@
1
- declare const VcfAdapter: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
1
+ declare const VcfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ /**
3
+ * #slot
4
+ */
5
+ vcfLocation: {
6
+ type: string;
7
+ defaultValue: {
8
+ uri: string;
9
+ locationType: string;
10
+ };
11
+ };
12
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
13
  export default VcfAdapter;
@@ -1,2 +1,33 @@
1
- declare const VcfTabixAdapter: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
1
+ declare const VcfTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ /**
3
+ * #slot
4
+ */
5
+ vcfGzLocation: {
6
+ type: string;
7
+ defaultValue: {
8
+ uri: string;
9
+ locationType: string;
10
+ };
11
+ };
12
+ index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
13
+ /**
14
+ * #slot index.indexType
15
+ */
16
+ indexType: {
17
+ model: import("mobx-state-tree").ISimpleType<string>;
18
+ type: string;
19
+ defaultValue: string;
20
+ };
21
+ /**
22
+ * #slot index.location
23
+ */
24
+ location: {
25
+ type: string;
26
+ defaultValue: {
27
+ uri: string;
28
+ locationType: string;
29
+ };
30
+ };
31
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
33
  export default VcfTabixAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -42,7 +42,7 @@
42
42
  "@gmod/tabix": "^1.5.6",
43
43
  "@gmod/vcf": "^5.0.9",
44
44
  "@mui/icons-material": "^5.0.2",
45
- "@mui/x-data-grid": "^5.0.1",
45
+ "@mui/x-data-grid": "^6.0.1",
46
46
  "generic-filehandle": "^3.0.0"
47
47
  },
48
48
  "peerDependencies": {
@@ -64,5 +64,5 @@
64
64
  "distModule": "esm/index.js",
65
65
  "srcModule": "src/index.ts",
66
66
  "module": "esm/index.js",
67
- "gitHead": "36e382a70e7d220343b873e7e6aba5c83e5342c8"
67
+ "gitHead": "d1ca073996d008f0fe9a52f7c1a47ae649dcfdaf"
68
68
  }
@@ -1,28 +1,52 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import React from 'react'
3
- import { DataGrid } from '@mui/x-data-grid'
1
+ import React, { useState } from 'react'
2
+ import {
3
+ DataGrid,
4
+ GridColDef,
5
+ GridToolbar,
6
+ GridValidRowModel,
7
+ } from '@mui/x-data-grid'
8
+ import { Checkbox, FormControlLabel, Typography } from '@mui/material'
4
9
 
5
10
  export default function VariantAnnotPanel({
6
11
  rows,
7
12
  columns,
8
13
  }: {
9
- rows: any
10
- columns: any[]
14
+ rows: GridValidRowModel[]
15
+ columns: GridColDef[]
11
16
  }) {
12
17
  const rowHeight = 25
13
- const hideFooter = rows.length < 100
14
- const headerHeight = 80
18
+ const headerHeight = 100
19
+ const footerHeight = 50
20
+ const [checked, setChecked] = useState(false)
21
+ const height =
22
+ Math.min(rows.length, 100) * rowHeight +
23
+ headerHeight +
24
+ (checked ? 50 : 0) +
25
+ footerHeight
15
26
  return rows.length ? (
16
- <div
17
- style={{
18
- height:
19
- Math.min(rows.length, 100) * rowHeight +
20
- headerHeight +
21
- (hideFooter ? 0 : 50),
22
- width: '100%',
23
- }}
24
- >
25
- <DataGrid rowHeight={rowHeight} rows={rows} columns={columns} />
27
+ <div>
28
+ <FormControlLabel
29
+ control={
30
+ <Checkbox
31
+ checked={checked}
32
+ onChange={event => setChecked(event.target.checked)}
33
+ />
34
+ }
35
+ label={<Typography variant="body2">Show options</Typography>}
36
+ />
37
+ <div
38
+ style={{
39
+ height,
40
+ width: '100%',
41
+ }}
42
+ >
43
+ <DataGrid
44
+ rowHeight={rowHeight}
45
+ rows={rows}
46
+ columns={columns}
47
+ slots={{ toolbar: checked ? GridToolbar : null }}
48
+ />
49
+ </div>
26
50
  </div>
27
51
  ) : null
28
52
  }
@@ -20,7 +20,7 @@ const useStyles = makeStyles()({
20
20
  },
21
21
  })
22
22
 
23
- function BreakendOptionDialog({
23
+ export default observer(function BreakendOptionDialog({
24
24
  model,
25
25
  handleClose,
26
26
  feature,
@@ -43,7 +43,7 @@ function BreakendOptionDialog({
43
43
  control={
44
44
  <Checkbox
45
45
  checked={copyTracks}
46
- onChange={() => setCopyTracks(val => !val)}
46
+ onChange={event => setCopyTracks(event.target.checked)}
47
47
  />
48
48
  }
49
49
  label="Copy tracks into the new view"
@@ -54,7 +54,7 @@ function BreakendOptionDialog({
54
54
  control={
55
55
  <Checkbox
56
56
  checked={mirrorTracks}
57
- onChange={() => setMirrorTracks(val => !val)}
57
+ onChange={event => setMirrorTracks(event.target.checked)}
58
58
  />
59
59
  }
60
60
  label="Mirror tracks vertically in vertically stacked view"
@@ -114,5 +114,4 @@ function BreakendOptionDialog({
114
114
  </DialogActions>
115
115
  </Dialog>
116
116
  )
117
- }
118
- export default observer(BreakendOptionDialog)
117
+ })
@@ -7,7 +7,7 @@ import {
7
7
  Typography,
8
8
  } from '@mui/material'
9
9
 
10
- import { DataGrid } from '@mui/x-data-grid'
10
+ import { DataGrid, GridToolbar } from '@mui/x-data-grid'
11
11
  import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
12
12
  import { measureGridWidth, SimpleFeatureSerialized } from '@jbrowse/core/util'
13
13
  import ResizeBar, { useResizeBar } from '@jbrowse/core/ui/ResizeBar'
@@ -30,38 +30,24 @@ function SampleFilters({
30
30
  filter: Filters
31
31
  setFilter: (arg: Filters) => void
32
32
  }) {
33
- const [showFilters, setShowFilters] = useState(false)
34
33
  return (
35
34
  <>
36
- <FormControlLabel
37
- control={
38
- <Checkbox
39
- checked={showFilters}
40
- onChange={() => setShowFilters(f => !f)}
41
- />
42
- }
43
- label="Show sample filters"
44
- />
45
- {showFilters ? (
46
- <>
47
- <Typography>
48
- These filters can use a plain text search or regex style query, e.g.
49
- in the genotype field, entering 1 will query for all genotypes that
50
- include the first alternate allele e.g. 0|1 or 1|1, entering
51
- [1-9]\d* will find any non-zero allele e.g. 0|2 or 2/33
52
- </Typography>
53
- {columns.map(({ field }) => (
54
- <TextField
55
- key={`filter-${field}`}
56
- placeholder={`Filter ${field}`}
57
- value={filter[field] || ''}
58
- onChange={event =>
59
- setFilter({ ...filter, [field]: event.target.value })
60
- }
61
- />
62
- ))}
63
- </>
64
- ) : null}
35
+ <Typography>
36
+ These filters can use a plain text search or regex style query, e.g. in
37
+ the genotype field, entering 1 will query for all genotypes that include
38
+ the first alternate allele e.g. 0|1 or 1|1, entering [1-9]\d* will find
39
+ any non-zero allele e.g. 0|2 or 2/33
40
+ </Typography>
41
+ {columns.map(({ field }) => (
42
+ <TextField
43
+ key={`filter-${field}`}
44
+ placeholder={`Filter ${field}`}
45
+ value={filter[field] || ''}
46
+ onChange={event =>
47
+ setFilter({ ...filter, [field]: event.target.value })
48
+ }
49
+ />
50
+ ))}
65
51
  </>
66
52
  )
67
53
  }
@@ -98,9 +84,10 @@ export default function VariantSamples(props: {
98
84
  .filter(row =>
99
85
  filters.length
100
86
  ? filters.every(key => {
101
- const val = row[key]
102
87
  const currFilter = filter[key]
103
- return currFilter ? val.match(new RegExp(currFilter, 'i')) : true
88
+ return currFilter
89
+ ? row[key].match(new RegExp(currFilter, 'i'))
90
+ : true
104
91
  })
105
92
  : true,
106
93
  )
@@ -109,7 +96,7 @@ export default function VariantSamples(props: {
109
96
  }
110
97
 
111
98
  const keys = ['sample', ...Object.keys(preFilteredRows[0]?.[1] || {})]
112
-
99
+ const [checked, setChecked] = useState(false)
113
100
  const [widths, setWidths] = useState(
114
101
  keys.map(e => measureGridWidth(rows.map(r => r[e]))),
115
102
  )
@@ -119,28 +106,46 @@ export default function VariantSamples(props: {
119
106
  width: widths[index],
120
107
  }))
121
108
 
122
- // disableSelectionOnClick helps avoid
109
+ // disableRowSelectionOnClick helps avoid
123
110
  // https://github.com/mui-org/material-ui-x/issues/1197
124
111
  return !preFilteredRows.length ? null : (
125
112
  <BaseCard {...props} title="Samples">
126
113
  {error ? <Typography color="error">{`${error}`}</Typography> : null}
127
- <SampleFilters setFilter={setFilter} columns={columns} filter={filter} />
114
+ <FormControlLabel
115
+ control={
116
+ <Checkbox
117
+ checked={checked}
118
+ onChange={event => setChecked(event.target.checked)}
119
+ />
120
+ }
121
+ label={<Typography variant="body2">Show options</Typography>}
122
+ />
123
+ {checked ? (
124
+ <SampleFilters
125
+ setFilter={setFilter}
126
+ columns={columns}
127
+ filter={filter}
128
+ />
129
+ ) : null}
128
130
  <div ref={ref}>
129
131
  <ResizeBar
130
132
  widths={widths}
131
133
  setWidths={setWidths}
132
134
  scrollLeft={scrollLeft}
133
135
  />
134
- <div ref={ref} style={{ height: 600, width: '100%', overflow: 'auto' }}>
135
- <DataGrid
136
- rows={rows}
137
- columns={columns}
138
- disableSelectionOnClick
139
- rowHeight={25}
140
- headerHeight={35}
141
- disableColumnMenu
142
- />
143
- </div>
136
+ <DataGrid
137
+ rows={rows}
138
+ hideFooter={rows.length < 100}
139
+ columns={columns}
140
+ disableRowSelectionOnClick
141
+ rowHeight={25}
142
+ columnHeaderHeight={35}
143
+ disableColumnMenu
144
+ slots={{ toolbar: checked ? GridToolbar : null }}
145
+ slotProps={{
146
+ toolbar: { printOptions: { disableToolbarButton: true } },
147
+ }}
148
+ />
144
149
  </div>
145
150
  </BaseCard>
146
151
  )
@@ -188,7 +188,7 @@ exports[`renders with just the required model elements 1`] = `
188
188
  </div>
189
189
  </div>
190
190
  <div
191
- class="css-1upvn7b-container2"
191
+ class="css-1lttu3w-container"
192
192
  >
193
193
  <button
194
194
  class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-sghohy-MuiButtonBase-root-MuiButton-root"
@@ -224,7 +224,6 @@ exports[`renders with just the required model elements 1`] = `
224
224
  />
225
225
  </button>
226
226
  </div>
227
- <br />
228
227
  </div>
229
228
  </div>
230
229
  </div>