%META:TOPICINFO{author="IanHolmes" date="1236315702" format="1.1" reprev="1.2" version="1.2"}% ---+!! %TOPIC% _JBrowse genome browser plugin._ Illustrates a [[%PUBURL%/TWiki/JBrowsePlugin/Makefile][Makefile]]-driven approach to a [[http://jbrowse.org][JBrowse]] genome browser plugin. %TOC% ---++ Syntax Rules #StandardAttrs Write =%JBROWSE%= or =%JBROWSE{ _attributes_ }%= anywhere in a TWiki topic to embed a [[http://jbrowse.org/][JBrowse]] genome browser for attached [[http://biowiki.org/BedFormat][BED]], [[http://biowiki.org/GffFormat][GFF]], [[http://biowiki.org/FastaFormat][FASTA]] or [[http://biowiki.org/WigFormat][Wiggle]] files. * Attached file types are recognized by their filename suffix: =.fasta= (or =.fa=), =.bed=, =.gff=, =.gff3=, =.wig= * A JBrowse configuration file snippet can also be attached, with special filename =config.js=. An example is shown [[#ExampleConfigFile][below]] * The following standard attributes to the =%JBROWSE%= macro are recognized | *Name* | *Description* | | =topic= | default: the current topic | | =showTracks= | default: %JBROWSEPLUGIN_SHOW% | | =navigateTo= | default: %JBROWSEPLUGIN_NAVIGATE% | The =topic= field can be used to display tracks attached to another topic, rather than the current topic. In combination with the =showTracks= and =navigateTo= fields, described below, this allows users to create a page that is deep-linked to a particular location in the genome. The =showTracks= field should be a comma-separated list of track names, each of which should correspond to the "label" element of the track information dictionaries. If no JBrowse config file is attached to the topic, the "label" element for each attached track file is just the filename. If a JBrowse config file is attached to the topic, then that config file includes a list of tracks (see [[#ExampleConfigFile][example config file]], below); the "label" elements then take the form "X_Y", where X is the track filename and Y is the "track" field in the config file. (Note that the "track" field in the config file is not necessarily the track name that is displayed on screen; that is determined by the "key" field. For documentation of the config file syntax, see [[http://jbrowse.org/code/jbrowse-master/docs/config.html][here]].) Spaces can be used in place of underscores, so "X Y" is equally valid as a track label in this case. The list of track labels is passed to the =showTracks= method in the =Browser.js= class, as documented [[http://jbrowse.org/docs/jbrowse-jsdoc/Browser.html#showTracks][here]]. The =navigateTo= field should be a location string, as might be typed into the navigation text box on the JBrowse page. This field is passed directly to the =navigateTo= method in the =Browser.js= class, as documented [[http://jbrowse.org/docs/jbrowse-jsdoc/Browser.html#navigateTo][here]]. Valid formats for the location string are described at that link. ---++ Examples For examples and more information, see: * http://biowiki.org/view/JBrowse/TWikiPlugin * http://jbrowse.org/ * http://jbrowse.org/docs/jbrowse-jsdoc/ ---++ Plugin Settings Plugin settings are stored as preferences variables. To reference a plugin setting write *%JBROWSEPLUGIN_setting%*, e.g. %JBROWSEPLUGIN_SHORTDESCRIPTION% = %JBROWSEPLUGIN_SHORTDESCRIPTION% * One line description, is shown in the %TWIKIWEB%.TextFormattingRules topic: * Set SHORTDESCRIPTION = _JBrowse genome browser plugin_ * Debug plugin: (See output in =data/debug.txt=) * Set DEBUG = 0 * Root URL for JBrowse installation * Set ROOT = /jbrowse ---++ Plugin Installation Instructions __Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server. * Install packages in the following places (or edit Makefiles in =jbrowse/twiki= accordingly): 1 JBrowse in =/usr/local/jbrowse= (ensure that your webserver points URLs beginning with =/jbrowse/= to this location) 1 TWiki in =/usr/local/twiki= 1 CPAN modules required by JBrowse (Bioperl, JSON) ...these can go anywhere =PERL5LIB= can find them * Type =cd /usr/local/jbrowse/twiki; make install= * The following files will be softlinked into TWiki: | *File:* | *Description:* | | ==data/TWiki/%TOPIC%.txt== | Plugin topic | | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module | | ==lib/TWiki/Plugins/%TOPIC%/== | Plugin directory | | ==lib/TWiki/Plugins/%TOPIC%/Makefile.jbrowse== | Plugin makefile | * Configure the Plugin: * TWiki 4.0 and up: Run the [[%SCRIPTURL%/configure%SCRIPTSUFFIX%][configure]] script to enable the Plugin * Change the Plugin settings as needed * Test if the installation was successful: 1 attach a FASTA file and a GFF file (with matching sequence names) 1 edit the text of the page to include the string =%JBROWSE%= 1 you should see a JBrowse browser embedded in the page; the GFF file should show up as a track 1 attach a JBrowse config file snippet, named =config.js=, to set the track styles; e.g. #ExampleConfigFile
    {
      "track": "ExampleFeatures",
      "key": "Example Features",
      "feature": ["remark"],
      "autocomplete": "all",
      "class": "feature2"
    },
    {
      "track": "NameTest",
      "feature": ["protein_coding_primary_transcript", "polypeptide"],
      "class": "feature2",
      "key": "Name test track"
    },
    {
      "track": "Motifs",
      "feature": ["polypeptide_domain"],
      "class": "feature3",
      "description": 1,
      "key": "Example motifs"
    },
    {
      "track": "Alignments",
      "feature": ["match"],
      "class": "feature4",
      "key": "Example alignments",
      "category": "Alignments"
    },
    {
      "track": "Genes",
      "feature": ["gene"],
      "class": "feature5",
      "key": "Protein-coding genes"
    },
    {
      "track": "ReadingFrame",
      "feature": ["mRNA"],
      "class": "dblhelix",
      "key": "Frame usage",
      "category": "Genes"
    },
    {
      "track": "CDS",
      "feature": ["CDS:predicted", "mRNA:exonerate"],
      "class": "cds",
      "phase": 1,
      "key": "Predicted genes",
      "category": "Genes"
    },
    {
      "track": "Transcript",
      "feature": ["mRNA:exonerate"],
      "description": 1,
      "class": "transcript",
      "subfeature_classes": {
        "CDS": "transcript-CDS",
        "five_prime_UTR": "transcript-five_prime_UTR",
        "three_prime_UTR": "transcript-three_prime_UTR"
      },
      "key": "Exonerate predictions",
      "category": "Genes"
    },
    {
      "track": "Clones",
      "feature": ["BAC"],
      "class": "exon",
      "description": 1,
      "key": "Fingerprinted BACs"
    },
    {
      "track": "EST",
      "feature": ["EST_match:est"],
      "class": "est",
      "key": "ESTs"
    }
See [[http://jbrowse.org/code/jbrowse-master/docs/config.html][here]] for documentation of the config file syntax. Note that the TWiki plugin expects only the track list portion of the config file, _excluding_ the enclosing ="tracks" : [ ... ]=, and also excluding the other fields such as ="TRACK DEFAULTS"= or the fields describing the database adapter. ---++ Plugin Info | Plugin Author: | TWiki:Main.IanHolmes | | Copyright: | © 2007, TWiki:Main.IanHolmes | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | Plugin Version: | 21 Jul 2008 (V1.000) | | Change History: | | | 21 Jul 2008: | Initial version | | TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 | | CPAN Dependencies: | none | | Other Dependencies: | none | | Perl Version: | 5.005 | | [[TWiki:Plugins/Benchmark][Benchmarks]]: | %TWIKIWEB%.GoodStyle nn%, %TWIKIWEB%.FormattedSearch nn%, %TOPIC% nn% | | Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% | | Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev | | Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal | __Related Topics:__ %TWIKIWEB%.TWikiPlugins, %TWIKIWEB%.DeveloperDocumentationCategory, %TWIKIWEB%.AdminDocumentationCategory, %TWIKIWEB%.TWikiPreferences