-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy feature from evidence track #447
Comments
We can use the feature we already have that creates an Apollo feature from a JBrowse alignment feature as a template for this. In pluginManager.addToExtensionPoint(
'Core-extendPluggableElement',
annotationFromJBrowseFeature,
) Then the annotationFromJBrowseFeature function would look something like this: export function annotationFromJBrowseFeature(pluggableElement: PluggableElementBase) {
if (pluggableElement.name !== 'BasicFeatureDisplay') {
return pluggableElement
}
const { stateModel } = pluggableElement as DisplayType
const newStateModel = stateModel
.views((self) => ({
async createFeature() {
const feature = self.contextMenuFeature
// create the feature...
const change = new AddFeatureChange({
changedIds: [newFeature._id],
typeName: 'AddFeatureChange',
assembly: assemblyId,
addedFeature: newFeature,
})
const session = getSession(self)
await (
session as unknown as ApolloSessionModel
).apolloDataStore.changeManager.submit(change)
session.notify('Annotation added successfully', 'success')
},
}))
.views((self) => {
const superContextMenuItems = self.contextMenuItems
return {
contextMenuItems() {
const feature = self.contextMenuFeature
if (!feature) {
return superContextMenuItems()
}
return [
...superContextMenuItems(),
{
label: 'Create Apollo annotation',
icon: AddIcon,
onClick: self.createFeature,
},
]
},
}
})
;(pluggableElement as DisplayType).stateModel = newStateModel
return pluggableElement
} If you need to create a dialog instead of immediately copying the feature, the Let's start with a "Copy whole feature to Apollo" menu item that doesn't need a dialog. Once this works, we can figure out what a "Copy subfeature to Apollo" dialog might look like, but in general it should list all the subfeature in the JBrowse feature and ask which one(s) to copy, and ask for a destination gene in Apollo (or have a option to add them to a new gene?). The destination genes can be any in the Apollo track that overlap the coordinates of the JBrowse feature. |
Given a JBrowse FeatureTrack such as this:
Add an entry the right-click menu so that part or all of the feature can by copied to Apollo.
The two top priority copy actions are:
Other copy actions may be implemented on further discussion.
The text was updated successfully, but these errors were encountered: