@jbrowse/plugin-alignments 1.5.0 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/AlignmentsFeatureDetail/index.d.ts +7 -4
  2. package/dist/AlignmentsTrack/index.d.ts +2 -0
  3. package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +1 -1
  4. package/dist/BamAdapter/index.d.ts +2 -4
  5. package/dist/CramAdapter/index.d.ts +1 -4
  6. package/dist/HtsgetBamAdapter/HtsgetBamAdapter.d.ts +2 -1
  7. package/dist/HtsgetBamAdapter/index.d.ts +2 -4
  8. package/dist/LinearAlignmentsDisplay/index.d.ts +2 -3
  9. package/dist/LinearPileupDisplay/index.d.ts +2 -2
  10. package/dist/LinearPileupDisplay/model.d.ts +1 -2
  11. package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
  12. package/dist/LinearSNPCoverageDisplay/index.d.ts +2 -2
  13. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +1 -0
  14. package/dist/PileupRenderer/PileupRenderer.d.ts +20 -7
  15. package/dist/PileupRenderer/index.d.ts +2 -3
  16. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +38 -26
  17. package/dist/SNPCoverageAdapter/index.d.ts +1 -5
  18. package/dist/SNPCoverageRenderer/index.d.ts +3 -3
  19. package/dist/plugin-alignments.cjs.development.js +3696 -3526
  20. package/dist/plugin-alignments.cjs.development.js.map +1 -1
  21. package/dist/plugin-alignments.cjs.production.min.js +1 -1
  22. package/dist/plugin-alignments.cjs.production.min.js.map +1 -1
  23. package/dist/plugin-alignments.esm.js +3690 -3520
  24. package/dist/plugin-alignments.esm.js.map +1 -1
  25. package/package.json +4 -4
  26. package/src/AlignmentsFeatureDetail/__snapshots__/index.test.js.snap +8 -0
  27. package/src/AlignmentsFeatureDetail/{index.js → index.ts} +19 -3
  28. package/src/AlignmentsTrack/index.ts +36 -0
  29. package/src/BamAdapter/BamSlightlyLazyFeature.ts +14 -30
  30. package/src/BamAdapter/MismatchParser.test.ts +20 -0
  31. package/src/BamAdapter/MismatchParser.ts +6 -5
  32. package/src/BamAdapter/index.ts +11 -5
  33. package/src/CramAdapter/CramSlightlyLazyFeature.ts +1 -5
  34. package/src/CramAdapter/index.ts +11 -4
  35. package/src/HtsgetBamAdapter/HtsgetBamAdapter.ts +2 -2
  36. package/src/HtsgetBamAdapter/index.ts +18 -5
  37. package/src/LinearAlignmentsDisplay/index.ts +20 -3
  38. package/src/LinearAlignmentsDisplay/models/configSchema.test.js +8 -68
  39. package/src/LinearPileupDisplay/configSchema.test.js +2 -13
  40. package/src/LinearPileupDisplay/index.ts +19 -2
  41. package/src/LinearPileupDisplay/model.ts +15 -20
  42. package/src/LinearSNPCoverageDisplay/components/Tooltip.tsx +17 -12
  43. package/src/LinearSNPCoverageDisplay/index.ts +19 -2
  44. package/src/LinearSNPCoverageDisplay/models/configSchema.test.js +2 -13
  45. package/src/LinearSNPCoverageDisplay/models/model.ts +21 -0
  46. package/src/PileupRenderer/PileupRenderer.tsx +154 -128
  47. package/src/PileupRenderer/components/PileupRendering.tsx +2 -0
  48. package/src/PileupRenderer/configSchema.ts +2 -2
  49. package/src/PileupRenderer/index.ts +16 -3
  50. package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +95 -25
  51. package/src/SNPCoverageAdapter/index.ts +17 -5
  52. package/src/SNPCoverageRenderer/SNPCoverageRenderer.ts +60 -13
  53. package/src/SNPCoverageRenderer/configSchema.js +5 -0
  54. package/src/SNPCoverageRenderer/index.ts +24 -0
  55. package/src/index.ts +91 -163
  56. package/src/SNPCoverageAdapter/SNPCoverageAdapter.test.ts +0 -275
  57. package/src/SNPCoverageAdapter/__snapshots__/SNPCoverageAdapter.test.ts.snap +0 -579
  58. package/src/SNPCoverageRenderer/index.js +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-alignments",
3
- "version": "1.5.0",
3
+ "version": "1.5.4",
4
4
  "description": "JBrowse 2 alignments adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -35,14 +35,14 @@
35
35
  "useSrc": "node ../../scripts/useSrc.js"
36
36
  },
37
37
  "dependencies": {
38
- "@gmod/bam": "^1.1.8",
38
+ "@gmod/bam": "^1.1.9",
39
39
  "@gmod/cram": "^1.5.9",
40
40
  "@material-ui/icons": "^4.9.1",
41
41
  "abortable-promise-cache": "^1.1.3",
42
42
  "color": "^3.1.2",
43
43
  "copy-to-clipboard": "^3.3.1",
44
44
  "fast-deep-equal": "^3.1.3",
45
- "generic-filehandle": "^2.2.0",
45
+ "generic-filehandle": "^2.2.2",
46
46
  "json-stable-stringify": "^1.0.1",
47
47
  "react-d3-axis": "^0.1.2"
48
48
  },
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "542025578a39bd170c8a166f2568ee7edbd54072"
64
+ "gitHead": "0c398214590969168694b4ed8e20b595178b9efd"
65
65
  }
@@ -147,6 +147,7 @@ exports[`open up a widget 1`] = `
147
147
  >
148
148
  <div
149
149
  class="makeStyles-fieldName"
150
+ style="width: 96px;"
150
151
  >
151
152
  seq
152
153
  </div>
@@ -163,6 +164,7 @@ exports[`open up a widget 1`] = `
163
164
  >
164
165
  <div
165
166
  class="makeStyles-fieldName"
167
+ style="width: 96px;"
166
168
  >
167
169
  score
168
170
  </div>
@@ -179,6 +181,7 @@ exports[`open up a widget 1`] = `
179
181
  >
180
182
  <div
181
183
  class="makeStyles-fieldName"
184
+ style="width: 96px;"
182
185
  >
183
186
  qual
184
187
  </div>
@@ -205,6 +208,7 @@ exports[`open up a widget 1`] = `
205
208
  >
206
209
  <div
207
210
  class="makeStyles-fieldName"
211
+ style="width: 96px;"
208
212
  >
209
213
  MQ
210
214
  </div>
@@ -221,6 +225,7 @@ exports[`open up a widget 1`] = `
221
225
  >
222
226
  <div
223
227
  class="makeStyles-fieldName"
228
+ style="width: 96px;"
224
229
  >
225
230
  CIGAR
226
231
  </div>
@@ -237,6 +242,7 @@ exports[`open up a widget 1`] = `
237
242
  >
238
243
  <div
239
244
  class="makeStyles-fieldName"
245
+ style="width: 96px;"
240
246
  >
241
247
  length_on_ref
242
248
  </div>
@@ -253,6 +259,7 @@ exports[`open up a widget 1`] = `
253
259
  >
254
260
  <div
255
261
  class="makeStyles-fieldName"
262
+ style="width: 96px;"
256
263
  >
257
264
  template_length
258
265
  </div>
@@ -269,6 +276,7 @@ exports[`open up a widget 1`] = `
269
276
  >
270
277
  <div
271
278
  class="makeStyles-fieldName"
279
+ style="width: 96px;"
272
280
  >
273
281
  seq_length
274
282
  </div>
@@ -1,10 +1,13 @@
1
+ import { lazy } from 'react'
2
+ import PluginManager from '@jbrowse/core/PluginManager'
1
3
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
4
  import { ElementId } from '@jbrowse/core/util/types/mst'
3
5
  import { types } from 'mobx-state-tree'
6
+ import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType'
4
7
 
5
8
  const configSchema = ConfigurationSchema('AlignmentsFeatureWidget', {})
6
9
 
7
- export default function stateModelFactory(pluginManager) {
10
+ export function stateModelFactory(pluginManager: PluginManager) {
8
11
  return types
9
12
  .model('AlignmentsFeatureWidget', {
10
13
  id: ElementId,
@@ -15,7 +18,7 @@ export default function stateModelFactory(pluginManager) {
15
18
  ),
16
19
  })
17
20
  .actions(self => ({
18
- setFeatureData(data) {
21
+ setFeatureData(data: unknown) {
19
22
  self.featureData = data
20
23
  },
21
24
  clearFeatureData() {
@@ -24,4 +27,17 @@ export default function stateModelFactory(pluginManager) {
24
27
  }))
25
28
  }
26
29
 
27
- export { configSchema, stateModelFactory }
30
+ export default function register(pluginManager: PluginManager) {
31
+ pluginManager.addWidgetType(
32
+ () =>
33
+ new WidgetType({
34
+ name: 'AlignmentsFeatureWidget',
35
+ heading: 'Feature details',
36
+ configSchema,
37
+ stateModel: stateModelFactory(pluginManager),
38
+ ReactComponent: lazy(() => import('./AlignmentsFeatureDetail')),
39
+ }),
40
+ )
41
+ }
42
+
43
+ export { configSchema }
@@ -0,0 +1,36 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager'
2
+ import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'
3
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
4
+ import {
5
+ createBaseTrackConfig,
6
+ createBaseTrackModel,
7
+ } from '@jbrowse/core/pluggableElementTypes/models'
8
+ function configSchemaFactory(pluginManager: PluginManager) {
9
+ return ConfigurationSchema(
10
+ 'AlignmentsTrack',
11
+ {},
12
+ { baseConfiguration: createBaseTrackConfig(pluginManager) },
13
+ )
14
+ }
15
+ export default function register(pluginManager: PluginManager) {
16
+ pluginManager.addTrackType(() => {
17
+ const configSchema = configSchemaFactory(pluginManager)
18
+ const track = new TrackType({
19
+ name: 'AlignmentsTrack',
20
+ configSchema,
21
+ stateModel: createBaseTrackModel(
22
+ pluginManager,
23
+ 'AlignmentsTrack',
24
+ configSchema,
25
+ ),
26
+ })
27
+ const linearAlignmentsDisplay = pluginManager.getDisplayType(
28
+ 'LinearAlignmentsDisplay',
29
+ )
30
+ // Add LinearAlignmentsDisplay here so that it has priority over the other
31
+ // linear displays (defaults to order the displays are added, but we have
32
+ // to add the Pileup and SNPCoverage displays first).
33
+ track.addDisplayType(linearAlignmentsDisplay)
34
+ return track
35
+ })
36
+ }
@@ -15,17 +15,11 @@ import {
15
15
  import BamAdapter from './BamAdapter'
16
16
 
17
17
  export default class BamSlightlyLazyFeature implements Feature {
18
- private record: BamRecord
19
-
20
- private adapter: BamAdapter
21
-
22
- private ref?: string
23
-
24
- constructor(record: BamRecord, adapter: BamAdapter, ref?: string) {
25
- this.record = record
26
- this.adapter = adapter
27
- this.ref = ref
28
- }
18
+ constructor(
19
+ private record: BamRecord,
20
+ private adapter: BamAdapter,
21
+ private ref?: string,
22
+ ) {}
29
23
 
30
24
  _get_name() {
31
25
  return this.record.get('name')
@@ -153,16 +147,12 @@ export default class BamSlightlyLazyFeature implements Feature {
153
147
  }
154
148
 
155
149
  toJSON(): SimpleFeatureSerialized {
156
- const tags = Object.fromEntries(
157
- this.tags()
158
- .map(t => {
159
- return [t, this.get(t)]
160
- })
161
- .filter(elt => elt[1] !== undefined),
162
- )
163
-
164
150
  return {
165
- ...tags,
151
+ ...Object.fromEntries(
152
+ this.tags()
153
+ .map(t => [t, this.get(t)])
154
+ .filter(elt => elt[1] !== undefined),
155
+ ),
166
156
  uniqueId: this.id(),
167
157
  }
168
158
  }
@@ -201,24 +191,18 @@ export default class BamSlightlyLazyFeature implements Feature {
201
191
 
202
192
  // parse the CIGAR tag if it has one
203
193
  const cigarString = this.get(cigarAttributeName)
194
+ const seq = this.get('seq')
195
+ const qual = this.qualRaw()
204
196
  if (cigarString) {
205
197
  cigarOps = parseCigar(cigarString)
206
- mismatches = mismatches.concat(
207
- cigarToMismatches(cigarOps, this.get('seq'), this.qualRaw()),
208
- )
198
+ mismatches = mismatches.concat(cigarToMismatches(cigarOps, seq, qual))
209
199
  }
210
200
 
211
201
  // now let's look for CRAM or MD mismatches
212
202
  const mdString = this.get(mdAttributeName)
213
203
  if (mdString) {
214
204
  mismatches = mismatches.concat(
215
- mdToMismatches(
216
- mdString,
217
- cigarOps,
218
- mismatches,
219
- this.get('seq'),
220
- this.qualRaw(),
221
- ),
205
+ mdToMismatches(mdString, cigarOps, mismatches, seq, qual),
222
206
  )
223
207
  }
224
208
 
@@ -498,3 +498,23 @@ test('getModificationPositions', () => {
498
498
  )
499
499
  expect(positions[0]).toEqual({ type: 'm', positions: [6, 17, 20, 31, 34] })
500
500
  })
501
+
502
+ // ? means "modification status of the skipped bases provided."
503
+ test('getModificationPositions with unknown (?)', () => {
504
+ const positions = getModificationPositions(
505
+ 'C+m?,2,2,1,4,1',
506
+ 'AGCTCTCCAGAGTCGNACGCCATYCGCGCGCCACCA',
507
+ 1,
508
+ )
509
+ expect(positions[0]).toEqual({ type: 'm', positions: [6, 17, 20, 31, 34] })
510
+ })
511
+
512
+ // . means "modification status of the skipped bases is low probability"
513
+ test('getModificationPositions with unknown (.)', () => {
514
+ const positions = getModificationPositions(
515
+ 'C+m.,2,2,1,4,1',
516
+ 'AGCTCTCCAGAGTCGNACGCCATYCGCGCGCCACCA',
517
+ 1,
518
+ )
519
+ expect(positions[0]).toEqual({ type: 'm', positions: [6, 17, 20, 31, 34] })
520
+ })
@@ -153,15 +153,16 @@ export function mdToMismatches(
153
153
  const md = mdstring.match(/(\d+|\^[a-z]+|[a-z])/gi) || []
154
154
  for (let i = 0; i < md.length; i++) {
155
155
  const token = md[i]
156
- if (token.match(/^\d/)) {
157
- curr.start += parseInt(token, 10)
158
- } else if (token.match(/^\^/)) {
156
+ const num = +token
157
+ if (!Number.isNaN(num)) {
158
+ curr.start += num
159
+ } else if (token.startsWith('^')) {
159
160
  curr.length = token.length - 1
160
161
  curr.base = '*'
161
162
  curr.type = 'deletion'
162
163
  curr.seq = token.substring(1)
163
164
  nextRecord()
164
- } else if (token.match(/^[a-z]/i)) {
165
+ } else {
165
166
  // mismatch
166
167
  for (let j = 0; j < token.length; j += 1) {
167
168
  curr.length = 1
@@ -328,7 +329,7 @@ export function getModificationPositions(
328
329
  const [basemod, ...skips] = mod.split(',')
329
330
 
330
331
  // regexes based on parse_mm.pl from hts-specs
331
- const matches = basemod.match(/([A-Z])([-+])([^,]+)/)
332
+ const matches = basemod.match(/([A-Z])([-+])([^,.?]+)([.?])?/)
332
333
  if (!matches) {
333
334
  throw new Error('bad format for MM tag')
334
335
  }
@@ -1,8 +1,14 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager'
2
+ import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'
1
3
  import configSchema from './configSchema'
2
4
 
3
- export default (/* pluginManager: PluginManager */) => {
4
- return {
5
- configSchema,
6
- getAdapterClass: () => import('./BamAdapter').then(r => r.default),
7
- }
5
+ export default (pluginManager: PluginManager) => {
6
+ pluginManager.addAdapterType(
7
+ () =>
8
+ new AdapterType({
9
+ name: 'BamAdapter',
10
+ configSchema,
11
+ getAdapterClass: () => import('./BamAdapter').then(r => r.default),
12
+ }),
13
+ )
8
14
  }
@@ -18,14 +18,10 @@ export interface Mismatch {
18
18
  }
19
19
 
20
20
  export default class CramSlightlyLazyFeature implements Feature {
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- private record: any
23
-
24
21
  private _store: CramAdapter
25
22
 
26
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- constructor(record: any, store: CramAdapter) {
28
- this.record = record
24
+ constructor(private record: any, store: CramAdapter) {
29
25
  this._store = store
30
26
  }
31
27
 
@@ -1,9 +1,16 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager'
2
+ import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'
3
+
4
+ // locals
2
5
  import configSchemaF from './configSchema'
3
6
 
4
7
  export default (pluginManager: PluginManager) => {
5
- return {
6
- configSchema: pluginManager.load(configSchemaF),
7
- getAdapterClass: () => import('./CramAdapter').then(r => r.default),
8
- }
8
+ pluginManager.addAdapterType(
9
+ () =>
10
+ new AdapterType({
11
+ name: 'CramAdapter',
12
+ configSchema: pluginManager.load(configSchemaF),
13
+ getAdapterClass: () => import('./CramAdapter').then(r => r.default),
14
+ }),
15
+ )
9
16
  }
@@ -1,4 +1,4 @@
1
- import { HtsgetFile } from '@gmod/bam'
1
+ import { BamFile, HtsgetFile } from '@gmod/bam'
2
2
  import { readConfObject } from '@jbrowse/core/configuration'
3
3
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
4
4
  import BamAdapter from '../BamAdapter/BamAdapter'
@@ -11,7 +11,7 @@ export default class HtsgetBamAdapter extends BamAdapter {
11
11
  const bam = new HtsgetFile({
12
12
  baseUrl: htsgetBase,
13
13
  trackId: htsgetTrackId,
14
- })
14
+ }) as unknown as BamFile
15
15
 
16
16
  const adapterConfig = readConfObject(this.config, 'sequenceAdapter')
17
17
  if (adapterConfig && this.getSubAdapter) {
@@ -1,8 +1,21 @@
1
1
  import configSchema from './configSchema'
2
+ import PluginManager from '@jbrowse/core/PluginManager'
3
+ import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'
2
4
 
3
- export default (/* pluginManager: PluginManager */) => {
4
- return {
5
- configSchema,
6
- getAdapterClass: () => import('./HtsgetBamAdapter').then(r => r.default),
7
- }
5
+ export default (pluginManager: PluginManager) => {
6
+ pluginManager.addAdapterType(
7
+ () =>
8
+ new AdapterType({
9
+ name: 'HtsgetBamAdapter',
10
+ adapterMetadata: {
11
+ category: null,
12
+ hiddenFromGUI: true,
13
+ displayName: null,
14
+ description: null,
15
+ },
16
+ configSchema,
17
+ getAdapterClass: () =>
18
+ import('./HtsgetBamAdapter').then(r => r.default),
19
+ }),
20
+ )
8
21
  }
@@ -1,3 +1,20 @@
1
- export { default as configSchemaFactory } from './models/configSchema'
2
- export { default as modelFactory } from './models/model'
3
- export { default as ReactComponent } from './components/AlignmentsDisplay'
1
+ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
2
+ import PluginManager from '@jbrowse/core/PluginManager'
3
+ // locals
4
+ import configSchemaFactory from './models/configSchema'
5
+ import modelFactory from './models/model'
6
+ import ReactComponent from './components/AlignmentsDisplay'
7
+
8
+ export default function (pluginManager: PluginManager) {
9
+ pluginManager.addDisplayType(() => {
10
+ const configSchema = configSchemaFactory(pluginManager)
11
+ return new DisplayType({
12
+ name: 'LinearAlignmentsDisplay',
13
+ configSchema,
14
+ stateModel: modelFactory(pluginManager, configSchema),
15
+ trackType: 'AlignmentsTrack',
16
+ viewType: 'LinearGenomeView',
17
+ ReactComponent,
18
+ })
19
+ })
20
+ }
@@ -1,4 +1,3 @@
1
- import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
2
1
  import Plugin from '@jbrowse/core/Plugin'
3
2
  import PluginManager from '@jbrowse/core/PluginManager'
4
3
  import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'
@@ -6,24 +5,10 @@ import {
6
5
  svgFeatureRendererConfigSchema,
7
6
  SvgFeatureRendererReactComponent,
8
7
  } from '@jbrowse/plugin-svg'
9
- import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'
10
- import { LinearWiggleDisplayReactComponent } from '@jbrowse/plugin-wiggle'
11
- import PileupRenderer, {
12
- configSchema as pileupRendererConfigSchema,
13
- ReactComponent as PileupRendererReactComponent,
14
- } from '../../PileupRenderer'
15
- import SNPCoverageRenderer, {
16
- configSchema as snpCoverageRendererConfigSchema,
17
- ReactComponent as SNPCoverageRendererReactComponent,
18
- } from '../../SNPCoverageRenderer'
19
- import {
20
- configSchemaFactory as linearPileupDisplayConfigSchemaFactory,
21
- modelFactory as linearPileupDisplayModelFactory,
22
- } from '../../LinearPileupDisplay'
23
- import {
24
- configSchemaFactory as linearSNPCoverageDisplayConfigSchemaFactory,
25
- modelFactory as linearSNPCoverageDisplayModelFactory,
26
- } from '../../LinearSNPCoverageDisplay'
8
+ import PileupRenderer from '../../PileupRenderer'
9
+ import SNPCoverageRenderer from '../../SNPCoverageRenderer'
10
+ import LinearPileupDisplay from '../../LinearPileupDisplay'
11
+ import LinearSNPCoverageDisplay from '../../LinearSNPCoverageDisplay'
27
12
  import configSchemaFactory from './configSchema'
28
13
 
29
14
  // mock warnings to avoid unnecessary outputs
@@ -37,15 +22,7 @@ afterEach(() => {
37
22
 
38
23
  class AlignmentsPlugin extends Plugin {
39
24
  install(pluginManager) {
40
- pluginManager.addRendererType(
41
- () =>
42
- new PileupRenderer({
43
- name: 'PileupRenderer',
44
- ReactComponent: PileupRendererReactComponent,
45
- configSchema: pileupRendererConfigSchema,
46
- pluginManager,
47
- }),
48
- )
25
+ PileupRenderer(pluginManager)
49
26
 
50
27
  pluginManager.addRendererType(
51
28
  () =>
@@ -57,46 +34,9 @@ class AlignmentsPlugin extends Plugin {
57
34
  }),
58
35
  )
59
36
 
60
- pluginManager.addRendererType(
61
- () =>
62
- new SNPCoverageRenderer({
63
- name: 'SNPCoverageRenderer',
64
- ReactComponent: SNPCoverageRendererReactComponent,
65
- configSchema: snpCoverageRendererConfigSchema,
66
- pluginManager,
67
- }),
68
- )
69
-
70
- pluginManager.addDisplayType(() => {
71
- const configSchema = linearPileupDisplayConfigSchemaFactory(pluginManager)
72
- return new DisplayType({
73
- name: 'LinearPileupDisplay',
74
- configSchema,
75
- stateModel: linearPileupDisplayModelFactory(
76
- pluginManager,
77
- configSchema,
78
- ),
79
- trackType: 'AlignmentsTrack',
80
- viewType: 'LinearGenomeView',
81
- ReactComponent: BaseLinearDisplayComponent,
82
- })
83
- })
84
-
85
- pluginManager.addDisplayType(() => {
86
- const configSchema =
87
- linearSNPCoverageDisplayConfigSchemaFactory(pluginManager)
88
- return new DisplayType({
89
- name: 'LinearSNPCoverageDisplay',
90
- configSchema,
91
- stateModel: linearSNPCoverageDisplayModelFactory(
92
- pluginManager,
93
- configSchema,
94
- ),
95
- trackType: 'AlignmentsTrack',
96
- viewType: 'LinearGenomeView',
97
- ReactComponent: LinearWiggleDisplayReactComponent,
98
- })
99
- })
37
+ SNPCoverageRenderer(pluginManager)
38
+ LinearPileupDisplay(pluginManager)
39
+ LinearSNPCoverageDisplay(pluginManager)
100
40
  }
101
41
  }
102
42
 
@@ -5,10 +5,7 @@ import {
5
5
  svgFeatureRendererConfigSchema,
6
6
  SvgFeatureRendererReactComponent,
7
7
  } from '@jbrowse/plugin-svg'
8
- import PileupRenderer, {
9
- configSchema as pileupRendererConfigSchema,
10
- ReactComponent as PileupRendererReactComponent,
11
- } from '../PileupRenderer'
8
+ import PileupRenderer from '../PileupRenderer'
12
9
  import configSchemaFactory from './configSchema'
13
10
 
14
11
  // mock warnings to avoid unnecessary outputs
@@ -22,15 +19,7 @@ afterEach(() => {
22
19
 
23
20
  class PileupRendererPlugin extends Plugin {
24
21
  install(pluginManager) {
25
- pluginManager.addRendererType(
26
- () =>
27
- new PileupRenderer({
28
- name: 'PileupRenderer',
29
- ReactComponent: PileupRendererReactComponent,
30
- configSchema: pileupRendererConfigSchema,
31
- pluginManager,
32
- }),
33
- )
22
+ PileupRenderer(pluginManager)
34
23
  }
35
24
  }
36
25
 
@@ -1,2 +1,19 @@
1
- export { default as configSchemaFactory } from './configSchema'
2
- export { default as modelFactory } from './model'
1
+ import configSchemaFactory from './configSchema'
2
+ import modelFactory from './model'
3
+ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
4
+ import PluginManager from '@jbrowse/core/PluginManager'
5
+ import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'
6
+
7
+ export default function register(pluginManager: PluginManager) {
8
+ pluginManager.addDisplayType(() => {
9
+ const configSchema = configSchemaFactory(pluginManager)
10
+ return new DisplayType({
11
+ name: 'LinearPileupDisplay',
12
+ configSchema,
13
+ stateModel: modelFactory(configSchema),
14
+ trackType: 'AlignmentsTrack',
15
+ viewType: 'LinearGenomeView',
16
+ ReactComponent: BaseLinearDisplayComponent,
17
+ })
18
+ })
19
+ }
@@ -19,7 +19,6 @@ import {
19
19
  } from '@jbrowse/plugin-linear-genome-view'
20
20
  import { cast, types, addDisposer, getEnv, Instance } from 'mobx-state-tree'
21
21
  import copy from 'copy-to-clipboard'
22
- import PluginManager from '@jbrowse/core/PluginManager'
23
22
  import { Feature } from '@jbrowse/core/util/simpleFeature'
24
23
  import MenuOpenIcon from '@material-ui/icons/MenuOpen'
25
24
  import SortIcon from '@material-ui/icons/Sort'
@@ -49,10 +48,7 @@ const rendererTypes = new Map([
49
48
 
50
49
  type LGV = LinearGenomeViewModel
51
50
 
52
- const stateModelFactory = (
53
- pluginManager: PluginManager,
54
- configSchema: LinearPileupDisplayConfigModel,
55
- ) =>
51
+ const stateModelFactory = (configSchema: LinearPileupDisplayConfigModel) =>
56
52
  types
57
53
  .compose(
58
54
  'LinearPileupDisplay',
@@ -387,21 +383,20 @@ const stateModelFactory = (
387
383
 
388
384
  get filters() {
389
385
  let filters: string[] = []
390
- if (self.filterBy) {
391
- const { flagInclude, flagExclude } = self.filterBy
392
- filters = [
393
- `jexl:((get(feature,'flags')&${flagInclude})==${flagInclude}) && !(get(feature,'flags')&${flagExclude})`,
394
- ]
395
- if (self.filterBy.tagFilter) {
396
- const { tag, value } = self.filterBy.tagFilter
397
- filters.push(
398
- `jexl:"${value}" =='*' ? getTag(feature,"${tag}") != undefined : getTag(feature,"${tag}") == "${value}"`,
399
- )
400
- }
401
- if (self.filterBy.readName) {
402
- const { readName } = self.filterBy
403
- filters.push(`jexl:get(feature,'name') == "${readName}"`)
404
- }
386
+ const { flagInclude, flagExclude, tagFilter, readName } =
387
+ self.filterBy
388
+
389
+ filters = [
390
+ `jexl:((get(feature,'flags')&${flagInclude})==${flagInclude}) && !(get(feature,'flags')&${flagExclude})`,
391
+ ]
392
+ if (tagFilter) {
393
+ const { tag, value } = tagFilter
394
+ filters.push(
395
+ `jexl:"${value}" =='*' ? getTag(feature,"${tag}") != undefined : getTag(feature,"${tag}") == "${value}"`,
396
+ )
397
+ }
398
+ if (readName) {
399
+ filters.push(`jexl:get(feature,'name') == "${readName}"`)
405
400
  }
406
401
  return new SerializableFilterChain({ filters })
407
402
  },