Closed hsiaoyi0504 closed 6 years ago
Yes, you can extend the interface through plugins, modifying menus, toolbar options and inserting content into dialog boxes, sidebar.
Some methods are in the native plugins RegexSequenceSearch, HideTrackLabels. Other examples: https://github.com/enuggetry/jbserver, https://github.com/enuggetry/jblast
Hi @enuggetry thanks for your reply, after looking these examples, I am still confused, so what I need to do is overwriting the method Browser.createNavBox
of a Browser instance thisB.browser
defined in https://github.com/GMOD/jbrowse/blob/ab61f662413e77b9c6c6e78333cec697229a810e/plugins/RegexSequenceSearch/js/main.js#L22 using the syntax like thisB.browser.createNavBox= function (parent){....}
and insert the overwriting function I want, or maybe I am wrong ?
One another question is that I see in https://github.com/GMOD/jbrowse/blob/ab61f662413e77b9c6c6e78333cec697229a810e/plugins/RegexSequenceSearch/js/main.js#L23. This a function call of afterMilestone
. There are many milestones defined in original Browser.js
I am not sure how to determine this part. It looks like what I want to do is before initView
and perhaps should be done at initPlugins
. Do you have any suggestion about this ?
Thank you in advance.
@hsiaoyi0504 I think that is correct.
For sub-classing, you can call the inheriting class (if you want) by calling like we do here:
For milestone, If you look in JBrowse you'll see calls like this:
In Apollo, we did this in the plugin's main.js constructor, as well as after the milestone initView.
Hi For overriding classes, take a look at NeatCancasFreatures and the extend function for a good example.
On Jan 9, 2018 9:55 AM, "Nathan Dunn" notifications@github.com wrote:
@hsiaoyi0504 https://github.com/hsiaoyi0504 I think that is correct.
For sub-classing, you can call the inheriting class (if you want) by calling like we do here:
https://github.com/GMOD/Apollo/blob/master/client/apollo/js/View/Track/ AnnotTrack.js#L4900
For milestone, If you look in JBrowse you'll see calls like this:
https://github.com/GMOD/jbrowse/blob/master/src/JBrowse/Browser.js#L267
In Apollo, we did this in the plugin's main.js constructor, as well as after the milestone initView.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse/issues/953#issuecomment-356362916, or mute the thread https://github.com/notifications/unsubscribe-auth/AJlnAXzPqntnZav8pim2dqzC2qTTcqmCks5tI6gkgaJpZM4RVdlD .
Are you interested in the specific change from that thread (refSeqNameTransformer)? Or something similar?
Maybe could create a pull request for it
@nathandunn @enuggetry Thanks for pointing me. I will look into it.
@cmdcolin Yes, I am planning to have change refSeqNameTransformer
to make the pull down menu show the description of the refSeq, but I don't think it's a change let need to pull into the original repo, because it's solely a customization for NAL-i5k https://i5k.nal.usda.gov/ (other people may not need this feature) and we prefer to have a plugin to accumulate all the customizations.
I think adding a small amount of code like refSeqNameTransformer into jbrowse is probably easier than supplying that functionality through a plugin. Its just sort of complicated to do extensive replacement of existing function in browser.js unless a hook exists, but if the config hook exists then it is easy to add specific config settings via a plugin. Note that you wouldn't "customize jbrowse.conf" through your plugin, you would probably modify the this.browser.config object inside your plugin.
I guess you may have found solution but the amount of code to customize it without the hook looks fairly large here... Impressive work though:)
https://github.com/NAL-i5K/customize_refSeq/blob/master/js/main.js
@cmdcolin Oops, sorry I didn't see your comment until now. It's a good suggestion. This is just an exploration work, and maybe can provide some workaround to other people. I think why we try to do this is that plugin is more modular and can be plugged or transferred to other people more easily. Anyway, thanks for your reply.
@enuggetry As mentioned by @cmdcolin, my repo is at https://github.com/NAL-i5K/customize_refSeq/blob/master/js/main.js, but it doesn't work, and I see the console log have some additional error message like this:
TypeError: Cannot read property 'call' of undefined TypeError: Cannot read property 'call' of undefined
at http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:1979:29
at signalListener (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/Deferred.js:37:21)
at Deferred.then.promise.then (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/Deferred.js:258:5)
at Object.afterMilestone (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:1977:10)
at Object.constructor (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/plugins/customize_refSeq/js/main.js:14:17)
at new <anonymous> (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/declare.js:426:8)
at Object.<anonymous> (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:363:64)
at Object.forEach (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/array.js:247:15)
at Object.<anonymous> (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:333:28)
at http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/lang.js:385:55 TypeError: Cannot read property 'call' of undefined
at Browser.js:1979
at signalListener (Deferred.js:37)
at Deferred.then.promise.then (Deferred.js:258)
at Object.afterMilestone (Browser.js:1977)
at Object.constructor (main.js:14)
at new <anonymous> (declare.js:426)
at Object.<anonymous> (Browser.js:363)
at Object.forEach (array.js:247)
at Object.<anonymous> (Browser.js:333)
at lang.js:385
(anonymous) @ Browser.js:1981
signalListener @ Deferred.js:37
Deferred.then.promise.then @ Deferred.js:258
afterMilestone @ Browser.js:1977
constructor @ main.js:14
(anonymous) @ declare.js:426
(anonymous) @ Browser.js:363
forEach @ array.js:247
(anonymous) @ Browser.js:333
(anonymous) @ lang.js:385
runFactory @ dojo.js:1164
execModule @ dojo.js:1292
(anonymous) @ dojo.js:1330
guardCheckComplete @ dojo.js:1307
checkComplete @ dojo.js:1325
onLoadCallback @ dojo.js:1492
onLoad @ dojo.js:1745
Browser.js:1981 TypeError: Cannot read property 'call' of undefined TypeError: Cannot read property 'call' of undefined
at http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:1979:29
at signalListener (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/Deferred.js:37:21)
at signalWaiting (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/Deferred.js:28:4)
at Deferred.resolve (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/Deferred.js:192:5)
at http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/JBrowse/Browser.js:321:42
at notify (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/Deferred.js:187:23)
at complete (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/Deferred.js:168:4)
at dojo.DeferredList.resolve.callback (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/_base/Deferred.js:248:4)
at addResult (http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/DeferredList.js:54:10)
at http://localhost:8080/apollo/899498556180923073228059505/jbrowse/src/dojo/DeferredList.js:37:5 TypeError: Cannot read property 'call' of undefined
at Browser.js:1979
at signalListener (Deferred.js:37)
at signalWaiting (Deferred.js:28)
at Deferred.resolve (Deferred.js:192)
at Browser.js:321
at notify (Deferred.js:187)
at complete (Deferred.js:168)
at dojo.DeferredList.resolve.callback (Deferred.js:248)
at addResult (DeferredList.js:54)
at DeferredList.js:37
(anonymous) @ Browser.js:1981
signalListener @ Deferred.js:37
signalWaiting @ Deferred.js:28
Deferred.resolve @ Deferred.js:192
(anonymous) @ Browser.js:321
notify @ Deferred.js:187
complete @ Deferred.js:168
resolve.callback @ Deferred.js:248
addResult @ DeferredList.js:54
(anonymous) @ DeferredList.js:37
signalListener @ Deferred.js:37
signalWaiting @ Deferred.js:28
Deferred.resolve @ Deferred.js:192
(anonymous) @ Browser.js:354
signalListener @ Deferred.js:37
signalWaiting @ Deferred.js:28
Deferred.resolve @ Deferred.js:192
(anonymous) @ Browser.js:583
finish @ lazyload.js:111
pollWebKit @ lazyload.js:326
setTimeout (async)
pollWebKit @ lazyload.js:335
load @ lazyload.js:247
finish @ lazyload.js:113
pollWebKit @ lazyload.js:326
setTimeout (async)
pollWebKit @ lazyload.js:335
load @ lazyload.js:247
finish @ lazyload.js:113
pollWebKit @ lazyload.js:326
setTimeout (async)
pollWebKit @ lazyload.js:335
load @ lazyload.js:247
finish @ lazyload.js:113
pollWebKit @ lazyload.js:326
setTimeout (async)
pollWebKit @ lazyload.js:335
load @ lazyload.js:247
finish @ lazyload.js:113
pollWebKit @ lazyload.js:326
setTimeout (async)
pollWebKit @ lazyload.js:335
load @ lazyload.js:247
css @ lazyload.js:365
_loadCSS @ Browser.js:583
(anonymous) @ Browser.js:350
forEach @ array.js:247
(anonymous) @ Browser.js:333
(anonymous) @ lang.js:385
runFactory @ dojo.js:1164
execModule @ dojo.js:1292
(anonymous) @ dojo.js:1330
guardCheckComplete @ dojo.js:1307
checkComplete @ dojo.js:1325
onLoadCallback @ dojo.js:1492
onLoad @ dojo.js:1745
I think the problem maybe from the import list, I only import
[
'dojo/_base/declare',
'JBrowse/Plugin'
]
, but copy lots of code of CreateNavBox
, and perhaps use lots of function need to be imported. Do you have any idea of this?
This isn't an issue with core JBrowse, let's please move this plugin debugging discussion to the gmod-ajax mailing list.
Just curious about is it possible to overwrite browser.js and jbrowse.conf through writing a plugin. I see there is a discussion before http://gmod.827538.n3.nabble.com/Gmod-ajax-customization-of-the-pulldown-menu-td4052639.html teaching us how to customize the pull down menu through hack the
browser.js
and add lines tojbrowse.conf
, but I am seeking method to reach similar effect through plugin. since it's more easy to maintain compared to maintain another copy of jbrowse. Actually, my purpose is to incorporate some feature with Apollo.