@jbrowse/plugin-alignments 1.5.8 → 1.6.2

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.
@@ -39,11 +39,7 @@ export default function SNPCoverageConfigFactory(pluginManager: PluginManager) {
39
39
  description: 'draw upside down',
40
40
  defaultValue: false,
41
41
  },
42
- maxDisplayedBpPerPx: {
43
- type: 'number',
44
- description: 'maximum bpPerPx that is displayed in the view',
45
- defaultValue: 100,
46
- },
42
+
47
43
  headroom: {
48
44
  type: 'number',
49
45
  description:
@@ -131,9 +131,10 @@ const stateModelFactory = (
131
131
  },
132
132
 
133
133
  renderProps() {
134
+ const superProps = superRenderProps()
134
135
  return {
135
- ...superRenderProps(),
136
- notReady: !self.ready || !this.modificationsReady,
136
+ ...superProps,
137
+ notReady: superProps.notReady || !this.modificationsReady,
137
138
  filters: self.filters,
138
139
  modificationTagMap: JSON.parse(
139
140
  JSON.stringify(self.modificationTagMap),
@@ -682,11 +682,13 @@ export default class PileupRenderer extends BoxRendererType {
682
682
  const baseColor = colorForBase.deletion
683
683
  ctx.fillStyle = baseColor
684
684
  ctx.fillRect(leftPx, topPx, widthPx, heightPx)
685
- if (widthPx >= charWidth && heightPx >= heightLim) {
685
+ const txt = `${mismatch.length}`
686
+ const rect = ctx.measureText(txt)
687
+ if (widthPx >= rect.width && heightPx >= heightLim) {
686
688
  ctx.fillStyle = theme.palette.getContrastText(baseColor)
687
689
  ctx.fillText(
688
- mbase,
689
- leftPx + (widthPx - charWidth) / 2 + 1,
690
+ txt,
691
+ leftPx + (rightPx - leftPx) / 2 - rect.width / 2,
690
692
  topPx + heightPx,
691
693
  )
692
694
  }
@@ -125,6 +125,11 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
125
125
  }, opts.signal)
126
126
  }
127
127
 
128
+ async estimateRegionsStats(regions: Region[], opts?: BaseOptions) {
129
+ const { subadapter } = await this.configure()
130
+ return subadapter.estimateRegionsStats(regions, opts)
131
+ }
132
+
128
133
  async getRefNames(opts: BaseOptions = {}) {
129
134
  const { subadapter } = await this.configure()
130
135
  return subadapter.getRefNames(opts)
package/src/index.ts CHANGED
@@ -60,12 +60,15 @@ export default class AlignmentsPlugin extends Plugin {
60
60
  const regexGuess = /\.cram$/i
61
61
  const adapterName = 'CramAdapter'
62
62
  const fileName = getFileName(file)
63
- if (regexGuess.test(fileName) || adapterHint === adapterName) {
64
- return {
65
- type: adapterName,
66
- cramLocation: file,
67
- craiLocation: index || makeIndex(file, '.crai'),
68
- }
63
+ const obj = {
64
+ type: adapterName,
65
+ cramLocation: file,
66
+ craiLocation: index || makeIndex(file, '.crai'),
67
+ }
68
+ if (regexGuess.test(fileName) && !adapterHint) {
69
+ return obj
70
+ } else if (adapterHint === adapterName) {
71
+ return obj
69
72
  }
70
73
  return adapterGuesser(file, index, adapterHint)
71
74
  }
@@ -84,15 +87,19 @@ export default class AlignmentsPlugin extends Plugin {
84
87
  const adapterName = 'BamAdapter'
85
88
  const fileName = getFileName(file)
86
89
  const indexName = index && getFileName(index)
87
- if (regexGuess.test(fileName) || adapterHint === adapterName) {
88
- return {
89
- type: adapterName,
90
- bamLocation: file,
91
- index: {
92
- location: index || makeIndex(file, '.bai'),
93
- indexType: makeIndexType(indexName, 'CSI', 'BAI'),
94
- },
95
- }
90
+
91
+ const obj = {
92
+ type: adapterName,
93
+ bamLocation: file,
94
+ index: {
95
+ location: index || makeIndex(file, '.bai'),
96
+ indexType: makeIndexType(indexName, 'CSI', 'BAI'),
97
+ },
98
+ }
99
+ if (regexGuess.test(fileName) && !adapterHint) {
100
+ return obj
101
+ } else if (adapterHint === adapterName) {
102
+ return obj
96
103
  }
97
104
  return adapterGuesser(file, index, adapterHint)
98
105
  }