@jbrowse/plugin-alignments 2.3.4 → 2.4.1

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 (133) hide show
  1. package/dist/BamAdapter/BamAdapter.js +2 -2
  2. package/dist/BamAdapter/BamAdapter.js.map +1 -1
  3. package/dist/BamAdapter/BamSlightlyLazyFeature.js +2 -2
  4. package/dist/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
  5. package/dist/CramAdapter/CramAdapter.js +2 -2
  6. package/dist/CramAdapter/CramAdapter.js.map +1 -1
  7. package/dist/CramAdapter/CramSlightlyLazyFeature.js +2 -2
  8. package/dist/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
  9. package/dist/CramAdapter/util.js +10 -10
  10. package/dist/CramAdapter/util.js.map +1 -1
  11. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
  12. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  13. package/dist/LinearAlignmentsDisplay/models/configSchema.js +7 -0
  14. package/dist/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
  15. package/dist/LinearAlignmentsDisplay/models/model.d.ts +21 -5
  16. package/dist/LinearAlignmentsDisplay/models/model.js +22 -6
  17. package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
  18. package/dist/LinearPileupDisplay/index.d.ts +2 -3
  19. package/dist/LinearPileupDisplay/index.js +4 -2
  20. package/dist/LinearPileupDisplay/index.js.map +1 -1
  21. package/dist/LinearPileupDisplay/model.d.ts +70 -9
  22. package/dist/LinearPileupDisplay/model.js +4 -4
  23. package/dist/LinearPileupDisplay/model.js.map +1 -1
  24. package/dist/LinearReadArcsDisplay/components/ReactComponent.js +14 -11
  25. package/dist/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -1
  26. package/dist/LinearReadArcsDisplay/model.d.ts +77 -28
  27. package/dist/LinearReadArcsDisplay/model.js +16 -4
  28. package/dist/LinearReadArcsDisplay/model.js.map +1 -1
  29. package/dist/LinearReadCloudDisplay/model.d.ts +71 -19
  30. package/dist/LinearReadCloudDisplay/model.js +15 -3
  31. package/dist/LinearReadCloudDisplay/model.js.map +1 -1
  32. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +8 -13
  33. package/dist/MismatchParser/index.js +4 -6
  34. package/dist/MismatchParser/index.js.map +1 -1
  35. package/dist/NestedFrequencyTable.js +3 -13
  36. package/dist/NestedFrequencyTable.js.map +1 -1
  37. package/dist/PileupRPC/rpcMethods.d.ts +3 -4
  38. package/dist/PileupRPC/rpcMethods.js +6 -6
  39. package/dist/PileupRPC/rpcMethods.js.map +1 -1
  40. package/dist/PileupRenderer/PileupRenderer.d.ts +6 -4
  41. package/dist/PileupRenderer/PileupRenderer.js +32 -38
  42. package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
  43. package/dist/PileupRenderer/components/PileupRendering.js +2 -2
  44. package/dist/PileupRenderer/components/PileupRendering.js.map +1 -1
  45. package/dist/PileupRenderer/configSchema.js +1 -1
  46. package/dist/PileupRenderer/configSchema.js.map +1 -1
  47. package/dist/PileupRenderer/sortUtil.js +5 -4
  48. package/dist/PileupRenderer/sortUtil.js.map +1 -1
  49. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +10 -7
  50. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
  51. package/dist/index.d.ts +3 -5
  52. package/dist/index.js +6 -6
  53. package/dist/index.js.map +1 -1
  54. package/esm/BamAdapter/BamAdapter.js +2 -2
  55. package/esm/BamAdapter/BamAdapter.js.map +1 -1
  56. package/esm/BamAdapter/BamSlightlyLazyFeature.js +2 -2
  57. package/esm/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
  58. package/esm/CramAdapter/CramAdapter.js +2 -2
  59. package/esm/CramAdapter/CramAdapter.js.map +1 -1
  60. package/esm/CramAdapter/CramSlightlyLazyFeature.js +2 -2
  61. package/esm/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
  62. package/esm/CramAdapter/util.js +10 -10
  63. package/esm/CramAdapter/util.js.map +1 -1
  64. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
  65. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  66. package/esm/LinearAlignmentsDisplay/models/configSchema.js +7 -0
  67. package/esm/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
  68. package/esm/LinearAlignmentsDisplay/models/model.d.ts +21 -5
  69. package/esm/LinearAlignmentsDisplay/models/model.js +22 -6
  70. package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
  71. package/esm/LinearPileupDisplay/index.d.ts +2 -3
  72. package/esm/LinearPileupDisplay/index.js +2 -1
  73. package/esm/LinearPileupDisplay/index.js.map +1 -1
  74. package/esm/LinearPileupDisplay/model.d.ts +70 -9
  75. package/esm/LinearPileupDisplay/model.js +4 -4
  76. package/esm/LinearPileupDisplay/model.js.map +1 -1
  77. package/esm/LinearReadArcsDisplay/components/ReactComponent.js +14 -11
  78. package/esm/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -1
  79. package/esm/LinearReadArcsDisplay/model.d.ts +77 -28
  80. package/esm/LinearReadArcsDisplay/model.js +16 -4
  81. package/esm/LinearReadArcsDisplay/model.js.map +1 -1
  82. package/esm/LinearReadCloudDisplay/model.d.ts +71 -19
  83. package/esm/LinearReadCloudDisplay/model.js +15 -3
  84. package/esm/LinearReadCloudDisplay/model.js.map +1 -1
  85. package/esm/LinearSNPCoverageDisplay/models/model.d.ts +8 -13
  86. package/esm/MismatchParser/index.js +4 -6
  87. package/esm/MismatchParser/index.js.map +1 -1
  88. package/esm/NestedFrequencyTable.js +3 -13
  89. package/esm/NestedFrequencyTable.js.map +1 -1
  90. package/esm/PileupRPC/rpcMethods.d.ts +3 -4
  91. package/esm/PileupRPC/rpcMethods.js +3 -4
  92. package/esm/PileupRPC/rpcMethods.js.map +1 -1
  93. package/esm/PileupRenderer/PileupRenderer.d.ts +6 -4
  94. package/esm/PileupRenderer/PileupRenderer.js +32 -38
  95. package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
  96. package/esm/PileupRenderer/components/PileupRendering.js +2 -2
  97. package/esm/PileupRenderer/components/PileupRendering.js.map +1 -1
  98. package/esm/PileupRenderer/configSchema.js +1 -1
  99. package/esm/PileupRenderer/configSchema.js.map +1 -1
  100. package/esm/PileupRenderer/sortUtil.js +5 -4
  101. package/esm/PileupRenderer/sortUtil.js.map +1 -1
  102. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +10 -7
  103. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
  104. package/esm/index.d.ts +3 -5
  105. package/esm/index.js +3 -3
  106. package/esm/index.js.map +1 -1
  107. package/package.json +2 -2
  108. package/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap +13 -13
  109. package/src/AlignmentsFeatureDetail/index.test.tsx +1 -1
  110. package/src/BamAdapter/BamAdapter.ts +2 -2
  111. package/src/BamAdapter/BamSlightlyLazyFeature.ts +2 -2
  112. package/src/CramAdapter/CramAdapter.ts +2 -2
  113. package/src/CramAdapter/CramSlightlyLazyFeature.ts +2 -2
  114. package/src/CramAdapter/util.ts +10 -10
  115. package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +2 -2
  116. package/src/LinearAlignmentsDisplay/models/configSchema.test.ts +1 -1
  117. package/src/LinearAlignmentsDisplay/models/configSchema.ts +8 -0
  118. package/src/LinearAlignmentsDisplay/models/model.tsx +21 -6
  119. package/src/LinearPileupDisplay/index.ts +2 -4
  120. package/src/LinearPileupDisplay/model.ts +4 -4
  121. package/src/LinearReadArcsDisplay/components/ReactComponent.tsx +14 -12
  122. package/src/LinearReadArcsDisplay/model.tsx +23 -5
  123. package/src/LinearReadCloudDisplay/model.tsx +23 -7
  124. package/src/LinearSNPCoverageDisplay/models/configSchema.test.ts +1 -1
  125. package/src/MismatchParser/index.ts +6 -8
  126. package/src/NestedFrequencyTable.ts +3 -11
  127. package/src/PileupRPC/rpcMethods.ts +3 -9
  128. package/src/PileupRenderer/PileupRenderer.ts +49 -65
  129. package/src/PileupRenderer/components/PileupRendering.tsx +2 -2
  130. package/src/PileupRenderer/configSchema.ts +1 -1
  131. package/src/PileupRenderer/sortUtil.ts +5 -4
  132. package/src/SNPCoverageRenderer/SNPCoverageRenderer.ts +14 -13
  133. package/src/index.ts +5 -10
@@ -29,7 +29,7 @@ exports[`open up a widget 1`] = `
29
29
  >
30
30
  <svg
31
31
  aria-hidden="true"
32
- class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-125qixp-MuiSvgIcon-root-expandIcon"
32
+ class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-ymsoo8-MuiSvgIcon-root-expandIcon"
33
33
  data-testid="ExpandMoreIcon"
34
34
  focusable="false"
35
35
  viewBox="0 0 24 24"
@@ -66,7 +66,7 @@ exports[`open up a widget 1`] = `
66
66
  class="css-1m8nxnb-field"
67
67
  >
68
68
  <div
69
- class="css-1y9c7n2-fieldName"
69
+ class="css-1q83rf3-fieldName"
70
70
  >
71
71
  Position
72
72
  </div>
@@ -80,7 +80,7 @@ exports[`open up a widget 1`] = `
80
80
  class="css-1m8nxnb-field"
81
81
  >
82
82
  <div
83
- class="css-1y9c7n2-fieldName"
83
+ class="css-1q83rf3-fieldName"
84
84
  >
85
85
  Name
86
86
  </div>
@@ -96,7 +96,7 @@ exports[`open up a widget 1`] = `
96
96
  class="css-1m8nxnb-field"
97
97
  >
98
98
  <div
99
- class="css-1y9c7n2-fieldName"
99
+ class="css-1q83rf3-fieldName"
100
100
  >
101
101
  Length
102
102
  </div>
@@ -112,7 +112,7 @@ exports[`open up a widget 1`] = `
112
112
  class="css-1m8nxnb-field"
113
113
  >
114
114
  <div
115
- class="css-1y9c7n2-fieldName"
115
+ class="css-1q83rf3-fieldName"
116
116
  >
117
117
  Type
118
118
  </div>
@@ -136,7 +136,7 @@ exports[`open up a widget 1`] = `
136
136
  class="css-1m8nxnb-field"
137
137
  >
138
138
  <div
139
- class="css-1y9c7n2-fieldName"
139
+ class="css-1q83rf3-fieldName"
140
140
  style="width: 96px;"
141
141
  >
142
142
  seq
@@ -153,7 +153,7 @@ exports[`open up a widget 1`] = `
153
153
  class="css-1m8nxnb-field"
154
154
  >
155
155
  <div
156
- class="css-1y9c7n2-fieldName"
156
+ class="css-1q83rf3-fieldName"
157
157
  style="width: 96px;"
158
158
  >
159
159
  score
@@ -170,7 +170,7 @@ exports[`open up a widget 1`] = `
170
170
  class="css-1m8nxnb-field"
171
171
  >
172
172
  <div
173
- class="css-1y9c7n2-fieldName"
173
+ class="css-1q83rf3-fieldName"
174
174
  style="width: 96px;"
175
175
  >
176
176
  qual
@@ -197,7 +197,7 @@ exports[`open up a widget 1`] = `
197
197
  class="css-1m8nxnb-field"
198
198
  >
199
199
  <div
200
- class="css-1y9c7n2-fieldName"
200
+ class="css-1q83rf3-fieldName"
201
201
  style="width: 96px;"
202
202
  >
203
203
  MQ
@@ -214,7 +214,7 @@ exports[`open up a widget 1`] = `
214
214
  class="css-1m8nxnb-field"
215
215
  >
216
216
  <div
217
- class="css-1y9c7n2-fieldName"
217
+ class="css-1q83rf3-fieldName"
218
218
  style="width: 96px;"
219
219
  >
220
220
  CIGAR
@@ -231,7 +231,7 @@ exports[`open up a widget 1`] = `
231
231
  class="css-1m8nxnb-field"
232
232
  >
233
233
  <div
234
- class="css-1y9c7n2-fieldName"
234
+ class="css-1q83rf3-fieldName"
235
235
  style="width: 96px;"
236
236
  >
237
237
  length_on_ref
@@ -248,7 +248,7 @@ exports[`open up a widget 1`] = `
248
248
  class="css-1m8nxnb-field"
249
249
  >
250
250
  <div
251
- class="css-1y9c7n2-fieldName"
251
+ class="css-1q83rf3-fieldName"
252
252
  style="width: 96px;"
253
253
  >
254
254
  template_length
@@ -265,7 +265,7 @@ exports[`open up a widget 1`] = `
265
265
  class="css-1m8nxnb-field"
266
266
  >
267
267
  <div
268
- class="css-1y9c7n2-fieldName"
268
+ class="css-1q83rf3-fieldName"
269
269
  style="width: 96px;"
270
270
  >
271
271
  seq_length
@@ -18,7 +18,7 @@ test('open up a widget', () => {
18
18
  })
19
19
  const session = Session.create(
20
20
  {
21
- // @ts-ignore
21
+ // @ts-expect-error
22
22
  widget: { type: 'AlignmentsFeatureWidget' },
23
23
  },
24
24
  { pluginManager },
@@ -151,7 +151,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
151
151
  const trimEnd = Math.min(end - chunkStart, chunkEnd - chunkStart)
152
152
  const trimLength = trimEnd - trimStart
153
153
  const chunkSeq = chunk.get('seq') || chunk.get('residues')
154
- sequence += chunkSeq.substr(trimStart, trimLength)
154
+ sequence += chunkSeq.slice(trimStart, trimStart + trimLength)
155
155
  })
156
156
 
157
157
  if (sequence.length !== end - start) {
@@ -230,7 +230,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
230
230
  async estimateRegionsStats(regions: Region[], opts?: BaseOptions) {
231
231
  const { bam } = await this.configure()
232
232
  // this is a method to avoid calling on htsget adapters
233
- // @ts-ignore
233
+ // @ts-expect-error
234
234
  if (bam.index.filehandle !== '?') {
235
235
  const bytes = await bytesForRegions(regions, bam)
236
236
  const fetchSizeLimit = this.getConf('fetchSizeLimit')
@@ -97,9 +97,9 @@ export default class BamSlightlyLazyFeature implements Feature {
97
97
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
98
  get(field: string): any {
99
99
  const methodName = `_get_${field}`
100
- // @ts-ignore
100
+ // @ts-expect-error
101
101
  if (this[methodName]) {
102
- // @ts-ignore
102
+ // @ts-expect-error
103
103
  return this[methodName]()
104
104
  }
105
105
  return this.record.get(field)
@@ -124,7 +124,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
124
124
  const trimEnd = Math.min(end - chunkStart, chunkEnd - chunkStart)
125
125
  const trimLength = trimEnd - trimStart
126
126
  const chunkSeq = chunk.get('seq') || chunk.get('residues')
127
- return chunkSeq.substr(trimStart, trimLength)
127
+ return chunkSeq.slice(trimStart, trimStart + trimLength)
128
128
  })
129
129
  .join('')
130
130
 
@@ -253,7 +253,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
253
253
 
254
254
  if (tagFilter) {
255
255
  filtered = filtered.filter(record => {
256
- // @ts-ignore
256
+ // @ts-expect-error
257
257
  const val = record[tagFilter.tag]
258
258
  return val === '*' ? val !== undefined : val === tagFilter.value
259
259
  })
@@ -131,9 +131,9 @@ export default class CramSlightlyLazyFeature implements Feature {
131
131
 
132
132
  get(field: string) {
133
133
  const methodName = `_get_${field}`
134
- // @ts-ignore
134
+ // @ts-expect-error
135
135
  if (this[methodName]) {
136
- // @ts-ignore
136
+ // @ts-expect-error
137
137
  return this[methodName]()
138
138
  }
139
139
  return undefined
@@ -153,7 +153,7 @@ export function readFeaturesToCIGAR(
153
153
  for (let i = 0; i < readFeatures.length; i++) {
154
154
  const { code, refPos, sub, data } = readFeatures[i]
155
155
  sublen = refPos - lastPos
156
- seq += ref.substring(lastPos - refStart, refPos - refStart)
156
+ seq += ref.slice(lastPos - refStart, refPos - refStart)
157
157
  lastPos = refPos
158
158
 
159
159
  if (insLen > 0 && sublen) {
@@ -161,7 +161,7 @@ export function readFeaturesToCIGAR(
161
161
  insLen = 0
162
162
  }
163
163
  if (oplen && op !== 'M') {
164
- cigar += oplen + op
164
+ cigar += `${oplen}${op}`
165
165
  oplen = 0
166
166
  }
167
167
  if (sublen) {
@@ -190,7 +190,7 @@ export function readFeaturesToCIGAR(
190
190
  // Deletion or Ref Skip
191
191
  lastPos += data
192
192
  if (oplen) {
193
- cigar += oplen + op
193
+ cigar += `${oplen}${op}`
194
194
  }
195
195
  cigar += data + code
196
196
  oplen = 0
@@ -198,7 +198,7 @@ export function readFeaturesToCIGAR(
198
198
  // Insertion or soft-clip
199
199
  seq += data
200
200
  if (oplen) {
201
- cigar += oplen + op
201
+ cigar += `${oplen}${op}`
202
202
  }
203
203
  cigar += data.length + code
204
204
  oplen = 0
@@ -206,7 +206,7 @@ export function readFeaturesToCIGAR(
206
206
  // Single base insertion
207
207
  // seq += data
208
208
  if (oplen) {
209
- cigar += oplen + op
209
+ cigar += `${oplen}${op}`
210
210
  }
211
211
  insLen++
212
212
  seq += data
@@ -214,13 +214,13 @@ export function readFeaturesToCIGAR(
214
214
  } else if (code === 'P') {
215
215
  // Padding
216
216
  if (oplen) {
217
- cigar += oplen + op
217
+ cigar += `${oplen}${op}`
218
218
  }
219
219
  cigar += `${data}P`
220
220
  } else if (code === 'H') {
221
221
  // Hard clip
222
222
  if (oplen) {
223
- cigar += oplen + op
223
+ cigar += `${oplen}${op}`
224
224
  }
225
225
  cigar += `${data}H`
226
226
  oplen = 0
@@ -231,10 +231,10 @@ export function readFeaturesToCIGAR(
231
231
  }
232
232
  if (seq.length !== readLen) {
233
233
  sublen = readLen - seq.length
234
- seq += ref.substring(lastPos - refStart, lastPos - refStart + sublen)
234
+ seq += ref.slice(lastPos - refStart, lastPos - refStart + sublen)
235
235
 
236
236
  if (oplen && op !== 'M') {
237
- cigar += oplen + op
237
+ cigar += `${oplen}${op}`
238
238
  oplen = 0
239
239
  }
240
240
  op = 'M'
@@ -244,7 +244,7 @@ export function readFeaturesToCIGAR(
244
244
  cigar += `${insLen}I`
245
245
  }
246
246
  if (oplen) {
247
- cigar += oplen + op
247
+ cigar += `${oplen}${op}`
248
248
  }
249
249
 
250
250
  return cigar
@@ -7,13 +7,13 @@ import { ResizeHandle } from '@jbrowse/core/ui'
7
7
  // locals
8
8
  import { AlignmentsDisplayModel } from '../models/model'
9
9
 
10
- const useStyles = makeStyles()(() => ({
10
+ const useStyles = makeStyles()({
11
11
  resizeHandle: {
12
12
  height: 2,
13
13
  position: 'absolute',
14
14
  zIndex: 2,
15
15
  },
16
- }))
16
+ })
17
17
 
18
18
  function AlignmentsDisplay({ model }: { model: AlignmentsDisplayModel }) {
19
19
  const { PileupDisplay, SNPCoverageDisplay } = model
@@ -19,7 +19,7 @@ beforeEach(() => {
19
19
  })
20
20
 
21
21
  afterEach(() => {
22
- // @ts-ignore
22
+ // @ts-expect-error
23
23
  console.warn.mockRestore()
24
24
  })
25
25
 
@@ -21,6 +21,14 @@ export default function configModelFactory(pm: PluginManager) {
21
21
  */
22
22
  snpCoverageDisplay: pm.getDisplayType('LinearSNPCoverageDisplay')
23
23
  .configSchema,
24
+
25
+ /**
26
+ * #slot
27
+ */
28
+ height: {
29
+ type: 'number',
30
+ defaultValue: 250,
31
+ },
24
32
  },
25
33
  {
26
34
  /**
@@ -27,9 +27,9 @@ function getLowerPanelDisplays(pluginManager: PluginManager) {
27
27
  return (
28
28
  pluginManager
29
29
  .getDisplayElements()
30
- // @ts-ignore
30
+ // @ts-expect-error
31
31
  .filter(f => f.subDisplay?.type === 'LinearAlignmentsDisplay')
32
- // @ts-ignore
32
+ // @ts-expect-error
33
33
  .filter(f => f.subDisplay?.lowerPanel)
34
34
  )
35
35
  }
@@ -87,7 +87,6 @@ function AlignmentsModel(
87
87
  * #property
88
88
  * refers to LinearPileupDisplay sub-display model
89
89
  */
90
- // @ts-ignore
91
90
  PileupDisplay: types.maybe(types.union(...lowerPanelDisplays)),
92
91
  /**
93
92
  * #property
@@ -111,7 +110,7 @@ function AlignmentsModel(
111
110
  /**
112
111
  * #property
113
112
  */
114
- height: 250,
113
+ heightPreConfig: types.maybe(types.number),
115
114
  /**
116
115
  * #property
117
116
  */
@@ -155,6 +154,14 @@ function stateModelFactory(
155
154
  self.snpCovHeight = n
156
155
  },
157
156
  }))
157
+ .views(self => ({
158
+ /**
159
+ * #getter
160
+ */
161
+ get height() {
162
+ return self.heightPreConfig ?? getConf(self, 'height')
163
+ },
164
+ }))
158
165
  .views(self => ({
159
166
  /**
160
167
  * #getter
@@ -245,8 +252,8 @@ function stateModelFactory(
245
252
  * #action
246
253
  */
247
254
  setHeight(n: number) {
248
- self.height = Math.max(n, minDisplayHeight)
249
- return self.height
255
+ self.heightPreConfig = Math.max(n, minDisplayHeight)
256
+ return self.heightPreConfig
250
257
  },
251
258
  /**
252
259
  * #action
@@ -369,6 +376,14 @@ function stateModelFactory(
369
376
  },
370
377
  }
371
378
  })
379
+ .preProcessSnapshot(snap => {
380
+ if (!snap) {
381
+ return snap
382
+ }
383
+ // @ts-expect-error
384
+ const { height, ...rest } = snap
385
+ return { heightPreConfig: height, ...rest }
386
+ })
372
387
  }
373
388
 
374
389
  export default stateModelFactory
@@ -20,7 +20,5 @@ export default function register(pluginManager: PluginManager) {
20
20
  })
21
21
  }
22
22
 
23
- export {
24
- modelFactory as linearPileupDisplayStateModelFactory,
25
- configSchemaFactory as linearPileupDisplayConfigSchemaFactory,
26
- }
23
+ export { default as linearPileupDisplayStateModelFactory } from './model'
24
+ export { default as linearPileupDisplayConfigSchemaFactory } from './configSchema'
@@ -275,7 +275,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
275
275
  if (sortedBy) {
276
276
  const { pos, refName, assemblyName } = sortedBy
277
277
  // render just the sorted region first
278
- // @ts-ignore
278
+ // @ts-expect-error
279
279
  await self.rendererType.renderInClient(rpcManager, {
280
280
  assemblyName,
281
281
  regions: [
@@ -337,9 +337,9 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
337
337
  // feature.id that was returned e.g. that the user hasn't
338
338
  // moused over to a new position during the async operation
339
339
  // above
340
- // @ts-ignore
340
+ // @ts-expect-error
341
341
  if (self.featureIdUnderMouse === feature.uniqueId) {
342
- // @ts-ignore
342
+ // @ts-expect-error
343
343
  self.setFeatureUnderMouse(new SimpleFeature(feature))
344
344
  }
345
345
  }
@@ -617,7 +617,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
617
617
  )) as { feature: unknown }
618
618
 
619
619
  if (feature) {
620
- // @ts-ignore
620
+ // @ts-expect-error
621
621
  self.selectFeature(new SimpleFeature(feature))
622
622
  }
623
623
  }
@@ -14,18 +14,20 @@ import { LinearReadArcsDisplayModel } from '../model'
14
14
 
15
15
  type LGV = LinearGenomeViewModel
16
16
 
17
- const useStyles = makeStyles()(theme => ({
18
- loading: {
19
- paddingLeft: '0.6em',
20
- backgroundColor: theme.palette.action.disabledBackground,
21
- backgroundImage:
22
- 'repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,.5) 5px, rgba(255,255,255,.5) 10px)',
23
- height: '100%',
24
- width: '100%',
25
- pointerEvents: 'none',
26
- textAlign: 'center',
27
- },
28
- }))
17
+ const useStyles = makeStyles()(theme => {
18
+ const bg = theme.palette.action.disabledBackground
19
+ return {
20
+ loading: {
21
+ paddingLeft: '0.6em',
22
+ backgroundColor: theme.palette.background.default,
23
+ backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,
24
+ height: '100%',
25
+ width: '100%',
26
+ pointerEvents: 'none',
27
+ textAlign: 'center',
28
+ },
29
+ }
30
+ })
29
31
 
30
32
  const Arcs = observer(function ({
31
33
  model,
@@ -22,11 +22,16 @@ import FilterListIcon from '@mui/icons-material/ClearAll'
22
22
  import { FilterModel } from '../shared'
23
23
  import drawFeats from './drawFeats'
24
24
  import { fetchChains, ChainData } from '../shared/fetchChains'
25
- import { ExportSvgOptions } from '@jbrowse/plugin-linear-genome-view/src/LinearGenomeView'
26
25
 
27
26
  // async
28
27
  const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'))
29
28
 
29
+ // stabilize clipid under test for snapshot
30
+ function getId(id: string) {
31
+ const isJest = typeof jest === 'undefined'
32
+ return `arc-clip-${isJest ? id : 'jest'}`
33
+ }
34
+
30
35
  interface Filter {
31
36
  flagInclude: number
32
37
  flagExclude: number
@@ -333,7 +338,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
333
338
  /**
334
339
  * #method
335
340
  */
336
- async renderSvg(opts: ExportSvgOptions) {
341
+ async renderSvg(opts: { rasterizeLayers?: boolean }) {
337
342
  const view = getContainingView(self) as LGV
338
343
  const width = view.dynamicBlocks.totalWidthPx
339
344
  const height = self.height
@@ -360,13 +365,26 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
360
365
  const C2S = await import('canvas2svg')
361
366
  const ctx = new C2S.default(width, height)
362
367
  await drawFeats(self, ctx)
368
+ const clipid = getId(self.id)
363
369
  str = (
364
- // eslint-disable-next-line react/no-danger
365
- <g dangerouslySetInnerHTML={{ __html: ctx.getSvg().innerHTML }} />
370
+ <>
371
+ <defs>
372
+ <clipPath id={clipid}>
373
+ <rect x={0} y={0} width={width} height={height} />
374
+ </clipPath>
375
+ </defs>
376
+ <g
377
+ /* eslint-disable-next-line react/no-danger */
378
+ dangerouslySetInnerHTML={{
379
+ __html: ctx.getSvg().innerHTML,
380
+ }}
381
+ clipPath={`url(#${clipid})`}
382
+ />
383
+ </>
366
384
  )
367
385
  }
368
386
 
369
- return <g>{str}</g>
387
+ return <>{str}</>
370
388
  },
371
389
  }))
372
390
  .actions(self => ({
@@ -17,10 +17,7 @@ import FilterListIcon from '@mui/icons-material/ClearAll'
17
17
  import { FilterModel } from '../shared'
18
18
  import { fetchChains, ChainData } from '../shared/fetchChains'
19
19
  import drawFeats from './drawFeats'
20
- import {
21
- ExportSvgOptions,
22
- LinearGenomeViewModel,
23
- } from '@jbrowse/plugin-linear-genome-view/src/LinearGenomeView'
20
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
24
21
 
25
22
  // async
26
23
  const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'))
@@ -32,6 +29,12 @@ interface Filter {
32
29
  tagFilter?: { tag: string; value: string }
33
30
  }
34
31
 
32
+ // stabilize clipid under test for snapshot
33
+ function getId(id: string) {
34
+ const isJest = typeof jest === 'undefined'
35
+ return `cloud-clip-${isJest ? id : 'jest'}`
36
+ }
37
+
35
38
  /**
36
39
  * #stateModel LinearReadCloudDisplay
37
40
  * extends `BaseLinearDisplay`
@@ -205,7 +208,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
205
208
  /**
206
209
  * #method
207
210
  */
208
- async renderSvg(opts: ExportSvgOptions) {
211
+ async renderSvg(opts: { rasterizeLayers?: boolean }) {
209
212
  const view = getContainingView(self) as LinearGenomeViewModel
210
213
  const width = view.dynamicBlocks.totalWidthPx
211
214
  const height = self.height
@@ -232,9 +235,22 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
232
235
  const C2S = await import('canvas2svg')
233
236
  const ctx = new C2S.default(width, height)
234
237
  await drawFeats(self, ctx)
238
+ const clipid = getId(self.id)
235
239
  str = (
236
- // eslint-disable-next-line react/no-danger
237
- <g dangerouslySetInnerHTML={{ __html: ctx.getSvg().innerHTML }} />
240
+ <>
241
+ <defs>
242
+ <clipPath id={clipid}>
243
+ <rect x={0} y={0} width={width} height={height} />
244
+ </clipPath>
245
+ </defs>
246
+ <g
247
+ /* eslint-disable-next-line react/no-danger */
248
+ dangerouslySetInnerHTML={{
249
+ __html: ctx.getSvg().innerHTML,
250
+ }}
251
+ clipPath={`url(#${clipid})`}
252
+ />
253
+ </>
238
254
  )
239
255
  }
240
256
 
@@ -9,7 +9,7 @@ beforeEach(() => {
9
9
  })
10
10
 
11
11
  afterEach(() => {
12
- // @ts-ignore
12
+ // @ts-expect-error
13
13
  console.warn.mockRestore()
14
14
  })
15
15
  // change renderer
@@ -25,7 +25,7 @@ export function cigarToMismatches(
25
25
  seq?: string,
26
26
  ref?: string,
27
27
  qual?: Buffer,
28
- ): Mismatch[] {
28
+ ) {
29
29
  let roffset = 0 // reference offset
30
30
  let soffset = 0 // seq offset
31
31
  const mismatches: Mismatch[] = []
@@ -125,7 +125,7 @@ export function mdToMismatches(
125
125
  cigarMismatches: Mismatch[],
126
126
  seq: string,
127
127
  qual?: Buffer,
128
- ): Mismatch[] {
128
+ ) {
129
129
  const mismatchRecords: Mismatch[] = []
130
130
  let curr: Mismatch = { start: 0, base: '', length: 0, type: 'mismatch' }
131
131
  const skips = cigarMismatches.filter(cigar => cigar.type === 'skip')
@@ -216,7 +216,7 @@ export function getMismatches(
216
216
  seq?: string,
217
217
  ref?: string,
218
218
  qual?: Buffer,
219
- ): Mismatch[] {
219
+ ) {
220
220
  let mismatches: Mismatch[] = []
221
221
  const ops = parseCigar(cigar)
222
222
 
@@ -330,20 +330,19 @@ export function getModificationTypes(mm: string) {
330
330
  const mods = mm.split(';')
331
331
  return mods
332
332
  .filter(mod => !!mod)
333
- .map(mod => {
333
+ .flatMap(mod => {
334
334
  const [basemod] = mod.split(',')
335
335
 
336
336
  const matches = basemod.match(modificationRegex)
337
337
  if (!matches) {
338
338
  throw new Error(`bad format for MM tag: ${mm}`)
339
339
  }
340
- const [, , , typestr] = matches
340
+ const typestr = matches[3]
341
341
 
342
342
  // can be a multi e.g. C+mh for both meth (m) and hydroxymeth (h) so
343
343
  // split, and they can also be chemical codes (ChEBI) e.g. C+16061
344
344
  return typestr.split(/(\d+|.)/).filter(f => !!f)
345
345
  })
346
- .flat()
347
346
  }
348
347
 
349
348
  export function getOrientedCigar(flip: boolean, cigar: string[]) {
@@ -357,8 +356,7 @@ export function getOrientedCigar(flip: boolean, cigar: string[]) {
357
356
  } else if (op === 'I') {
358
357
  op = 'D'
359
358
  }
360
- ret.push(len)
361
- ret.push(op)
359
+ ret.push(len, op)
362
360
  }
363
361
  return ret
364
362
  } else {
@@ -27,11 +27,7 @@ export default class NestedFrequencyTable {
27
27
  amount = 1
28
28
  }
29
29
 
30
- if (!slotName) {
31
- slotName = 'default'
32
- } else {
33
- slotName = slotName.toString()
34
- }
30
+ slotName = slotName ? slotName.toString() : 'default'
35
31
 
36
32
  if (this.categories[slotName]) {
37
33
  this.categories[slotName] = Math.max(
@@ -49,11 +45,7 @@ export default class NestedFrequencyTable {
49
45
  amount = 1
50
46
  }
51
47
 
52
- if (!slotName) {
53
- slotName = 'default'
54
- } else {
55
- slotName = slotName.toString()
56
- }
48
+ slotName = slotName ? slotName.toString() : 'default'
57
49
 
58
50
  this.categories[slotName] = (this.categories[slotName] || 0) + amount
59
51
  return this.categories[slotName]
@@ -71,7 +63,7 @@ export default class NestedFrequencyTable {
71
63
  path = path.split('/')
72
64
  }
73
65
 
74
- if (!path.length) {
66
+ if (path.length === 0) {
75
67
  return this
76
68
  }
77
69