Skip to content

Commit

Permalink
Try making LinearFeatureDisplay
Browse files Browse the repository at this point in the history
Move things around

Fix
  • Loading branch information
cmdcolin committed Nov 5, 2020
1 parent f5da436 commit f441980
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ConfigurationSchema } from '@jbrowse/core/configuration'
import { BaseTrackConfig } from '@jbrowse/plugin-linear-genome-view'
import { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'

import PluginManager from '@jbrowse/core/PluginManager'

export default function configSchemaFactory(pluginManager: PluginManager) {
return ConfigurationSchema(
'FeatureTrack',
'LinearFeatureDisplay',
{
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
renderer: pluginManager.pluggableConfigSchemaType('renderer'),
// overrides base
maxDisplayedBpPerPx: {
Expand All @@ -15,6 +15,6 @@ export default function configSchemaFactory(pluginManager: PluginManager) {
defaultValue: 1000,
},
},
{ explicitlyTyped: true, baseConfiguration: BaseTrackConfig },
{ baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },
)
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'
import { getParentRenderProps } from '@jbrowse/core/util/tracks'
import { MenuItem } from '@jbrowse/core/ui'
import { basicTrackStateModelFactory } from '@jbrowse/plugin-linear-genome-view'
import { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'
import VisibilityIcon from '@material-ui/icons/Visibility'

import { types, Instance } from 'mobx-state-tree'
Expand All @@ -10,10 +10,10 @@ import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration/configur
const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
types
.compose(
'FeatureTrack',
basicTrackStateModelFactory(configSchema),
'LinearFeatureDisplay',
BaseLinearDisplay,
types.model({
type: types.literal('FeatureTrack'),
type: types.literal('LinearFeatureDisplay'),
showLabels: types.optional(types.boolean, true),
displayMode: types.optional(types.string, 'normal'),
configuration: ConfigurationReference(configSchema),
Expand All @@ -30,6 +30,10 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
.views(self => {
const { trackMenuItems } = self
return {
get rendererTypeName() {
const renderer = getConf(self, 'renderer')
return renderer.type
},
get renderProps() {
const config = self.rendererType.configSchema.create({
...getConf(self, 'renderer'),
Expand Down
18 changes: 11 additions & 7 deletions plugins/svg/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'
import Plugin from '@jbrowse/core/Plugin'
import PluginManager from '@jbrowse/core/PluginManager'
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'
import {
configSchema as svgFeatureRendererConfigSchema,
ReactComponent as SvgFeatureRendererReactComponent,
Expand All @@ -10,7 +11,7 @@ import {
import {
configSchema as featuresTrackConfigSchema,
modelFactory as featuresTrackModelFactory,
} from './FeatureTrack'
} from './LinearFeatureDisplay'

export default class SVGPlugin extends Plugin {
name = 'SVGPlugin'
Expand All @@ -24,13 +25,16 @@ export default class SVGPlugin extends Plugin {
configSchema: svgFeatureRendererConfigSchema,
}),
)
pluginManager.addTrackType(() => {

pluginManager.addDisplayType(() => {
const configSchema = featuresTrackConfigSchema(pluginManager)
return new TrackType({
name: 'FeatureTrack',
stateModel: featuresTrackModelFactory(configSchema),
return new DisplayType({
name: 'LinearFeatureDisplay',
configSchema,
compatibleView: 'LinearGenomeView',
stateModel: featuresTrackModelFactory(configSchema),
trackType: 'FeatureTrack',
viewType: 'LinearGenomeView',
ReactComponent: BaseLinearDisplayComponent,
})
})
}
Expand Down

0 comments on commit f441980

Please sign in to comment.