Scott Cain's website

Bioinformatics, Perl, Cool Stuff
Powered by Drupal, an open source content management system

Email: sco...@scottcain.net

GMOD.org recent changes
Syndicate content
Track the most recent changes to the wiki in this feed. MediaWiki 1.23.13
Updated: 24 min 21 sec ago

JBrowse Configuration Guide

Thu, 05/25/2017 - 02:23

‎Making a New JBrowse

← Older revision Revision as of 06:23, 25 May 2017 (One intermediate revision by the same user not shown)Line 26: Line 26:        sudo apt-get install zlib1g-dev libpng-dev libgd2-noxpm-dev build-essential    sudo apt-get install zlib1g-dev libpng-dev libgd2-noxpm-dev build-essential  +  +Some other things that sometimes need to be manually installed if your setup.sh is failing includes these  +  +  sudo apt-get install libexpat-dev libxml2-dev libdb-dev     If you need a web server you can add apache2 to the list If you need a web server you can add apache2 to the list Line 3,030: Line 3,034:  * Add (or remove) options in the JBrowse dropdown menus. * Add (or remove) options in the JBrowse dropdown menus.  * Add new types of track selectors. * Add new types of track selectors.  +  +  +Also see this FAQ entry http://gmod.org/wiki/JBrowse_FAQ#How_do_I_create_a_plugin.3F and http://gmod.org/wiki/JBrowse_FAQ#What_is_a_plugin_useful_for.3F     === Plugin Components === === Plugin Components === Colin Diesh
Categories: Bio

JBrowse Configuration Guide

Wed, 05/24/2017 - 15:53

← Older revision Revision as of 19:53, 24 May 2017 Line 3,030: Line 3,030:  * Add (or remove) options in the JBrowse dropdown menus. * Add (or remove) options in the JBrowse dropdown menus.  * Add new types of track selectors. * Add new types of track selectors.  +  +  +Also see this FAQ entry http://gmod.org/wiki/JBrowse_FAQ#How_do_I_create_a_plugin.3F and http://gmod.org/wiki/JBrowse_FAQ#What_is_a_plugin_useful_for.3F     === Plugin Components === === Plugin Components === Colin Diesh
Categories: Bio

JBrowse FAQ

Wed, 05/24/2017 - 15:36

← Older revision Revision as of 19:36, 24 May 2017 (One intermediate revision by the same user not shown)Line 651: Line 651:     Check out the genes store class from the myvariantviewer plugin for an example of a simple custom adaptor https://github.com/cmdcolin/myvariantviewer/blob/master/js/Store/SeqFeature/Genes.js Check out the genes store class from the myvariantviewer plugin for an example of a simple custom adaptor https://github.com/cmdcolin/myvariantviewer/blob/master/js/Store/SeqFeature/Genes.js  +  +  +  +== What is a plugin useful for? ==  +  +A JBrowse plugin can do a wide variety of things. Some common use-cases would be  +  +* making a custom track type or visualization  +* making an adapter for a new file type or "store class"  +* adding new pieces to the user interface  +  +Other things that are extensible include  +  +* accessing custom search backends (the so called "Names API")  +* accessing custom filter functions https://github.com/cmdcolin/filterplugin  +* making custom "Save track data" export formats  +  +One cool thing is that when you create a plugin, you can simply reference it textually in your config file e.g. trackList.json, and then JBrowse will load the "class" from your plugin and initialize it  +  +== What background should I have for creating a plugin ==  +  +  +Make sure to review this link describing dojo declare, the way dojo declares new object types http://dojotoolkit.org/reference-guide/1.10/dojo/_base/declare.html  +  +Also review http://dojotoolkit.org/documentation/tutorials/1.9/modules/  +  +Understanding "*dojo declare*" and *asynchronous module definition (AMD)* will help you understand the “preamble” on the top of every file that jbrowse uses, and which you can use in your plugin  +  +  +== How do I create a plugin? ==  +  +Let's walk through a simple plugin with the goal of adding something to the track menu (e.g. where the "About this track" and "Save track data" options are)  +  +To do this, we can use object- oriented principles to “inherit” from some existing track type like CanvasFeatures and then extend its functionality by overriding the functions in a new track type  +  +  +We can inherit a new track type by using the “define” function to include the dependencies needed in a file, and they are listed in an array at the top of your file.  +  +First initialize a new plugin using  +  + bin/new-plugin.pl MyPlugin  +  +Then edit a new file, say plugins/MyPlugin/js/MyTrack.js  +  +  + define( ["dojo/_base/declare", "JBrowse/View/Track/CanvasFeatures"],  +    function(declare,CanvasFeatures) {  +    return declare(CanvasFeatures, {  +        _trackMenuOptions: function() {  +  +            var opts=this.inherited(arguments); //call the parent classes function  +            opts.push( // add an extra menu item to the array returned from parent class function  +                {         +                    label: "Custom item",  +                    type: 'dijit/CheckedMenuItem',  +                    onClick: function(event) {  +                        console.log('Clicked');  +                    },   +                    iconClass: "dijitIconPackage"  +                }   +            );   +            return opts;  +        }   +    });  +    }   + );  +  +Code listing 1. an example custom track type, plugin/MyPlugin/js/MyTrack.js, that adds an extra track menu item  +  +  +  +After this, we will have the plugin directory structure like this  +  + jbrowse/plugins/MyPlugin  + jbrowse/plugins/MyPlugin/js  + jbrowse/plugins/MyPlugin/js/main.js  + jbrowse/plugins/MyPlugin/js/MyTrack.js  +  +The bin/new-plugin.pl helps create the skeleton main.js  +  +Then we can use our new plugin to a config file like jbrowse_conf.json as "plugins": ["MyPlugin"]  +  +  +Then edit the trackList.json for an existing track and change `"type":  "CanvasFeatures"` to `"type": "MyPlugin/MyTrack"`.  +  +That will tell jbrowse to load the MyTrack class from your plugin instead of the normal CanvasFeatures class.       Line 915: Line 1,001:     In general, using normal commands like flatfile-to-json, prepare-refseqs, etc work fine though. See setup.sh for how the volvox sample data combines using biodb-to-json and other techniques. In general, using normal commands like flatfile-to-json, prepare-refseqs, etc work fine though. See setup.sh for how the volvox sample data combines using biodb-to-json and other techniques.  +  +     = Visualization tips = = Visualization tips = Colin Diesh
Categories: Bio